import pygame, random import core.view from model import Wall, Pacman, Ghost class WallSprite(core.view.AgentSprite): def draw(self): self.image.fill((80, 80, 80)) class GhostSprite(core.view.AgentSprite): def draw(self): self.image.fill((255, 0, 0)) class PacmanSprite(core.view.AgentSprite): def draw(self): self.image.fill((0, 255, 128)) pygame.draw.circle(self.image, (255, 255, 0), (5*self.zoom, 5*self.zoom), 4*self.zoom, 0) class PacmanView(core.view.SDLView): def show_agent(self, agent): if isinstance(agent, Wall): WallSprite(agent, self.agent_sprites, self.zoom) elif isinstance(agent, Ghost): GhostSprite(agent, self.agent_sprites, self.zoom) elif isinstance(agent, Pacman): PacmanSprite(agent, self.agent_sprites, self.zoom)