跳至主內容

搜尋

Button combination puzzle OR If-Then-Else logic

  • TAPgiles

    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

  • Shoopity

    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.

  • TAPgiles

    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.

登入寫評論。