Hi, everybody!
So, I’ve been trying to create an FSM (Finite State Machine) for Mario, following this tutorial, that’ll register whether he’s currently powered-up or not, but I’ve been running into some bugs. First off, what should happen is that the game checks for the animation Mario is supposed to be in, then checks what state he should be in, via the variable “PowerupState”, and assign both accordingly.
What happens in game is Mario does indeed grow big, but he’s stuck in his current animation forever, with the player input having no response.
I feel like I’ve tried everything and the only thing that I can figure may be the problem is that I’ve been using the PlatformerCharacterAnimator behavior for Mario’s movements instead of setting them manually in the events sheet, and now that I have a FSM, I’ve set the animations in both the behavior and the events sheet.
Here are my current events for Mario’s animation states and his powerup state:
It seems to me that, for some reason, the “Grow” animation isn’t triggering correctly and therefore the game cannot detect whether Mario has finished the animation. As always, any and all help would be very much appreciated!
I think after the animation is switched to “grow” the on floor and [inverted]moving is switching the animation to … “idle”. So, the “grow” animation is finished never has a chance to trigger the actions.
I see, and that makes sense. Do you have any suggestions on fixing it?
I’m assuming this will be a common issue with every powerup. Maybe the animation group needs to be a subevent of a behavior is enabled condition. Any event could be triggered depending if Mario is jumping or idle when he collides with a powerup.
I tend to think disabled behaviors are disabled but it depends on the behavior. It could be everything or just the control/gravity part. IDK. I did some testing, the behavior seems to return the state of the behavior at the time it was disabled. It doesn’t update the value of things like on floor but if it was on the floor then the condition is true.
Well, I managed to fix it… sorta. The grow animation doesn’t play like I want it to yet, but Mario CAN now move while big. All I needed to do was add a condition under the “Mario is in collision with Mushroom” that checks for if the animation of Mario is NOT = “Grow”, and I got rid of the time scale actions altogether for now.
1 Like
Good to hear. Maybe you can change the powerupState to “grow” first and then when the grow animation is done switch it to “big” You wouldn’t have to disable controls or change anything. Grow would just be another set of animations.
You could use the same strategy with all of the powerups.