How to create the coding of closing and opening a door on repeat?

How to create the coding of closing and opening a door on repeat?

Hi! I would like to ask how do we code a door “open when click and close when click” and the same time this function is repeated endlessly. I’ve been trying using the “forever” block. It seems to me it won’t work no matter how I arrange it.

Thanks in advance!

1 Like

Hi @altheanedwin,

the easiest way is to create a variable that contains information if the door is opened and on click play proper animation and change a state:

I created an example for you. Feel free to remix and explore it

1 Like