Why does this function not work properly? :(-

0 favourites
  • 8 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Hi.

    This issue is not a big deal, but I'd really like to know where does it come from to prevent further errors.

    Here is the function :

    I remove the system wait (if the value is equal to 0) a part of the code doesn't seems to work (blue frame), and only if the global variable epoch initial value is set to 0 (then it is set to 1 at the beginning of the function).

    The red framed blocks on the screenshot below are hidden only if I put a value > 0 in my "system wait".

    Any idea? :/

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Maybe the following post and response from Ashley may answer this. It appears to be a similar issue.

    https://www.scirra.com/forum/r138-2-function-wait-and-use-instance-variable_p689459?#p689459

  • I'll read that , thanks!

  • Be wary of the "else" condition, it resets any picking done in the previous condition. Also, if any picking is done on line 25, the "else" at 26 will never fire. The same also applies for lines 27-28. It might not be the behavior you expected.

    En bref, fais attention à toute utilisation de la condition "else" ! Parfois il vaut mieux créer une condition inverse que d'utiliser un "else" !

  • Hi again.

    zenox98 > This is not the same issue. I'm not using any function parameter after my system wait. The thing is my issue occurs when I'm wait 0 second (or don't wait at all) but not when I'm waiting. I've tried to wait 0.000001 seconds. It seems to work because the change is too fast for the computer to show it, but it still doesn't work if I wait 0 second.

    I'm still stuck on this.

    Magistross > I'm aware of that.

  • Hi,

    I've figured out where is the problem after I made a light version of my project (see attached file) : There is a problem in my events order.

    The order should be :

    event 4 (function setRestrictions)

    event 9 (only when event 4 is finished)

    event 10 (only when event 9 is finished)

    Question is : how do I know when a function has ended?

    Should I use a return value? How can I compare this return value to execute another function?

    Or if you have another idea...

  • It's not clear what you want, but this gets things in order. It may help, even if it's not what you want.

  • I made other tests and I'm not where does the issue come from. My issue is kind of hard to explain, and even more as I'm not fluent in english. Thank you very much for your help, I give up this time...

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