How do I properly make subevent conditions work?

0 favourites
  • 7 posts
From the Asset Store
_______ Huge collection of metal fixtures ________
  • When activating a function, I have an event that is only supposed to occur if a variable is not equal to 0. The event always happens, regardless of variable state. Please help?

  • Are you 100% sure this number will eventually reach 0 ? If you are checking a speed, opacity or something like that, it may avoid this value so you have to be less precise.

    For example if round(variable) = 0, or if variable < 1, stuff like that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Pretty sure, yeah. Attached is a .capx demoing my problem.

  • Essentially I set up the capx like this:

    On Space Bar Released & Variable = 0:

    Make sprite more thin.

    Variable = 1

    On Space Bar Released & Variable =1:

    Make sprite less thin.

    Variable = 0.

    If you disable either, the other works. If you leave them both, they both occur, despite logic gating the variable.

  • WHOOPS. Okay I figured it out. By adding a "Wait 0.1 seconds" event in, it did not trigger the next event on the same tic. Okay, thanks guys! Y'all are awesome.

  • If you have to use a wait action to make it work, then your events are not set the way they should.

    Construct read events once/tick and from top to bottom.

    Basically, it executes your two conditions "on space released" at the same tick and this is why it doesn't work. Your two "on space released" conditions are both verified and executed.

    So I suggest you to consider making something like this :

    [attachment=0:2f3fe7ub][/attachment:2f3fe7ub]

  • Huh. Thanks! That's a much more efficient way of performing that. Thank you!

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