Button combination puzzle OR If-Then-Else logic
See "Nemesis Factor" by me to view what I have so far.
Trying to make a puzzle game that will require me to detect button combinations to be in the correct order. I know each level will require it's own unique logic, but many levels will be similar logic wise (with the difference being what clues are given to the player).
I know how to do this using actual code; I know how to do this using something like Blockly coding. But the logic required using Dreams seems necessarily complicated. Am I missing an easier way to do this, or is this simply a "limitation" of Dreams' way of handling logic?
E.G. the first level (SPOILER ALERT if you want to figure out the level on your own, play first then come here):
Requires the user to push L2, L1, R1, R2, touch button in that order. Pushing any other button resets the puzzle, requiring the player to start at L2.
Now, I realize some of the logic I have is required due to funky-ness of the timing/physical-ness of signals, or the analog nature of the L2/R2 buttons. And, I might be able clean up some wires by having a "restart" circuit (instead of each step doing the job of resetting the level). But I have a hard time believing something better isn't built into the game.
Is there a reason Mm hasn't come up with an ITTT gadget?
-
If-then-else is pretty simple using a selector: https://youtu.be/IdyN6JhEtDc
But sounds like you want something more like a state machine that keeps track of how far you've gotten, can be reset, etc. There are a couple of implementations I've made, but they're pretty complex. Totally doable though; you just need to think creatively about how you go about it from the start. You can check out my released version here, but fair warning, it's a lot. https://indreams.me/element/oBWiuWdEDMv -
I haven't checked out your dream yet, but yeah, a state machine of state machines is what I'm looking for. I got the logic and was successful at creating the level; I used Selectors in my implementation but because the wiring just got so stupid, I'm mostly wondering if there's something I'm missing, or a better way to go about doing this.
-
I use selectors all the time for anything stateful really--modes of behaviour, etc.
Yeah it can get out of hand pretty quickly. My "cheat code" example does things a different way so the complexity doesn't increase with the number of buttons in the code.
The basic idea is to assign each button an "encoded" value. 1 for X, 2 for square, etc. Then each time a button is pressed, its encoded value is added to the total. That total is compared to what the total *should* be at that stage of the inputs. If it's wrong, everything is reset. If it's right, a selector moves on and the next required total becomes active.
Accedi per aggiungere un commento.