Example #1
0
 def __init__(self, width = 580, height = 700):
     '''
     initializes the controller class and sets up the window
     inputs: width and height of window
     outputs: pacman screen
     '''
     pygame.init()
     self.width = width
     self.height = height
     self.screen = pygame.display.set_mode((self.width, self.height))
     self.background = pygame.Surface(self.screen.get_size()).convert()
     self.pacman = Pacman.Pacman(337, 520, 'pacman_whole.png')
     self.maze_image = pygame.image.load('empty_maze.png')
     self.resized = pygame.transform.smoothscale(self.maze_image, (580,620))
     #self.maze_image
     #self.pacman_rect = ?????????????
     self.sgroup = pygame.sprite.Group()
     self.sgroup.add(Cookies.Cookies(332, 462,'orange_down_1.png'))
     self.sgroup.add(Cookies.Cookies(54, 531,'orange_down_1.png'))
     self.sgroup.add(Cookies.Cookies(307, 350,'orange_down_1.png'))
     self.sgroup.add(Cookies.Cookies(125, 354,'orange_down_1.png'))
     self.sgroup.add(Cookies.Cookies(370, 240,'orange_down_1.png'))
     self.sgroup.add(Cookies.Cookies(470, 410,'orange_down_1.png'))
     self.scgroup = pygame.sprite.Group()
     self.scgroup.add(Cookies.Cookies(539, 106,'pink_down_1.png'))
     self.scgroup.add(Cookies.Cookies(33, 35,'pink_down_1.png'))
     self.scgroup.add(Cookies.Cookies(261, 89,'pink_down_1.png'))
     self.scgroup.add(Cookies.Cookies(510, 500,'pink_down_1.png'))
     self.ghosts = pygame.sprite.Group()
     self.ghosts.add(Ghost.Ghost('blue_up_2.png', 539, 106))
     self.ghosts.add(Ghost.Ghost('blue_up_2.png', 33, 35))
     self.ghosts.add(Ghost.Ghost('blue_up_2.png', 261, 89))
     self.ghosts.add(Ghost.Ghost('blue_up_2.png', 510, 500))
     #self.ghost=(Ghost.Ghost('pink_up_2.png', 300, 300))
     self.cookiescollected=0
     self.lives = 3