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! / 2d platformer advice

Author
Message
Tattered brush
15
Years of Service
User Offline
Joined: 1st Dec 2008
Location:
Posted: 2nd Dec 2008 09:47
Hi Guys

I'm quite new to programming and also darkBASIC. I am looking to make a 2D platformer like 3 Weeks in Paradise, Batman, Robocop etc. I was just wondering how you would make the background change to the next image when a character moves off screen. I don't want the background to scroll basically.
I also have the 2D plugin kit, does anyone know of any tutorials available that uses this plugin?
Any help or advice would be greatfully appreciated, thanks.
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 7th Dec 2008 02:23 Edited at: 7th Dec 2008 02:24
Basically, you want to check if the character is off the screen like so:



Once you know that it's off the screen you can change the background accordingly by changing the background sprite's image. However you also need to know if it's above the screen, below it, to the right of it or to the left of it, so here's what we'd do:



That should do it.

Tattered brush
15
Years of Service
User Offline
Joined: 1st Dec 2008
Location:
Posted: 7th Dec 2008 16:09
Thanks for your help on that one, that's a great help.
Am not sure whether to have whole images for the background or to make the background from a series of tiles, how would I implement a tile based background with this code?

Login to post a reply

Server time is: 2024-05-03 04:22:15
Your offset time is: 2024-05-03 04:22:15