Made animation frame stuff into separate function to clean up code. Added basic code for game4