Preventing commands from "stacking" on top of eachother in CoBlocks

I’ve built a small bit of functionality that allows students to click an object, and that triggers a different object to rotate. However if the button is clicked again before the rotation is finished, the rotations will “stack” on top of each other and cause the rotating object to be totally skewed. How can I prevent this?

The two positions I want are below:
Up

Down

The little bit of code that controls this functionality is here:

You can see the CoSpace and remix it here:

Thank you for any help with this.

Cheers,

1 Like

Hi @s.vidler,

What a nice trigonometry space you created!
You can add a variable to control if the animation is playing. I set it to false on the beginning of your hint and set it to true when the hint done playing.
Also, if you do not want to return the shadowed lid to original position, you can create a copy of it.

I updated the space with this changes. Feel free to remix and investigate the code

Hey Nikolay,

Thanks for helping out with this. Don’t know why I didn’t consider using another variable to detect if it was playing or not. I appreciate your help and have incorporated it into the final product.

Cheers,