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 / 2D Camera?

Author
Message
Mew151
16
Years of Service
User Offline
Joined: 1st Jun 2008
Location: Glitch city
Posted: 20th Oct 2009 02:44
Is there a camera in the 2D DBPro engine?

DBPro!
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 20th Oct 2009 10:30
No, but it is simple enough to write one yourself.
Basically, you make a moveCamera() function which moves all sprites and, if necessary, updates some global offset positions that you add to any other drawing commands (box, paste image, print, etc.).
To make it efficient, you should also only draw things that are indeed visible on your screen.

TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 31st Oct 2009 21:35 Edited at: 31st Oct 2009 21:35
A camera by convention is an aparatus used for displaying 3D scene on a 2D screen. In 2D, there is no need for a camera as there is no 3D to 2D transformation required.

Think of your screen (Bitmap 0) as being a window onto a much larger region. Placing things at X/Y positions within the boundaries of this window makes them visible. Placing things outside the boundaries (Eg: X=-100, Y=-100) places them off-screen.

You also have various scrolling techniques, so what you use depends on what sort of 2D game you have in mind.

TDK

Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 1st Nov 2009 20:12
If you want 2d camera rotation also then i could help you with that... but just side to side scrolling would be better.
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 2nd Nov 2009 00:31
Alternatively (and possibly a more easier option) would be to use an actual 3D camera, and use plains oriented towards the camera with your images textured onto them. This gives you access to all of DBP's more powerfull 3D commands, along with the addition of a depth factor for your images (so a layers system would be possible), shaders, lighting, and even the possibility of deforming the plains with the vertex commands.

Login to post a reply

Server time is: 2024-09-28 12:19:44
Your offset time is: 2024-09-28 12:19:44