So I'd like to know how to make a button puzzle. for example, you'd have to push certain amount of buttons in a certain order in order for a door to open. How can this be accomplished?
As an example, have an 'Unlocked' variable set to 0, where upon being set to 4 it opens the door. When each button is correctly clicked in a sequence add 1 to 'Unlocked' for each button pressed so that when 4 buttons are pressed in sequence the door will open. If they do not click the correct button in a sequence reset 'Unlocked' to 0 etc.
I might need another, detailed example. didn't understand that one you gave me.
Develop games in your browser. Powerful, performant & highly capable.
Maybe this Pincode example can help you.
It won't let me open that one. I have version 139 and that one was saved using a newer version. I can't find newer versions on here though,it only has 139.
It was made with The latest beta release.
Just opened it. the events seem a little too complicated for me to comprehend, i don't understand it at all, lol. Sorry.
give each button their own unique value stored in the objects instance variable.
buttonA value 1, buttonB value 2 etc.
Then each time a button is pressed add this value to a global text variable.
So it would look like "1,2,1,1," etc depending on the order of clicks.
Have another global text variable with the correct code stored in it to unlock door, then compare the stored text to the code after each click.
If they match the order was correct so open door. If the the number of tokens in the stored text (separated by the comma) is equal or greater then the code text but they dont match then the order was incorrect.
Heres a really quick example.
I didn't use families for the button as you have the free version.
The code might look a little hard to understand.
What I'm doing is checking the instance variables given to the text object with text.text (which is the text displayed in the textobject)
To set the text I use AnimationFrame because these frames are the same as the numbers displayed, but you could change that to an instance variable if that suits your need better.
The back button was there from an older version and isn't really needed. It removes 1 character from the length of the text and is instructed to do so from the left.
use the limit variable to set the length of the code desired
use the code variable to change the code.
the charactercount variable is used to see how many numbers have been pushed, this could be used for display-purposes.