Changing Direction By Tapping...
Hello everyone! I'm new to this, so forgive me if this isn't the right place for this...
Anywho, I need help. I am trying to make my character change it's direction every time you tap the screen. The character starts the game by automatically moving left, and if you tap the screen it moves right, and if you tap again it goes back to moving left. The character should never stop moving.
Any help is appreciated!
Comments
If any of the following condition is happening
touch is inside
touch is outside
do
change attribute self.motion.linearVelocity.x to -self.motion.linearVelocity.x
Set up a boolean at game level.
Add the following rule to the player actor:
When touches.touch 1.active is true
Change attribute game.Boolean to not(game.Boolean)
Then, also in the player actor, have another rule:
When game.Boolean is true
Your logic to move left
Otherwise
Your logic to move right
@jacobalm - Here's another way to do it.
Interesting. touches.touch1.active? must be a Mac thing.
I don't see an active attribute under touches.touch1, only x and y.
Exactly what I was looking to do. Many thanks!
@tintran