Scenes are the building blocks of your game. They contain the objects of your game and provide an essential way to organize different sections of your game. For example, you may create a scene for the initial menu for the game, another for an individual game level, another to end the game, etc. You can use scenes to design and build your game in segments.
The following attributes define each scene and are modifiable:
- Name: A descriptive way for you to refer to different scenes within your game.
- Time: The number of seconds a scene has been active. This attribute can be read and incorporated into your rules/behaviors, but not set.
- Size: The pixel dimensions (width and height) of the current scene.
- Wrap X: When enabled, actors that exit the left side of the scene will re-enter from the right side of the scene (and vice versa). When disabled, actors continue moving indefinitely off-screen unless they are explicitly destroyed (via behaviors you’ve set).
- Wrap Y: Similar to “Wrap X”, but in the up/down direction. When enabled, actors that exit the top of the scene will re-enter from the bottom of the scene (and vice versa). When disabled, actors continue moving indefinitely off-screen unless explicitly destroyed (via behaviors you’ve set).
- Gravity: The strength of gravity in the scene. The default value is 0. Using a value between 100 and 1000 will provide approximately “normal” gravity. We caution against using any values significantly above 10,000. Please note that gravity can be directed in both the X and Y directions; negative values will cause items to go in the opposite direction. Gravity affects all movable objects in the scene.
- Color: The background color of the scene, represented via red, green, blue, and alpha real values between 0 and 1. You can edit any of these individual values, or you can select a color from the color picker.
- Camera: Compound attribute with the following sub-categories:
- Origin: The starting x and y position of the lower left corner of the camera relative to the scene.
- Size: This sets the width and height describing how much of the scene will be shown when the game is played. These values are set depending on the Platform selected in the Project Properties, but can be modified manually in the Attributes window. The default values for the scene and camera size change depending on what Platform you selected in the Project Properties.
- Tracking area: You can give actors within your scene a “Control Camera” behavior which ensures that the camera will follow the actor as they move through a scene. This tracking area sets the boundaries (width and height) for when to begin scrolling a scene (if possible) based on the position of an actor with the Control Camera behavior. The camera will snap to the actor with that behavior unless it would force the camera to move beyond the edge of a scene (important: make sure your scene is larger than your camera when using the Control Camera behavior, otherwise it won’t follow the actor because the camera has no room to move).
- Rotation: The rotation of the camera which changes based on auto-rotation. This cannot be modified manually.
- Auto-rotate: Rotates the scene to adapt to a player turning their device. For example, if a player turns their device upside down, you may want the game to autorotate to portrait (or landscape) upside-down to adjust to this new view. In contrast, if you are creating a maze or tilt game, you would not want the scene to rotate as the player tilts the device to navigate the ball (or whatever object) around the maze. The default Auto-rotation setting is Landscape Left and will only affect Android devices.
As we’ll discuss in more detail later, attributes are the values (numeric or text) relating to an object that are easily and rapidly changed at any point. For instance, the positioning of the camera in a scene can be changed by altering the “camera origin” attributes, while the background color of the scene is alterable with the “color” attribute.
Finally, we have the “Reset Scene” and “Reset Game” behaviors. The former will reset just the current scene and that scene’s attributes, while the latter will reset all scenes and attributes in the game.
By clicking the camera image, we can adjust the camera zone. The camera zone is the movement leeway an actor has before causing the camera to move. In other words, let’s say we have an actor that controls the camera’s movement. Generally, as the actor moves through the scene, the camera would follow. But if the actor turned around and headed in the opposite direction – we would want it to move a small distance before the camera started to follow. That distance is the movement leeway – controlled with the camera zone. Use the handles to reduce or increase this margin; basically the actor controlling the camera will be able to move freely in the central black area before bumping into the camera zone and moving the camera along with the actor.