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 / camera help

Author
Message
Xoddam
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location:
Posted: 10th Mar 2009 03:33
can anyone tell me how to make the camera follow a sprite? i am not exactly sure how to get this to work.
AlexZinn
15
Years of Service
User Offline
Joined: 17th Feb 2009
Location:
Posted: 10th Mar 2009 09:23
it can be something like this

dbPositionCamera( dbSpriteX(2),dbSpriteY(2),0);

If someone need something, add me to your msn
Was SuperKid , now AlexZinn
Sharp Bullet
16
Years of Service
User Offline
Joined: 5th Feb 2008
Location: Pluto
Posted: 10th Mar 2009 20:51
In 3d space? i'm not sure! maybe in 2d.

Sprites are something that you can see on the screen (like HUDs) and does not have any connection with the 3d

First say to yourself what you would be; and then do what you have to do.
silenus
15
Years of Service
User Offline
Joined: 4th Mar 2009
Location:
Posted: 11th Mar 2009 01:02
in 3d-Space you can use:
Quote: "
dbSetCameraToFollow
This command automatically controls the camera to provide a tracking system. By providing the 3D world coordinate of the entity you wish to track, and some camera data, your camera will automatically update its current position each time this command is called. The X, Y, Z and Angle values provide the coordinate to track. The Distance value specifies the required distance between the coordinate and the camera. The Height value specifies the required height of the camera in 3D space. The Smooth value specifies the level of smoothing required for the camera, where a value of 1.0 is no smoothing and a value of 100.0 is lots of smoothing. The Collision value is a special flag that allows the camera to detect whether it is hitting any of the static collision boxes and if set to one will automatically adjust so as not to enter these collidable areas.

Syntax
void dbSetCameraToFollow ( float fX, float fY, float fZ, float fAngle, float fDistance, float fHeight, float fSmooth, int iCollision )
void dbSetCameraToFollow ( int iCamera, float fX, float fY, float fZ, float fAngle, float fDistance, float fHeight, float fSmooth, int iCollision )"
Lion Jin
18
Years of Service
User Offline
Joined: 24th Sep 2006
Location:
Posted: 11th Mar 2009 04:00
Just can create a "visaul camera", give it some position data ,such as "camerax ,cameray". when you want camera move to a position ,for example ,change camerax to -2 ,and then add +2 to each sprite x position. In fact ,no camera ,you just move all the sprites offset the screen in the reverse direction.If you want to follow one sprite ,you just follow camerax and cameray to that sprite position ,all the sprites on screen will offset its position.the sprite you followed just might be always on the screen center.
Lion Jin
18
Years of Service
User Offline
Joined: 24th Sep 2006
Location:
Posted: 11th Mar 2009 04:04
The sprite you followed ,if its position is x=12,y=5 ,and then your camera x will be -12 and y will be -5, then ,add this value to each sprite position .

Hope this help.
Xoddam
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location:
Posted: 26th Mar 2009 01:34
Thank you all. after reading all of your posts i now better understand it and i made it work. thanks again!

Login to post a reply

Server time is: 2024-11-25 17:57:48
Your offset time is: 2024-11-25 17:57:48