Jump to content

  • Log In with Google      Sign In   
  • Create Account

relative movement of layers on Platform Game


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 alexfradiani   Members   -  Reputation: 100

Like
0Likes
Like

Posted 10 February 2011 - 04:51 PM

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.

Sponsor:

#2 EricTheRed   Members   -  Reputation: 146

Like
0Likes
Like

Posted 10 February 2011 - 05:27 PM

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.

#3 nobodynews   Crossbones+   -  Reputation: 2103

Like
1Likes
Like

Posted 10 February 2011 - 05:58 PM

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!


#4 alexfradiani   Members   -  Reputation: 100

Like
0Likes
Like

Posted 11 February 2011 - 10:14 AM

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.







Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS