CoSpaces Edu :: Video Games, January 2022 Scene 2. A student asked me this, and I nor any other student can help fix it.
We are attempting to make a game where doors can be closed when pressing buttons. The green button opens the door and the red button closes the door. When the door is closed the power drains. The problem is that when the buttons are spammed the energy system stops working. We’ve tried to fix this by moving the buttons when they’re pressed and then moving them back when the other button is pressed (see cubefix in the code). For whatever reason, moving the buttons or changing their transparency breaks the rest of the code that has to do with the button like the door animations and energy system. We’ve also tried to create variables that don’t allow the player to click the button until the other button is pressed. This theoretically should’ve made it so that the player would be forced to alternate between clicking the green and red buttons but as long as you don’t move your cursor off of the button, you can keep spamming it, breaking the energy system.