Getting myself confused...
Iv been doing a bit of work on a new project, I have made a mistake and I know its really simple but Im struggling to solve it here is the current code for one of the actors:
Actor receives event touch is pressed....attribute game.walk/notwalk is false.
change attribute: game.walk/notwalk to true.
Attribute game.walk/notwalk is true
change attribute self.motion.linear to 100
Actor receives event touch is pressed....attribute game.walk/notwalk is true
change attribute game.walk/notwalk to false
attribute game.walk/notwalk is false
change self.motion.linear to 0.
Currently can't get this to work so when pressed it stops moving and pressed again starts moving.
Any help would be greatly appreciated.
Cheers.
Actor receives event touch is pressed....attribute game.walk/notwalk is false.
change attribute: game.walk/notwalk to true.
Attribute game.walk/notwalk is true
change attribute self.motion.linear to 100
Actor receives event touch is pressed....attribute game.walk/notwalk is true
change attribute game.walk/notwalk to false
attribute game.walk/notwalk is false
change self.motion.linear to 0.
Currently can't get this to work so when pressed it stops moving and pressed again starts moving.
Any help would be greatly appreciated.
Cheers.
Comments
In your actor make a rule:
When touch is pressed.... change attribute game.walk/notwalk to (game.walk/notwalk+1)%2
Make another rule in same actor:
When game.walk/notwalk = 1.... change attribute self.motion.linear velocity X to 100.
Then in otherwise section of same rule put:
change attribute self.motion.linear velocity X to 0.
Hope that helps