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.

Newcomers DBPro Corner / How do I scroll the screen in 2D?

Author
Message
Programmer2000
14
Years of Service
User Offline
Joined: 19th May 2010
Playing:
Posted: 19th May 2010 09:19 Edited at: 21st May 2010 00:53
I know how to scroll the background, but I just need some code for scrolling the screen, such as in classic platform sidescrollers.

Any help would be appreciated. Thanks in advance!
Programmer2000
14
Years of Service
User Offline
Joined: 19th May 2010
Playing:
Posted: 23rd May 2010 08:18
I just need code, if anyone would like to help me.
owlman
15
Years of Service
User Offline
Joined: 8th Apr 2009
Location: Italy
Posted: 23rd May 2010 21:52
hi Prog, I'd like to try to help you but I'm not sure of your definition of scroll the screen as opposed to scroll the background .. can you explain? also, have you looked on the code snippets thread? .. just an idea ..

if effort>reward : gosub home : endif
luskos
17
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 24th May 2010 00:02
I think the effect you are looking for can be achieved by not only scrolling the background, but shift everything in screen in the desired direction.Just do the same you do for the background.

Where there is a will, there is a way.
I often edit my posts, that`s who i am
owlman
15
Years of Service
User Offline
Joined: 8th Apr 2009
Location: Italy
Posted: 24th May 2010 01:32 Edited at: 24th May 2010 01:52
something like ...



if effort>reward : gosub home : endif
Programmer2000
14
Years of Service
User Offline
Joined: 19th May 2010
Playing:
Posted: 24th May 2010 03:07 Edited at: 24th May 2010 17:44
Well, to explain, I was looking for a way to scroll the 2D screen with set sprite positions like 1200,400 (X,Y) for a platform off-screen to the right and slightly above ground.

Thanks for the code, owlman, but I see some 3D code in there, and I don't think objects would work too well in a 2D environment like I wanted.

And no, I haven't looked in the code snippets section and I probably should.
owlman
15
Years of Service
User Offline
Joined: 8th Apr 2009
Location: Italy
Posted: 24th May 2010 18:29
good luck Prog .. hope you find what you are looking for ..

if effort>reward : gosub home : endif
Programmer2000
14
Years of Service
User Offline
Joined: 19th May 2010
Playing:
Posted: 26th May 2010 08:03
I did, thank you owlman! Here's the Code Snippet I found:

8-way 2D scrolling: http://forum.thegamecreators.com/?m=forum_view&t=3734&b=6
luskos
17
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 26th May 2010 10:10
I wasn`t sure what you wanted to do, but anyway the snippet is perfect, i couldn`t do it better.Good job finding it yourself!

And good luck with the game!

Where there is a will, there is a way.
I often edit my posts, that`s who i am

Login to post a reply

Server time is: 2024-11-24 16:04:36
Your offset time is: 2024-11-24 16:04:36