prosperon/docs/2d.md

14 lines
1.7 KiB
Markdown

# Yugine 2D Tooling
## 2D game editing
2D game levels take place on a 2D plane. Objects can be on layers from -127 to 127. When you start editing, you begin with placing objects on layer 0.This makes it easy to add foreground and background graphics. In addition, each layer has a parallax value from -127 to 127. A parallax value of 1 means the sprite moves at a 1:1 ratio with the camera, ie, if the camera "moves" one pixel to the right, the object will appear to move 1 pixel to the left across the screen. Positive parallax values denote faster movement, so a parallax value of 100 indicates the object will move 100 pixels to the left if the camera moves 1 pixel to the right. Negative parallax values indicate slower movement, so a value of -100 indicates that the object will move 1 pixel to the left for every 100 pixels to the right the camera moves. A parallax value of 0 indicates the object will not move when the camera moves. This might be used for static stars in the background of a space level, for example.
If two sprites on the same layer overlap, it is undefined behavior. Be sure they do not overlap!
Instead of selecting what layer each element is on, it might be useful to group them. Gameobject fields can be set to a specific layer. You can choose to have each object's layer determined by its type instead of individually. For example, in a platformer it often makes sense to have all Monsters and the Player on the same layer.
There are three viewing modes in 2D mode:
- Game view: how the level will be seen when the game is run.
- Layer view: View only one layer at a time.
- Onion view: View a selected layer; all layers behind that layer are drawn as normal, and all layers on top are drawn transparently.