Make button that turn light on and off?

Hi im a beginner at this and im trying to make a button that turns a light on when clicked, then off when clicked again. However, i just get it to turn on, then nothing happens with clicking again..

The 2 rules for the button-actor is:
if attribute game.button = 0 and touch is pressed, change attribute game.button to 1

if attribute game.button = 1 and touch is pressed, change attribute game.button to 0

the 2 rules for the light-actor:
if attribute game.button = 1 change image to light_on

if attribute game.button = 0 change image to light_off

Any ideas what im doing wrong?

Comments

Sign In or Register to comment.