Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Side scrolling - vertical scrolling

Author
Message
kkun
13
Years of Service
User Offline
Joined: 10th Jun 2009
Location:
Posted: 9th Mar 2010 16:53
Hi all,
I was wondering, how you would implement a scrolling type game, eg Doodle Jump on the iphone.

How would you go about making it scroll as you progress? Would this also work in 3d or will need to be done another way?
Krilik
16
Years of Service
User Offline
Joined: 16th Mar 2006
Location: Arizona, USA
Posted: 10th Mar 2010 02:49
You would want to apply scrolling values to all the objects on the screen when the player moves closer to the edge of the screen.

Some pseudo code as an example to show you how to scroll a background when you walk left and right.



This will check to see if the player's position is greater than 600, if it is then the X background scroll will increase, if the player's position is less than 200 then the X background scroll will decrease, otherwise the player's position will change.

You would then subtract the backgroundX scroll value to all the objects/enemies in your level when you draw them.

Login to post a reply

Server time is: 2023-01-27 00:42:13
Your offset time is: 2023-01-27 00:42:13