Changing Direction By Tapping...
jacobalm
Member Posts: 2
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
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
@jacobalm - Here's another way to do it.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
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
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS