One button 2 jobs
Hey Guys,
I think i have a fairly simple problem ( Well at least I thought so, but I am unable get it to work)
I am working on my runner game project. It is set up so right away the actor starts to run to the right I Also want the actor to switch directions when pressing a button. But with the same button, if the player presses it again he will switch back to going right....and if the player presses it again it will go back to the left.....
Here is how I have my button set up
Left
Actor receives event touch is pressed:
Change attribute game.switchdirections to 1
Right
Actor receives event touch is pressed:
Change attribute game.switchdirections to 0
how do I reset the button back to 0 once pressed the second time?
What is the best way to make this work....I understand why it is not working, but I can't figure out how to work around it.
Comments
Actually guys, It is working now.
If 'switchdirections' is an Interger/Real:
When touch is pressed:
__Change switchdirections to 1-switchdirections
. . . . . . . . . . .
If 'switchdirections' is a Boolean:
When touch is pressed:
__Change switchdirections to not(switchdirections)