here is the rest whitch is the same as the @loop basically. oh and the xmax and ymax arrays make it so the sprite will not go off screen.