Difference between revisions of "Camera"
m (→Camera) |
|||
Line 1: | Line 1: | ||
The Camera | The '''Camera''' represents the position in a [[Card]]'s space which is visible to the player. | ||
== Moving through large worlds == | |||
Moving the camera is a mechanism for showing more of the world than will fit on screen at once. All Castle cards have a 10x14 viewport which is centered on the camera, which sits at (0, 0) by default. If a card needs more space that doesn't fit within that viewport, the solution is to move the camera. | |||
To move the camera, first assign the camera to follow an [[Actor]]. The most common pattern is to do this inside a [[Rule]] when the actor is created: '''When this is created: Follow this with the camera'''. | |||
Next, move the actor, either by assigning the actor some controls, or by giving it a velocity. As the actor moves, the camera will move with it, and you'll see more of the world space. | |||
== Detecting when something is inside or outside the viewport == | |||
It can be useful to know when something enters or leaves the visible space in the card. You can detect this with the [[Trigger|Triggers]] '''When this enters the camera viewport''' and '''When this exits the camera viewport'''. There is also a [[Condition]] for '''If this is in the camera viewport'''. |
Revision as of 17:34, 12 May 2022
The Camera represents the position in a Card's space which is visible to the player.
Moving through large worlds
Moving the camera is a mechanism for showing more of the world than will fit on screen at once. All Castle cards have a 10x14 viewport which is centered on the camera, which sits at (0, 0) by default. If a card needs more space that doesn't fit within that viewport, the solution is to move the camera.
To move the camera, first assign the camera to follow an Actor. The most common pattern is to do this inside a Rule when the actor is created: When this is created: Follow this with the camera.
Next, move the actor, either by assigning the actor some controls, or by giving it a velocity. As the actor moves, the camera will move with it, and you'll see more of the world space.
Detecting when something is inside or outside the viewport
It can be useful to know when something enters or leaves the visible space in the card. You can detect this with the Triggers When this enters the camera viewport and When this exits the camera viewport. There is also a Condition for If this is in the camera viewport.