else bug?

This forum is currently in read-only mode.
From the Asset Store
Match same tiles with each other as fast as you can and earn more score during a limited time!
  • I was making some animations and made a condition for it that was:

    if(play_death_animation == true)
             play appropriate death animation
    else
    	if(moving)
    		moving animation
    	else
    		idle
    	if(jumping)
    		jumping animation
    	if(falling)
    		falling animation
    [/code:17ebdfw8]
    However, nothing in that else was being done (and adding a simple event to the top of it didn't affect anything either. I had to invert the original if and then stick the nested ones inside of it to make it work and I thought that was mighty strange and made little sense. Explanation for it?
  • When an else event has subevents it will not function, it is a know bug and is on the bug tracker.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can often avoid using sub-events with just several else statements in line, each grouped with another condition. Works just like if-elif-else conditionals, and has worked fine for me in Construct. Something like this should work:

    + if(play_death_animation == true)
    -> play appropriate death animation
    
    + else
    + if walking
    -> walking animation
    
    + else
    + if jumping
    -> jumping animation
    
    + else
    + if falling
    -> falling animation
    
    + else
    -> idle animation[/code:2jd4j6v1]
  • After much debugging I worked out what causes the else condition to bugger up when its nesting. It should be fixed for the next version

  • Very cool!

  • Great to hear, David! That will make a big difference to many users, I'm sure.

  • Thank you so much David!

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