Beginner questions, camera control and more.
by Syruhaus · in Torque Game Builder · 08/09/2007 (4:13 am) · 2 replies
Hi,
I've had this top down shooter in my head for a while and am testing it out in TGB.
I have a few questions.
1. I want the camera to follow and rotate with my player. Player is centered on screen, environment (tilemap) is in motion. Do I do this as a behavior on the player sprite or higher up in the game loop? What are the basic functions to move the camera?
2. I've read the net functions in TGB are limited. In what way? Could I have another player join over the network and shoot at him?
I had some more questions in my head yesterday but I forgot :) Will post here as I recall them.
I've had this top down shooter in my head for a while and am testing it out in TGB.
I have a few questions.
1. I want the camera to follow and rotate with my player. Player is centered on screen, environment (tilemap) is in motion. Do I do this as a behavior on the player sprite or higher up in the game loop? What are the basic functions to move the camera?
2. I've read the net functions in TGB are limited. In what way? Could I have another player join over the network and shoot at him?
I had some more questions in my head yesterday but I forgot :) Will post here as I recall them.
#2
If you want the camera to follow the player, you can just mount it to the player. Either use the Camera Mount Behavior available in the TDN or just use the mount function, for example:
I think there is a mounting issue in the current version of TGB that makes it a bit choppy--this should be fixed soon :)
Did a quick search of the forums, looks like camera rotation isn't a built in feature. However, there is a solution (don't know if it works) in this thread:
www.garagegames.com/mg/forums/result.thread.php?qt=29015
08/09/2007 (1:49 pm)
The only problem is that you'd have to continue to set the camera to the player's location, which might decrease performance.If you want the camera to follow the player, you can just mount it to the player. Either use the Camera Mount Behavior available in the TDN or just use the mount function, for example:
sceneWindow2D.mount(%object, %xMount, %yMount, %mountForce, true)
I think there is a mounting issue in the current version of TGB that makes it a bit choppy--this should be fixed soon :)
Did a quick search of the forums, looks like camera rotation isn't a built in feature. However, there is a solution (don't know if it works) in this thread:
www.garagegames.com/mg/forums/result.thread.php?qt=29015
Syruhaus
sceneWindow2D.setTargetCameraPosition(%this.owner.Position.X, %this.owner.Position.Y);
sceneWindow2D.startCameraMove(0);
Anything wrong with that? Still haven't found out how to rotate the camera.