def __init__(self): #stats of the character self.movementSpeed = 5 #variables that are not stats self.spriteSheet = pygame.image.load("charspritesheet.png") self.x = 40#starting positions self.y = 40 self.width = 40#size self.height = 40 self.animation = 0 self.characterAnimationHandler = AnimationHandler.AnimationHandler(self.animation,self.width,self.height,self.spriteSheet)#animation handler self.brain = BrainStateMachine.BrainStateMachine()#the brain of our Player self.PlayerInputHandler = InputHandler.Input_Handler() self.PlayerInput = self.PlayerInputHandler.returnEvents() #animations of this Character self.IdleAnimation = AnimationDataClass.animation(0,40,40,3,2) self.MoveLeftAnimation = AnimationDataClass.animation(1,40,40,4,3) self.MoveRightAnimation = AnimationDataClass.animation(2,40,40,4,3) self.MoveUpAnimation = AnimationDataClass.animation(3,40,40,4,3) self.MoveDownAnimation = AnimationDataClass.animation(4,40,40,4,3) #States of the chracter self.nonState = IdleState() self.moveState = MoveState() #set brain and animation self.characterAnimationHandler.changeAnimation(self.IdleAnimation)#set the current animation self.brain.Change(self.nonState) self.characterAnimationHandler.Update()#called to get the first image needed self.characterImage=self.characterAnimationHandler.ImageReturn()
def __init__(self): self.spriteSheet = pygame.image.load("charspritesheet.png") self.x = 40#starting positions self.y = 40 self.width = 40#size self.height = 40 self.animation = 0 self.characterAnimationHandler = AnimationHandler.AnimationHandler(self.animation,self.width,self.height,self.spriteSheet)#animation handler self.brain = StateMachine.StateMachine() #animations of this Character IdleAnimation = AnimationDataClass.animation(0,40,40,3,2) self.characterAnimationHandler.changeAnimation(IdleAnimation)#set the current animation self.characterAnimationHandler.Update()#called to get the first image needed self.characterImage=self.characterAnimationHandler.ImageReturn()