I’m working on a “simple” game engine of which the display is already working.
It works as follows:
- A map can consist of multiple layers
- Each layer can contain sprites and tiles
- Sprites and tiles both can be either solid or non-solid
- Sprites and tiles both can be multiple layers “tall”
- the top-left corner of all layers is at 0,0 and the parallax effect is achieved using a different scroll factor for each layer.
Assumed I have a game consisting of two layers.
Layer 1 has a scroll factor of 0.5 and contains a solid tile which is 2 layers tall (layer 1 and 2)
Layer 2 has a scroll factor of 1 and contains a solid sprite which is 1 layer tall (only layer 2)
How do I compute if the sprite collides with the tile on the “projection layer” as seen by the player (in this case it’s layer 2 since it has a scroll factor of 1)?