Changing direction on touch
AngryBoi
Member Posts: 586
Okay, so I have an actor that is moving in a random direction to start out. How would I make it so when I press on the actor, It starts going the opposite direction?
Comments
When touch is pressed change the velocity of the actor to a negative number (or simply multiply the current speed by -1)
To clarify
If: Touch is pressed.
Do: Change attribute: Self.Motion.Linier Velocity.X(or Y) To: (Self.Motion.Linier Velocity.X-(Self.Motion.Linier Velocity.X*2))
**Nate - Pixel Artist - Developer - Graphics Designer **
the formula us basically multiplying itself times 2 because itself times 2 Minus Itself = The Oposite.
**Nate - Pixel Artist - Developer - Graphics Designer **
I don't think i explained well enough. With the way you guys explained, you are using linear velocitys x and y. I am just using "move." If I use the velocitys, how do i go in a random direction?
When touch is pressed change the velocity of the actor to a negative number (or simply multiply the current speed by -1)
How do I go diagonally?
Or how do I change it to go in a random direction, but with always having the same speed?
In the Move behaviour change the direction setting to a diagonal direction (45°, 135° etc)
In the Move behaviour change the direction to a random angle.
@Socks Yeah but now I already have change velocity happening. The move behavior doesn't work with this already happening.
Sorry, I don't know what any of that means.