3 digit combination lock

Started by Ophidic, Sat 01/04/2023 20:36:42

Previous topic - Next topic

Ophidic

I'm starting to make some puzzles and I want to do a combo lock like this one.



Unfortunately I'm still new at this and I'm not sure what the best way to approach it would be, I was looking at making a gui, but 'm not sure it would be good to learn GUIs at the same time as trying to code a game mechanic.

Perhaps maybe I make a room with a close up graphic of the lock, and objects for the numbers that go up on left click and down on right click?

Either way, I'm not totally sure how I would go about starting that. I could define the code in the room script if I made a dedicated room for such a puzzle right? Haha it feels like the deep end every time I try a new thing.

newwaveburritos

Personally, I would make that a GUI so you can leave all your room conditions alone and you don't have to mess around with keeping those straight.  The GUI code will go into the global script then.

The general idea for a combination lock is that you save the number of each tumbler in a variable and then when you push the button you check those variables to see if they are correct.  Each tumbler would be a separate GUI button (which can also animate if you want, by the way) and the button on the right there in your example would also be a button that checks the variables.


Ophidic

Cool thanks for the suggestions, i gotta work up the nerve to attempt this, and I'll report back and when Ive got it working ill post the code to help future users.

SMF spam blocked by CleanTalk