def draw(self): self.s.screen.blit(self.game.rescaledBackground, (0, 0)) # Draw the player's rectangle, rails self.playerImage.blit_at_rect(self.s, self.playerRect) # Draw each baddie for z in self.zombies: z.blit(self.s) for c in self.newKindZombies: c.blit(self.s) # draw each bullet for b in self.bullets: b.blit(self.s) # Draw the score and how many zombies got past self.drawText('zombies gotten past: %s' % (self.zombiesGottenPast), self.font, 10, 20) self.drawText('score: %s' % (self.score), self.font, 10, 50) if self.game_over: os = over_scene.over_scene(self.game) os.score = self.score os.death_by_zombie = self.death_by_zombie self.game.gotoScene(os)
def update(self): elapsed_time = pygame.time.get_ticks() - self.start_time self.secs = GAME_LENGTH - int(elapsed_time/1000) if (self.secs == 0): os = over_scene.over_scene(self.game) os.score = self.score self.game.gotoScene(os) if self.down_pressed: self.eraser_sprite.y = self.eraser_sprite.y + 1 if self.up_pressed: self.eraser_sprite.y = self.eraser_sprite.y - 1 if self.left_pressed: self.eraser_sprite.x = self.eraser_sprite.x - 1 if self.right_pressed: self.eraser_sprite.x = self.eraser_sprite.x + 1