Archived

This topic is now archived and is closed to further replies.

Xorcist

Paralax Scrolling (Help Needed)

Recommended Posts

Xorcist    122
Does anyone here know of a decent way to implement Paralax Scrolling for PC games? I don''t mind if it is in DirectX, or using FastGraph, or even the Windows GDI. I just want to get the basic concepts down for true Paralax Scrolling (For UP, DOWN, LEFT, and RIGHT directionals). If anyone can help with either documentation or examples please post here or e-mail me. Specifically I''m looking to implement a four layer scheme, most likely with a resolution between 320x240 and 640x480. Thanks in advance. Xorcist@MyEZMail.com

Share this post


Link to post
Share on other sites
outRider    852
I''m not quite sure on what you need, but parallax scrolling is fairly simple.

First you establish the order in which your layers and objects are drawn. If you want your character to be on the foreground and everything else on the background then you draw your four layers, then you draw the objects on top of that. Now, the last layer you drew, which is the foreground layer where the character is standing, has to move at the same speed as your character, so if your character moves at 60 pixels per sec, then you scroll your top-most at 60 as well, then depending on the kind of depth you want to achieve, you scroll the layers underneith each slower than the last layer.

So lets say you had this...

Character speed - 60px/sec
Layer1 - 60px/sec
Layer2 - 45 (3/4 the speed of the top layer and character)
Layer3 - 30 (1/2)
Layer4 - 15 (1/4)

That might be unsuitable for what you want to achieve, so just vary the numbers. Now for the actual scrolling. If your character moves to the right x number of pixels, then you scroll your layers to the left x number of pixels, based on what you decided the speed of each layer was. If your character or camera or whatever moved up, then you''d scroll your layers down, etc.

If you had your first layer as a complete background, but had some of the other layers smaller, because there would never be an instance where it would be completely visible because it was being covered by a layer above it and you wanted to save resources, then that layer would need to be offset, and be large enough to cover the area that it would be displayed in. The offset would depend on whether you would be scrolling that layer at all times, or only when it would be displayed on the screen. All your layers, with the exception of the farthest one back, would have to have areas masked out so that the layer underneath could show through, but aside from that theres not much more to it, unless you''re building your layers out of tiles, in which case it''s not very hard to adapt to what I just said.

It''s as simple as that... but maybe this isn''t what you needed, but I couldn''t tell from your question so I thought I''d try anyway.

------------
- outRider -

Share this post


Link to post
Share on other sites
rds    122
If you are interested in using FastGraph check this link out http://www.makegames.com/sidescroller/. It''s an online copy of Diana''s book. The ideas in the book could be used with Direct X or whatever.

Share this post


Link to post
Share on other sites