Little help for a newb please

I have a actor(Person) that accelerates when colliding with another actor(Tunnel). I would like to make a On/Off switch to turn off the acceleration of the person. So basically have it when the button is green or on the person will accelerate when colliding with the tunnel. And not accelerate when the button is red or off. I will be having multiple tunnels and buttons so i also need a way to tell which button to turn off what like button1 - tunnel1 button2 - tunnel2. Like a Light Switch. I hope i explained it good enough. Also very new to gamesalad so if you could break it down really simple that would be great. Thanks.
Best Answer
-
tatiang Posts: 11,949
The way you communicate between actors in GameSalad is with game-level attributes. You can make a boolean attribute called game.Button1 and set it to false (unchecked). Then, in your button1 actor, have a rule that says When touch is pressed change attribute game.button1 to true. In your person actor, have a rule that says When attribute game.button1 is true [stop] Otherwise [accelerate]. You can do the same thing in the tunnel1 actor. Instead of stopping/accelerating, you could destroy the tunnel actor, have it disappear (self.color.alpha=0) or just disable its rules by wrapping them inside of the rule that checks to see if game.button1 is true.New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Answers