#100DaysOfCode#100DaysOfGameDevC#CodingIllogical BaconScript-writingUnity

Power-up Animation Fixed!

Day 092#100DaysOfCode
Day 056 #100DaysOfGameDev

After days of racking my brain and working hard on trying to figure out why I couldn’t get the animation states to work properly when collecting a power-up, I finally figured it out. My solution may not be the most appropriate way to accomplish what I wanted, but it certainly worked.

BaconPickup script with isPowerUp trigger

I spent far too long debugging my code and trying to find where it was going wrong and finally came to the conclusion that I was exiting my isPowerUp state (it turned to false) far too early. This was throwing the code off and making the FP character leave the power-up state too early. By adding a second variable to capture the power-up state I was able to circumvent the early exit from the desired animation loop and keep things going as planned.

FlappyPig script with updated PowerUp code

Leave a Reply

Your email address will not be published. Required fields are marked *