import pygame from Constants import ROWS, COLS, UP, LEFT, DOWN, RIGHT class Agent(object): def __init__(self, point): self.point = point self.image = pygame.image.load('Engine/agent.png') self.orientation = 0 def getPoint(self): return self.point def defuse(self, bomb): bomb.isDefused = True def rotateImage(self, orientation): angle = self.getAngle(orientation) self.image = pygame.transform.rotate(self.image, 360 - self.orientation) self.image = pygame.transform.rotate(self.image, angle) self.orientation = angle def getAngle(self,orientation): if self.point.getX() < orientation.getX(): return 0 elif self.point.getY() > orientation.getY(): return 90 elif self.point.getX() > orientation.getX(): return 180 elif self.point.getY() < orientation.getY(): return 270 return 0 # def ifNotOnEdge(self, destination): # if destination == UP: # if self.x - 1 <= 0: # return False # if destination == DOWN: # if self.x + 1 > ROWS: # return False # if destination == LEFT: # if self.y - 1 <= 0: # return False # if destination == RIGHT: # if self.y + 1 > COLS: # return False # return True