Camera - earok/scorpion-editor-demos GitHub Wiki
"Camera" in this context refers to the position of the viewable area relative to the top left of the game level. An X of 100 would mean 100 pixels from the left of the level edge, a Y of 100 would mean 100 pixels from the top of the level edge.
Positioning the camera
The Camera Position command can be used to place the camera anywhere within the map (with the top/left/right/bottom sides all constrained by the size of the level itself).
These flags can be set:
From Center
The camera is positioned so that the center of the camera is at the coordinates, rather than the top left corner. This can be convienient when implementing a custom camera follow routine.
Camera Warp
The camera not only moves, but drags all objects along with it so they're still in the same place on screen. This is useful for games that have an infinitely looping level, but can also be used as an alternative to autoscroll.
Fast Warp
Normally, doing a camera warp to a dramatic distance away from the current position will cause a frame skip, since every single tile on screen will need to be redrawn.
If both the source and the destination camera view have an identical set of background tiles (for an infintely looping level that has identical graphics at the start and end), fast warp can be used to mitigate this as it instructs Scorpion not to trigger a full screen tile redraw. But this is a command that has certain restriction in the distance a camera is warped.
Refer to this table below for how far to warp with Fast Warp. Note that even following these restrictions, there is some nuance and may require some experimentation.
| Platform | X Axis | Y Axis |
|---|---|---|
| Amiga | Not supported (Corkscrew scroll restrictions) | Multiples of Buffer Height * 16 |
| Mega Drive | Multiples of Plane Width | Multiples of Plane Height |
| NeoGeo | Multiples of 512 | Multiples of 512 |
Reset Movement
This flag will disable the camera following the player. You would typically want to do this if, for example, you want to control the camera during a cutscene.
Camera Bounds
Typically, the camera can scroll the entire level. This isn't always desirable, for example if there's a hidden off-screen area that enemies can scroll into view from, or a secret room you can't see until you've walked into it.
The Camera Bounds command can set the absolute Left/Right/Up/Down positions of where the camera can scroll to. The defaults of these are:
- Left = 0
- Right = MapWidth - XRes
- Up = 0
- Down = MapHeight - YRes
Camera Bounds can automatically be set when entering a part of the level by configuring the Is Camera Zone tickbox on events. This means that any player that enters such an event will trigger the change in camera bounds automatically.
Auto Scrolling
For an automatically scrolling game like 1942 or Gradius, the ScrollSpeed command can be used to set how many pixels are scrolled on each axis.
Any actor with the Auto Scroll tickbox set will automatically moved along with the display.
Camera Follow
The CameraFollow command determines how a camera follows a player across the level.
Note that the ActorCameraFollow (and related commands like PlayerCameraFollow) can be used to change which player the camera is actually following.
Camera Follow Left/Right/Up/Down
The left/right/up/down tickboxes determine in which directions the camera can move. For example, in a game like Defender that only scrolls left and right, only left and right would be ticked.
Snap To Player
Snap To Player immediately repositions the camera over the player, rather than leaving the camera to automatically pan to the player.
Max Camera Follow
Max Camera follow sets how many pixels per frame the camera can move. More than the default setting of 8 risks frame skips, especially on the Amiga platform.
Smoothing
Camera smoothing applies a smoothing function to the amount of camera movement each frame. For example, on the lowest setting if the camera is meant to move 16 pixels towards the player, it would move 8 on the first frame, 4 on the second, 2 on the third, 1 on the forth, and none at all on the fifth. Note that Camera smoothing can interfere with look ahead, more details about that below.
Camera Interpolate (Amiga)
Camera Interpolate is an Amiga-only feature that scrolls by half the camera movement speed in a skipped frame. This allows the camera to appear to be scrolling at 50hz even in a 25hz game.
Sprite Interpolate (Amiga)
Sprite Interpolate is an Amiga-only feature that moves all hardware sprites by half their movement speed in a skipped frame. This allows sprite actors to appear to move at 50hz even in a 25hz game.
Camera Box
The CameraBox command allows you to set the "box" around the followed player that allows them to see ahead, or above, or below. By default, the size of the camera box on all sides is 0 which means that it's clamped to the player with no ability to look further ahead of them.
Setting the Left and the Right to 10 for example, means that the camera can be ten pixels left of the player and ten pixels right of the player at most.
The Look Ahead settings determine how many pixels per frame the camera can look ahead in the direction the player is facing. For example, with a look ahead on left/right of 1, in the previous example it would take the game ten frames to move the camera to the maximum possible distance from the player in that direction.
Note that Look Ahead speeds are subject to smoothing, so a dramatic level of smoothing will require an equally dramatic look ahead speed set.