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! / Border Help

Author
Message
zDough BoyZ
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 31st May 2007 02:13
I am making a very very basic 2d over head shooter. I was wonder what the code is to create a border around the screen so my charecter cant move off screen.

The Internet Is TUBES
Hummanoid Typhoon
19
Years of Service
User Offline
Joined: 4th Aug 2005
Location: Middle of nowhere
Posted: 12th Jun 2007 14:28 Edited at: 12th Jun 2007 15:30
you will have to prevent his x and y cordinates going past a certian point.

The easiest method of doing this would be to limit the x and y position for your player. insert this code somewhere.




For a larger level bigger than the screen you scroll the background instead of moving your player. This code will be useless for a game but hopefully demonstrates my point.

You will need a map/tile system to get any form of game working. It will handle collisions and scroll the tiles and colission objects as the player moves. Remember the map scrolls past the player not the other way round.



Login to post a reply

Server time is: 2025-05-14 21:14:17
Your offset time is: 2025-05-14 21:14:17