So I need help on making an overlay that if clicked once it activates one barrier(Lets call this barrier B1) , but if it is clicked twice it activates a second barrier (Lets call this barrier B2) and deactivates B1. But if the overlay is pressed again it activates B1 and deactivates B2. If the overlay is pressed again it activates B2 and deactivates B1. And the so one and so on.
This is probably very confusing so if something doesn’t make sense please tell me.
heres a bad example of what I mean , That I made on scratch.
I know this is possible with block code .but I don’t know how to make it.
The reason the property is called “red barrier” is because i colored one red, you can change it to B1, also make sure either B1 or B2 is not active on game start (If it’s B1, then change the setting in the property to “false”)
You could update a counter whenever you click the overlay, and save the value to a property. Then in the code of the overlay write an if state-ment seeing if the number is even or odd. If it’s odd, activate the first button, if even, activate the second one. I guess to make sure, also broadcast a deactivation channel for the opposing button, so only 1 button is active.
You could even use a checker instead of block code to check if it’s 1 then show barrier 1 and hide barrier 2 and if the check fails then show barrier 2 and hide barrier 1
Makes sense, you could add on to that for when the second one is correct (ie 2), we reset the counter, so when the click again, 1, it repeats. That’s a good idea.
You will need two [button] Overlays and two Barriers:
Settings:
Overlay 1: Transmit on X Channel when pressed, shown when receive on Y Channel, and hide when receive on X Channel, player-scoped.
Overlay 2: Transmit on Y Channel when pressed, shown when receive on X Channel, and hide when receive on Y Channel, player-scoped, not activated when game start[1]
Barrier 1: Player-scoped, not activate when game start, activate when receive on X Channel, deactivate when receive on X Channel.
Barrier 2: Player-scoped, not activate when game start, activate when receive on Y Channel, deactivate when receive on X Channel.
Although you can do it with property+blockcode or checker system, this should be the simplest way possible.
very good point although I think having one button and doing a check might be easier to keep track of and see what’s happening easier (it’s all personal preference though)
2 overlays use 350 memory while a overlay, checker, property, and counter use 245 memory. If I’m wrong on that then it doesn’t make a huge difference because it’s such a small amount of memory.