The world moves not me
by Quest Johnny · in Torque Game Builder · 08/03/2006 (9:06 am) · 2 replies
I apologize if this is a noob question, I'm only on 'Whack a Mole' so far...
The game I'd like to make with Torque2D is a game where your ship sits in the center of the screen and everything else, stars, planets, bad guys, etc, move relative to you when you turn and thrust in a given direction (eg. Asteroids.) I had made a similar game in Flash.
In Flash or if I was working in openGL, I wrote a render() function, which called render() for each of the objects in question and have them render themselves relative to the "actual" x,y of the player's ship then translate that to screen coordinates.
As the main "processTick()" isn't in the script, how would I do this in Torque2D? One reason I ask is because functions like "moveTo()" suggest that you may be way ahead of me, and there may be a very simple way to do it, though clearly it's not in the demos/tutorials so far.
The game I'd like to make with Torque2D is a game where your ship sits in the center of the screen and everything else, stars, planets, bad guys, etc, move relative to you when you turn and thrust in a given direction (eg. Asteroids.) I had made a similar game in Flash.
In Flash or if I was working in openGL, I wrote a render() function, which called render() for each of the objects in question and have them render themselves relative to the "actual" x,y of the player's ship then translate that to screen coordinates.
As the main "processTick()" isn't in the script, how would I do this in Torque2D? One reason I ask is because functions like "moveTo()" suggest that you may be way ahead of me, and there may be a very simple way to do it, though clearly it's not in the demos/tutorials so far.
About the author
#2
YAY for simple answers!
I'm certainly impressed with what I have seen so far.. just trying to learn right now.
08/05/2006 (10:42 pm)
OOOH thank you!!!! :) YAY for simple answers!
I'm certainly impressed with what I have seen so far.. just trying to learn right now.
Torque Owner Luke Larson
Luckily there is a simple solution to this. All you have to do is use the "mount" function to mount the camera to your ship and then you can move your ship around normally.
Remember, unlike Flash, this is a game engine and thus things like this are the main point of the engine. I'm sure that in the future you will find as I have many features in TGB that make things like this very easy.