"Else" forgets picking and fires at strange times [SOLVED?]

This forum is currently in read-only mode.
From the Asset Store
Strange factory themed set of tiles for your platformer game
  • Hi!

    So yeah, I have this puzzle thing where you place irregular pieces and they snap to their destination. It's all good there.

    When a piece doesn't snap in place, I want it to snap back to it's source position. I am using "Dragdrop" behavior, so I had an "On Drop" event that checks if placement is proper.

    I placed an "Else" event after it, but one can't use "Else" after events in Construct. So I just put everything inside a sub-event of the "On Drop" event that picks the proper puzzle piece. Now I can use "Else" against the other conditions (distance to proper destination, etc).

    Turns out that when that "Else" event fires, it doesn't remember the piece picked with the "On Drop" event, and after it has fired once it will also fire every time, even if the conditions do not match.

    O.o what gives? I already went around "Else" in another game, is it completely broken now?

    http://www.udec.cl/~jfuente_alba/regiontest.cap

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I prefer else forgetting the selected objects - if it didn't work that way, there's some stuff that I don't know how it would be possible to do. Else events run if the event preceding it does not run - so if you want it to run only once, a trigger once condition after the else should work. (I haven't checked the .cap)

    Example:

    value = 1

    • action 1

    else

    • action 2

    So if value does not equal 1, else will repeatedly fire until it does. IIRC, else events don't work properly if there's a subevent between them, like this:

    value = 1

    • action 1

    subevent conditions

    subevent actions

    else

    • action 2

    I don't know if that's been fixed or not, but it sounds like it hasn't.

  • What I have in the .cap I posted is something like this

    event OnDrop A

    +condition

    • action 1

    +else

    • action 2

    What's happening is that action 2 happens OnDrop EVEN IF CONDITION IS TRUE. Which doesn't make any sense.

    I do have a subevent between them. Urgh. I'll try reversing the condition, as the "else" doesn't have any subevents.

    Edit: Can't really reverse the condition, as it involves picking =( Please look at the posted .cap!

    Edit2: Tried using function object to avoid having a subevent between condition and else and it does exactly the same =(

  • Else does not remember picked objects properly, and due to the architecture of the event engine, it probably can't be fixed until Construct 2. To be honest, if you need Else to pick properly, don't use it (just invert conditions).

  • If you do invert conditions as an alternative, remember that changes in the preceding event with non-inverted condition CAN influence the one after it.

    If you want to do switching, you may have to be creative...

  • Added a global variable and set it to 0 just before, then set it to 1 if the condition was true, then instead of else, I check the variable.

    Which is sort of what I expected Else to do. Can't it be done in such a fashion within Construct?

    I mean, it was misfiring AND forgetting picking from a PARENT event.... I've never been able to use it, as whenever I need it, it just bugs out.

    Anyway, FIXED, sorta.

  • Ah, such a simple solution! I haven't really thought of that.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)