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 / 2D Game RPG Camera follow problem.

Author
Message
UGoRyu
15
Years of Service
User Offline
Joined: 22nd Oct 2008
Location:
Posted: 23rd Oct 2008 05:49
I'm form Korea
my jaob student.
my problem, Cmera is not follow Character.

Help me plz

hakrimryu
Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 23rd Oct 2008 10:33
Your problem is that you are trying to mix sprites and cameras.

The sprites are drawn straight to the screen, not in the 3d world, so moving the camera doesn't affect them. If you want to use the camera commands, use textured 3d plains for sprites instead of normal sprites.

Otherwise, you can simulate a camera by subtracting and adding to the sprite's positions when they get near the edge of the screen.

AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 24th Oct 2008 00:41
Basically, to make a camera in 2D, store the camera's position in two variables:



...and then, when it comes to drawing your sprite, subtract the camera's position from the sprite's position before drawing. So, if your sprite is at ( 500, 500 ), but your camera is at ( 50, 100 ), then you'll draw your sprite at ( 450, 400 ).

<<---------CLICK IT

Login to post a reply

Server time is: 2024-09-30 09:21:21
Your offset time is: 2024-09-30 09:21:21