I have create an animation for when the rat is being summoned. Before the player would just stand in it’s idle state, but now this will play instead. Once finished the animation is frozen.
To apply this animation I first needed to alter the summoning conditions, so it will call for the above animation to be played:
Above I split the code into two sections. The top code will set up the animation so it can be played and the bottom code reset the summoning animation, so the player looks like it is waiting to pick up the rat. The summoning animation code looks like this:
Only the top section of code has been used so far. The other two were final improvements, they weren’t necessary, but improved the animation a lot more.
Here is what it looks like with the code implemented:
Now for the extra code shown. The extra code is for ending the animation sequence. To initiate the code, I altered the on collision with rat action in the player code:
This simply just deletes the rat and changes a variable. The other code is currently useless, because I haven’t set up any scenarios for it just yet.
Anyway this brings me back to the code previously. With the new animation_action value. The animation is then looked for and once found, will start reversing the animation. After the animation hits a certain frame range, the animation will be set to the idle pose and the animation_action will be unlocked for the other animation code, so it can be reused.