def __init__(self, screenDimensions, worldDimensions, robots, controllers): #initialize graphics pygame.init() self.screen = pygame.display.set_mode(screenDimensions) #store reference dims self.worldDimensions = worldDimensions self.screenDimensions = screenDimensions self.robots = robots self.controllers = controllers #trail data self.trails = [] self.debuggers = [] self.q = 0 #initalize screen resources self.robotSprites = [] self.robotHitboxes = [] c = 0 for robot in self.robots: self.robotSprites.append( pygame.Surface((self.translateDim(robot.getWidth(), 0)[0], self.translateDim(0, robot.getWidth())[1]))) #self.robotSprites[c].fill((255,0,0)) #self.robotSprites[c].set_colorkey((0,0,0)) self.robotHitboxes.append(self.robotSprites[c].get_rect()) self.robotHitboxes[c].center = self.translateCoord( robot.getPos()[0], robot.getPos()[1]) sprite = pygame.image.load("arrow.jpg") self.robotSprites[c] = pygame.transform.scale( sprite, self.robotHitboxes[c].size) self.robotSprites[c].convert() self.robotSprites[c].set_colorkey((0, 0, 0)) self.trails.append(trail.Trail(int(5 * self.robots[c].getWidth()))) c += 1
def setGladeTrailObjects(self, name, levelTrail, nightSkiing, nameOfMountain): newTrail = trail.Trail(name, levelTrail, nightSkiing, nameOfMountain) self.gladeTrailObjects.append(newTrail)
def setDoubleBlackTrailObjects(self, name, levelTrail, nightSkiing, nameOfMountain): newTrail = trail.Trail(name, levelTrail, nightSkiing, nameOfMountain) self.doubleBlackTrailObjects.append(newTrail)