relative movement of layers on Platform Game

Started by
2 comments, last by alexfradiani 13 years, 2 months ago
Hi all.

i would like to ask some opinions on handling movement for layers of different depths in a platform game. take for example 3 layers:
0 -> main objects and character movement through platforms.
1-> mountains, landscape, etc.. and visual decorations as background.
2-> clouds and very far objects, the last visuals for the scene.

right now i'm just using a render method in which i take the movement for first layer (based on the movement for the character controlled by the user) and multiply it by a factor
to reduce the motion of the layer that is supposed to be at a distance from the main layer. and for the last one, a similar process or no movement at all.

What other methods can be used to achieve this?, looking to have a natural perception, also based on what most platform scroller games out there use.
Advertisement
You could also apply a scaling transform before drawing each layer. You would have to draw your images at different sizes so they look correct, but it would effectively change the coordinate system for the back layers so that it takes a bigger difference in position to have an equivalent shift.
I can't offer specific help, but the thing you are talking about has the name Parallax scrolling ( http://en.wikipedia.org/wiki/Parallax_scrolling ). Said article contains different techniques. It looks like you're using the 'layer method' described therein. It seems like your method is probably the most straightforward to implement.

C++: A Dialog | C++0x Features: Part1 (lambdas, auto, static_assert) , Part 2 (rvalue references) , Part 3 (decltype) | Write Games | Fix Your Timestep!


I can't offer specific help, but the thing you are talking about has the name Parallax scrolling ( http://en.wikipedia....allax_scrolling ). Said article contains different techniques. It looks like you're using the 'layer method' described therein. It seems like your method is probably the most straightforward to implement.



Thanks for the link!.
wikipedia to the rescue.


This topic is closed to new replies.

Advertisement