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.

Dark GDK / need some help with, Dark GDK , 2d Camera

Author
Message
Binario
14
Years of Service
User Offline
Joined: 19th Jan 2010
Location: @ front of PC
Posted: 31st Jan 2010 01:04
hi all, ive been searching around for some info on how to make screen camera on a 2d game, move with the main sprite, i know there are lots of posts around, but i havenot found one that could help me, i wanting to know , if the dbMakeCamera, works for 2d, if not how can i make the screen follow my sprite around, not like Zelda type of cam ,but some like Breath of Fire, giving the feel that the world moves, i dont have any code to post right now, cause i dont have any clue on how to do this , help is appreciated, thnks to whom may reply
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 31st Jan 2010 10:49 Edited at: 31st Jan 2010 10:55
Cameras do not work with sprites, since the sprites are displayed by screen coordinates, not with the camera view which is 3D.

The way to follow the main sprite is this: instead of moving your main sprite when the user presses a key, move the whole world around it. It may sound mind-boggling but it's not that difficult actually. It does need a bit of planning, since you need to calculate the screen coordinates of each and every sprite that builds your world. If the world is large, then you may even consider re-using sprites to avoid slowing down the program.

For a practical example, please have a look at the little 2D side-scroller program that I posted in the Dark GDK coding challenges thread:

http://forum.thegamecreators.com/?m=forum_view&b=22&t=150933&p=2

Look at my post from 10th Oct 2009 12:06 and its code attachment. It demonstrates screen scrolling (even handling the special cases so that the player can go to the edge of the world on the first and last screens), re-using sprites, and background texture scrolling.

EDIT: It's possible to implement side-scroller games in 3D as well, so that they look like 2D but they are actually 3D. In that case, cameras will work. It's up to you which solution you choose.

Login to post a reply

Server time is: 2024-10-01 23:36:27
Your offset time is: 2024-10-01 23:36:27