branching without selection

This forum is currently in read-only mode.
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • Greetings.

    Now I found the following seemingly simple branch case:

    <img src="">

    Event 23 should set an angle randomly to 0 or 90,

    then Event 24 should execute only when angle == 0.

    But Event 24 always executes!!

    Where is the trouble, random worked in an other case already.

    The IF selection is wrong?

    Thanx for watching.

  • Fifty fifty chance... so it just might seem to always end up 90.

    Actually I would assume this is an issue with ticks, since the angle of the object is already 90 at the beginning of the event.

    Try a function

    -call function ("onetick")after delay 23ms

    -on function "onetick"

    --enemybox angle =0... do this

  • that "angle" is already in the condition is not the reason for failure, I used it already sooner.

    Maybe there is a workaround with functions for this, but I would rather understand the true reason, to see inside more deeply.

  • Without seeing everything it's hard to tell if it'd make a difference, but have you tried placing a "Trigger once while true" condition on event 23?

    The way it is now makes event 23 calculate on every tick, so if you're running the fps at standard rate you'll have around 50-60 ticks, give or take, each second. Since the chance of getting either 0 or 90 is 50% you'll have around 30 instances of the event generating the number 0 and the other 30 generating 90 (assuming of course that your framerate is always at a constant 60, which isn't really the point. But whatever =P )

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanx Mr. inkBot,

    that was the solution. thanx for thorough explanation, too.

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