Resolved - Bug? Weird behavior when using OR blocks and setting sprite animation

0 favourites
  • 3 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • I'm seeing some weird behavior with 276.2. The following code works as expected, and in the debugger I can see Player's animation being set to "collapse" in either scenario.

    However, if I combine the conditions into an OR block, like this...

    ...this is what happens:

    - the "set animation to collapse" action executes when either of the conditions is met (expected)

    - Player's animation changes to "collapse" ONLY when the hitCount>= player.hitMax condition is true. In other words, if lifeBar (a Progress Bar) has progress <= 0, the "set animation to collapse" action is still called per the debugger, but the player animation doesn't change.

    I've had the OR block (2nd pic) in my code for many months now, and only recently started seeing an issue with it. I split it into the code shown in the 1st pic and now it works. Is there something about OR blocks or Progress Bar objects that I'm not considering?

  • It's a weird thing about OR-blocks in C3 - they still pick instances. So in your case, when the first condition (Player hitCount) is false, then no Player insteances will be picked. If the second condition is true, the event will execute, but because the picked scope for Player is zero, "Player set animation" action will have no effect.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks! Glad to see see it's not a bug. Definitely need to wrap my brain around this, but it may explain why some of my other code is acting funny.

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