Tank and Tank Turret Question.
CaptFinn
Member Posts: 1,828
I have 2 images. Tank Body and tank Turret. I want the tank to spawn off screen and travel along a x axis from -30 to 1100. The tank will drive str8 down that path. But the tank turret will always point and shoot at X=512 / Y=384. Since its 2 images spawning and traveling at same speed. But 1 turns. How do I go about that. Is there a video or tutorial?
Im pretty sure i got the tank body spawn and travel along x axis from left to right figured out. Its the Tank turret traveling down same x axis but staying targeted and firing on x512/y384
Im pretty sure i got the tank body spawn and travel along x axis from left to right figured out. Its the Tank turret traveling down same x axis but staying targeted and firing on x512/y384
Comments
Basically, the turret is bolted onto the tank actor with two constraints. The rotation of the turret is independent. With the "Rotate To" behavior, you can make the tank turret face where you want.
It has lots of text and pictures to explain how things like this work.
The turret actor's X & Y positions are constrained to the tank's X & Y position. So, the turret stays with the tank, but can rotate independently.
then in your tank you need 2 constrain attributes
Constrain Attribute game.tank.x to self.position.x
Constrain Attribute game.tank.y to self.position.y
Now in your turret actor you need these 3 constrains
Constrain Attribute self.position.x to game.tank.x
Constrain Attribute self.position.y to game.tank.y
Constrain Attribute self.rotation to vectortoangle(self.position.x-512,self.position.y-384)
You may need to add in an offset to your turret constrains to get it in the right place but those three behaviors should keep the turret stuck to the tank and rotated at your target.
Hope that helps you out.
Aaron
___________________________________________________________________________________
Project Help from Tenrdrmer Click Here
GS BubbleBall Template HERE!!
Stacks Level Selection Template HERE!!
Expanding Option Menu Template HERE!!
Tenrdrmer's Menu # 3 HERE!!
Menu #4 - Level Banners HERE!!
AppSolute Entertainment on Facebook
AppSolute Entertainment on iTunes
and the vector to didnt either
There is an easy way to change your mind, but it involves editing XML... something that the GameSalad Creator can get really fussy about. One mistake and your entire project can cease to function. So, to leave room for future expansion and ease of development, I usually use Real.
http://gamesalad.com/game/19826
___________________________________________________________________________________
Project Help from Tenrdrmer Click Here
GS BubbleBall Template HERE!!
Stacks Level Selection Template HERE!!
Expanding Option Menu Template HERE!!
Tenrdrmer's Menu # 3 HERE!!
Menu #4 - Level Banners HERE!!
AppSolute Entertainment on Facebook
AppSolute Entertainment on iTunes