Friday, February 20, 2015

Cleaning Up My Events With Variables in Construct 2

Ok.  I am perfectly aware that this post is going to be extremely boring to people that don't use Construct 2, but Its kind of a big deal to me so I thought I would post it.  I must finally be getting the hang of this because I just simplified one of my triggers in a big way.  My animation is based on 4 variables that tell you whether the player is flying, carrying something/someone, where they are in the animation (starting, looping, or ending), and what direction they are moving.  When the player starts moving, the cape picks up and they take the posture of the looping animation.  After any starting animation ends, the variable changes to "loop" which lets me change to any looping animation based on my direction and not restart with the Starting animation.

To trigger the change to "loop", I set up a huge event that said if any of the starting animations end, switch the animation state to "loop".  The problem is that a have way too many starting animations.  I was typing a lot.  That's when I realized that I could use the variables to just say any of those starting animations end and the loop begin.  The picture might explain it better.  Boring...I know.  But my code is cleaner now and I'm not scrolling through giant lists of animations.  Also, it might speed things up because I'm not asking the computer to check and see if any of those animations are playing.

Next post will have more art.  Promise.


No comments:

Post a Comment