Game Development Community

Help with camera moving and Position

by Randell Heft · in Torque Game Builder · 07/20/2009 (7:35 pm) · 1 replies

So i have a scene with background, and a player set up as a 2D side scroller. I currently have the camera mounted to the player which allows the camera to follow the player but i think the player is really staying in place and the background is what is moving.
This is causing the player and background to start dead center and a large black spot to the left and below where the background image doesnt exist.
When i unmount the camera from the player, the background fills the full screen like normal but the player can now walk out of the cameras field of view.

What is the code that would allow the camera to follow the player but not be centered directing on the player so the image fills the full screen?

here is the default code I am useing

SceneLoader.Load(@"datalevelslevelData.txscene");

T2DSceneObject _camera = TorqueObjectDatabase.Instance.FindObject<T2DSceneCamera>("Camera");
T2DAnimatedSprite _player = TorqueObjectDatabase.Instance.FindObject<T2DAnimatedSprite>("Player");



_camera.Mount(_player, "", true);

About the author

Recent Threads


#1
07/20/2009 (10:07 pm)
the "setViewLimitOn(X1, Y1, X2, Y2)" command lets you specify what are the limits of the camera... dont really know if its what you're looking for, but there it is anyway.