Camera
What the game sees. The entity’s transform positions the camera; rotation and scale apply too.
Works with: Follow (to follow the player)
Needed by: CameraControls, Commander, FirstPersonView, ScreenEffects, Viewport
In a network game, each machine keeps its own entity with this on it: it isn’t sent.
Properties
Section titled “Properties”Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.
size: a number = 5. Half the visible height, in world units. Width follows the window’s aspect ratio. (Field: a number.)hudSize: a number = 0. The Size the HUD is laid out at, for a camera that zooms: set it (usually to Size) and everything pinned with a ScreenAnchor keeps its size and place on the screen as Size changes, drawn, placed and clicked at Size / HudSize times its size, its anchor’s offset and what’s inside it too. 0 (the default): the HUD is in world units, so it zooms with the world. (Field: a number.)background: a color, “#RRGGBB” or “#RRGGBBAA” = “#1E222BFF”. The color behind everything, where nothing is drawn. (Field: a color.)sortByY: true or false = false. For top-down games: among things with the same Order and Z, whatever is lower down draws in front, so the player walks behind a tree’s top and in front of its trunk. A sprite sorts by the bottom of its picture, where it stands (a character’s feet, a tree’s trunk), so tall and short sprites side by side sort by where they stand; anything else that draws sorts by its position. A tilemap that sorts by Y puts each row of tiles at its cells’ middle. (Field: on or off.)ambient: a color, “#RRGGBB” or “#RRGGBBAA” = “#FFFFFFFF”. The light that reaches everything no Light lights. White (the default) is daylight, where lights make no difference; a dark color makes a cave or a night (dark blue), and black is pitch dark. The HUD and menus are never darkened: anything pinned with a ScreenAnchor, and anything inside the camera. (Field: a color.)transition: one of Fade, Wipe, Iris = “Fade”. How the screen covers up and uncovers a scene change in this scene: a fade, a wipe or an iris. (Field: one of its values.)
kickBy: [x, y] = [0,-0.3]. Which way and how far Kick pushes the view, in world units: (0, -0.3) jolts it down a little, as a landing or a heavy hit does. A Trigger’s or a Button’s Do “Kick” kicks it this way with no code. (Field: a vector.)kickTime: a number = 0.2. Seconds a kick takes, out and back. (Field: a number.)
Actions
Section titled “Actions”What anything can make it do with no code: a Trigger’s do when its message arrives, a Contraptions Wire’s input as its signal comes on, a script’s Game.Do(entity, “Name”).
Kick. Kicks the view by its KickBy over its KickTime (see Kick).
While the game runs
Section titled “While the game runs”Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.
hudScale: a number. How many times its own size the HUD is drawn so it keeps its size on the screen: Size / HudSize, or 1 with no HudSize.isDark: true or false. True if the ambient light right now (CurrentAmbient) is darker than daylight, so lights show.currentAmbient: a color, “#RRGGBB” or “#RRGGBBAA”. The ambient light right now: Ambient, or the Room.Ambient of the room the camera is in, fading from one to the other as it moves between rooms.shakeOffset: [x, y]. How far the view is currently thrown off by Shake and Kick, in world units.
Scripts use it as Camera: its methods, events and values that aren’t saved with the scene.