Usage:
- Create a Node2D, and on this Node2D node, create a ZoomCamera2D camera as a child scene node.
- Attach the [initial_camera.gd] script to the Node2D node.
initial_camera.gd (5.8 KB)

3. Configure the data in the Inspector panel on the right side of the Node2D node (the Inspector property names must match the database variable names).
4. In the database, configure the project variables with the corresponding names and variables (the variable names must match the Inspector property names).
5. Optional: You can configure a reset/read toggle for variables in the database project settings (the name must match the database reset toggle name).
Features:
- Reads project variables from the database to change the camera’s limit range (e.g., limit left -200, limit right xxx).
- Allows you to enable or re-read camera variable data via project toggles in the database (dynamic reading toggle) (refresh switch record).
- Automatically reads the set camera size once when the scene starts.
: If you need to re-read the camera data, after changing the variable in an action, you must turn the toggle ON, wait for 0.1 seconds, and then turn it OFF.
If you switch the toggle too quickly, the data will not be read correctly.
Use cases:
- Dynamically change the camera’s visible limit range: If empty spaces in the scene break immersion, you can change the limit range when the character passes a checkpoint. Combined with camera zoom actions, this allows for smooth zooming effects.
- Reduce the number of scenes: For example, instead of creating separate scenes for every area and linking them via portals or conditions, which can become hard to manage in non-linear games later on, you can use a single empty scene to generate all other pre-made scenes. You can then spawn characters and other elements using coordinates, and the camera range can be adjusted freely to fit the scene size. (The empty scene generates scene reader objects; the scene reader objects read the scene ID, generate the corresponding scene, and the generated scene updates the camera data.)
: Be careful: If you use a scene to generate Scene A inside an empty scene, and Scene A contains monsters or players, collision interactions will work, but distance-based conditions (such as attack range) will not activate, and other issues like misalignment may occur.
Instead, use the empty scene to generate Scene A, Character B (requires coordinate variables), Monster C (requires coordinate variables), etc., individually via ID.
Demo:



