Game Development Community

Help me ! (camera problem)

by Alexandre Fredenucci · in Torque X 2D · 04/21/2009 (3:43 pm) · 3 replies

Hi all !
I have a little problem of camera with the platform kit for xna, i have replace the player example by my player sprite (who's little more tall) I can not refocus the camera in my player, i try with Camera tool in torque x builder but it doesn't work :/ what line of code i must change in xna ? (sorry for my bad english ! i hope it's understandable ^^;)

my problem :

img406.imageshack.us/img406/4166/cameraproblem.jpg

#1
04/26/2009 (9:09 pm)
The camera should automatically track your player's position as long as the player has the PlayerDragonActorComponent attached to it. Did you completely replace the player object with your own player, or did you only replace the graphics? If you completely replaced the player object, make sure that you re-attach the components that were originally attached to the dragon player object.

John K.
www.envygames.com
#2
04/27/2009 (6:36 am)
It sounds like the problem is the size of the new player character rather than mounting the camera to the player.

If you are using the platformer demo then you will find a method called _mountCamera() in the file PlayerDragonActorComponent.cs

Look for this line: camera.Mount(_actor, String.Empty, new Vector2(0, -1), 0.0f, true);


The Vector2 is the amount to offset the camera from the player character it is following. You can change this so that your taller character will fit on the screen.
#3
04/27/2009 (1:59 pm)
Thanks for your answers !!

Duncan it works thanks! :)