Ejemplo n.º 1
0
pygame.display.set_caption("Gobbler")

# System setup
g = graphics.Graphics()
f = functions.GameFunctions(g, None)

# Tilesets Setup
tmxdata = tmxdata.TmxData()
maze = maze.Maze(tmxdata)
pellets_template = pellets.Pellets(tmxdata)
pellets = pellets.Pellets(tmxdata)
pellets.reset(pellets_template)
gobbler_paths = gobblerpaths.GobblerPaths(tmxdata)

# Sprites Setup
gobbler = gobblersprite.GobblerSprite(g, VoidNavigator())

# Game Loop setup
fps = 60

# Set gobbler's starting position in the maze
gobbler.reset()

# This is the main game loop.  Everything below here repeats forever.
while True:
    pygame.time.Clock().tick(fps)
    game_time = pygame.time.get_ticks()

    for event in pygame.event.get():
        # Pay attention if the user clicks the X to quit.
        if event.type == pygame.QUIT:
Ejemplo n.º 2
0
# System setup
g = graphics.Graphics()
f = functions.GameFunctions(g, None)

# Tilesets Setup
tmxdata = tmxdata.TmxData()
maze = maze.Maze(tmxdata)
pellets_template = pellets.Pellets(tmxdata)
pellets = pellets.Pellets(tmxdata)
pellets.reset(pellets_template)
ghost_paths = ghostpaths.GhostPaths(tmxdata)
gobbler_paths = gobblerpaths.GobblerPaths(tmxdata)

# Sprites Setup
gobbler = gobblersprite.GobblerSprite(g, GobblerNavigator(f, gobbler_paths))
ghost_yellow = ghostsprite.YellowGhostSprite(g, VoidNavigator())
ghost_pink = ghostsprite.PinkGhostSprite(g, VoidNavigator())
ghost_cyan = ghostsprite.CyanGhostSprite(g, VoidNavigator())
ghost_red = ghostsprite.RedGhostSprite(g, VoidNavigator())

# Lists setup
all_ghosts = [ghost_yellow, ghost_pink, ghost_cyan, ghost_red]
all_sprites = [gobbler, ghost_yellow, ghost_pink, ghost_cyan, ghost_red]

# Game Loop setup
fps = 60

# Reset all sprites to their starting positions in the maze
for sprite in all_sprites:
    sprite.reset()