def step(self): skills.checkBuffs(self) #Every enemy should check their buffs. (Not that they can have any at the moment) if (self.pos[0] < -100 or self.pos[0] > constants.WINDOW[0]+100): #If we're off screen too far, delete. self.alive = False if (self.pos[1] < -100 or self.pos[1] > constants.WINDOW[1]+100): self.alive = False
def step(self): skills.checkBuffs(self) for ind, cd in enumerate(self.cooldowns): self.cooldowns[ind] = max(cd-1,0) #Decrease the cooldowns, if any are on, by one. self.displace() #Apply our movements. #Check to see if buttons are being pressed, if so, do something. if (pygame.key.get_pressed()[pygame.K_LEFT] == True): self.move((-2,0)) if (self.dir == 1): self.dir = 0 self.img = pygame.transform.flip(self.img, True, False) if (pygame.key.get_pressed()[pygame.K_RIGHT] == True): self.move((2,0)) if (self.dir == 0): self.dir = 1 self.img = pygame.transform.flip(self.img, True, False) if (pygame.key.get_pressed()[pygame.K_UP] == True): self.move((0,-1)) if (pygame.key.get_pressed()[pygame.K_z] == True): self.attack(0) if (pygame.key.get_pressed()[pygame.K_x] == True): self.attack(1) if (pygame.key.get_pressed()[pygame.K_c] == True): self.attack(2) if (pygame.key.get_pressed()[pygame.K_DOWN] == True): self.attack(3) #Player object uses bouncing, add a bounce and make sure it doesn't go over the size of the bounce list. if (self.bounce > 0): self.bounce += 1 if (self.bounce > len(self.bouncy)-1): self.bounce = 0