Launching an object in gamesalad
Hello everyone,
I was messing around with the launch rule i saw on youtube on a tutorial i mean the one where you have to create 2 real atributes for the actor Touch X and Touch Y.
When i use this rule, the actors move great, but it rotates randomly as i move it in different directions. I was wondering if there's a way to make the actor rotate in the sense of the movement.
So if my actor is a boy, i would like that when i move it to the left he rotates with the head to the left and when i move it to the right he will rotate with his head to the right.
Any clues?
I was messing around with the launch rule i saw on youtube on a tutorial i mean the one where you have to create 2 real atributes for the actor Touch X and Touch Y.
When i use this rule, the actors move great, but it rotates randomly as i move it in different directions. I was wondering if there's a way to make the actor rotate in the sense of the movement.
So if my actor is a boy, i would like that when i move it to the left he rotates with the head to the left and when i move it to the right he will rotate with his head to the right.
Any clues?
Comments
Then You may need to adjust the image itself and also add in a rule to flip the image.
Darren.
DeepBlueApps over 10 million hits and home of:
GS Tools
Templates
Video Tutorials
Forum
3rd party marketplace
I would like that the actor upper side rotates in the direction of the movement. So if drag my actor to the north i have a rotation angle of 90° if i drag my actor to the south i have the upper side of my actor facing down with an angle of 270°, if i move the actor to the left i have the image with the upper side facing the left side with an angle of 180° and so on.
If so, that is a totally different story. To do that you need to create some self attributes: self.X1, self.Y1, self.X2, and self.Y2
Then you need to do this:
Timer Every 0 seconds
-----change attribute X2 to X1
-----change attribute Y2 to Y1
-----change attribute X1 to self.positionX
-----change attribute Y1 to self.positionY
constrain self.rotation to vectorToAngle( self.X1r - self.X2r , self.Y1r - self.Y2r )
(this constrain is NOT in the timer)
Just so you know, this will not be a perfectly smooth constrain. The better the device, the better it will look.