The screenshot above is 1 frame of the new idle animation. The idle animation is made up of 22 frames and is played about every 15s of idling. If the player moves, the idle animation timer will be reset to 0s. This is what the screenshot is made of:
The image on the right is all the frames that make up the idle animation. The screenshot on the left is the code that tells the game when to play the animation and what frames to use. I have wrote this is the step action, because it needs a constant stream of updates. Otherwise there will be a lot of issues.
This code does work currently, because there is only idle animation, but if I want a second animation to play off randomly, then I would need to adjust the code, so it only selects certain frames to run. This is quite easily done on a small scale, but may turn out to be overwhelming on a large scale.