Not logical code behaviour

0 favourites
  • 3 posts
From the Asset Store
5 levels with simple coding Source-code (.c3p) + HTML5 Exported
  • Hello,

    When N is pressed, both sprites are destroyed, why?? Sprite2 should never be destroyed because team_nb is not different of 1:

    Of course I could code it like this:

    If N pressed

    If team_nb = 1 destroy Sprite1

    else destroy Sprite2

    But this is a simple example of a bigger project where I have exactly the same problem and I don't understand the behaviour

    EDIT: I replaced ELSE by team_nb<>1 and now it works, that's strange!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Avoid using triggered events in sub-events. I believe triggers are executed before all non-triggered events. Maybe that's why Else condition is defaulted as 'true' or simply skipped when there is a trigger inside it.

  • Ok, thanks for the advice :)

    But in my case I was obliged: for each value of the variable team_nb, each key of the keyboard have different actions. For example, the A key could have 3 behaviour depending of this variable. Imagine for all the key of the keyboard, I would need to test eachtime the variable condition for each key...

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