import pygame, os, sys, Global, Iputfrom pygame.locals import *#class for dealing with the player including animationclass Character(): def DrawDirection(self): #draws the picture of the player based on his direction if Global.PlayerDirection == 1 and Global.IsRunning == 0: #if the player is facing left Global.Screen.blit(Global.LeftStand, (Global.PlayerX,Global.PlayerY)) #move and update our rect Global.PlayerLRect.topleft = (Global.PlayerX,Global.PlayerY) pygame.display.update(Global.PlayerLRect) if Global.PlayerDirection == 2 and Global.IsRunning == 0: #if player is facing right and standing still Global.Screen.blit(Global.RightStand, (Global.PlayerX,Global.PlayerY)) #move and update our rect Global.PlayerRRect.topleft = (Global.PlayerX,Global.PlayerY) pygame.display.update(Global.PlayerRRect) def Run(self): #animates the player running left if Global.PlayerDirection == 1 and Global.IsRunning == 1: #draw the player Global.Screen.blit(Global.PlayerLeftFrames[Global.CurrentFrame], (Global.PlayerX,Global.PlayerY)) #move the player rect Global.PlayerLRect.topleft = (Global.PlayerX,Global.PlayerY) #update player position pygame.display.update(Global.PlayerLRect) #wait a given time pygame.time.delay(Global.RUNFPS) #Make sure you are within the list of animations if Global.CurrentFrame != 0: Global.CurrentFrame = Global.CurrentFrame - 1 if Global.CurrentFrame == 0: Global.CurrentFrame = 6 #animates the player running right if Global.PlayerDirection == 2 and Global.IsRunning == 1 : #draw the player Global.Screen.blit(Global.PlayerRightFrames[Global.CurrentFrame], (Global.PlayerX,Global.PlayerY)) #move the player rect Global.PlayerRRect.topleft = (Global.PlayerX,Global.PlayerY) #update player position pygame.display.update(Global.PlayerRRect) #wait a given time pygame.time.delay(Global.RUNFPS) #Make sure you are within the list of animations if Global.CurrentFrame != 0: Global.CurrentFrame = Global.CurrentFrame - 1 if Global.CurrentFrame == 0: Global.CurrentFrame = 6