Exemple #1
0
 def __init__(self):
     super().__init__()
     self.map = TiledMap(self.tiles, PUZZLEMAP, offset=Vector(50, 50))
     self.sprite = TileSprite(self.tiles['b.pac_right'],
                              Vector(0, 0),
                              speed=2,
                              offset=Vector(50, 10 * 32 + 50))
     self.trees_counted = 0
     self.path = DEFAULT_PATH.copy()
Exemple #2
0
 def create_mine(self):
     x = 25
     y = random.randint(1, 20)
     mine = SpaceMine(self.frame, self.tile_factory, Vector(x, y))
     for i in range(x + 1):
         mine.sprite.add_move(LEFT)
     return mine
Exemple #3
0
 def __init__(self, pclass):
     super().__init__(SIZEX, SIZEY, "Dungeon Crawl")
     arcade.set_background_color(arcade.color.BLACK)
     self.tiles = load_tiles('fruit.csv')
     self.add_tile_synonyms()
     self.player = pclass(self.tiles, None)
     self.level = None
     self.level_cache = {}
     self.enter_level('level.json', Vector(2, 6))
 def __init__(self):
     self.game = Game()
     self.tm = TiledMap(self.game)
     self.gap = Vector(4, 4)
     self.tm.set_map(PUZZLEMAP)
     self.tm.draw()
     self.events = None
     self.game.frame.print_text("Build horizontal rows", (0, 220))
     pygame.display.update()
     self.game.event_loop(figure_moves=self.move)
Exemple #5
0
 def enter_level(self, filename, pos):
     if filename not in self.level_cache:
         self.level = Level(filename,
                            self.tiles,
                            self.player,
                            offset=Vector(50, 170))
         self.level_cache[filename] = self.level
     else:
         self.level = self.level_cache[filename]
     self.player.level = self.level
     self.player.pos = pos
     self.timer = TIMER
Exemple #6
0
#levels.ghostpos(levelnumber)

from tilegamelib import Vector

#example level
example = """####################
####################
####################
#bs#################
#y##################
#pgbry5#############
#o##g###############
#br#os##############
#igyp###############
####################"""
ghostposex = [Vector(1, 3)]
playerposex = [Vector(1, 8)]
ghostspeedex = 2

#level 1, Tutorial
#player must press every combination of colors to learn
#no ghosts
level1 = """####################
####################
####################
####################
####################
####################
####################
########5###########
#ipgbryos###########
Exemple #7
0
 def create_level(self):
     frame = Frame(self.screen, Rect(10, 10, 640, 512))
     self.level = SpaceshipLevel(frame, self.tile_factory)
     self.spaceship = SpaceshipSprite(frame, self.tile_factory, Vector(1, 1), self.level)
Exemple #8
0
def test_frutris(game):
    LEVEL = """#......#
#......#
#......#
#....a.#
#....a.#
#.bb.a.#
#ccddde#
#cbbbaa#
########"""

    frutris = FrutrisBox(game, LEVEL)

    # draw screen
    game.screen.clear()
    frutris.draw()
    pygame.display.update()
    time.sleep(0.5)

    # insert fruit
    frutris.level.insert(Vector(4, 5), 'd')
    frutris.level.draw()
    pygame.display.update()
    time.sleep(0.5)

    # remove fruits
    for i in range(3):
        frutris.remove_blocks()
        # wait_for_move(frutris, screen, frutris.draw)
        frutris.level.get_dropped_bricks()
        # wait_for_move(frutris, screen, frutris.draw)

    # test diamond
    frutris.insert_diamond(2)
    for i in range(10):
        wait(frutris)
        frutris.moving_blocks.drop()

    # test fruit pair
    frutris.insert_fruit_pair('a', 'b')

    # drop stuff
    frutris.moving_blocks.drop()
    wait(frutris)
    frutris.moving_blocks.drop()
    wait(frutris)

    # move stuff
    for i in range(4):
        frutris.moving_blocks.shift(LEFT)
        wait(frutris)
    for i in range(4):
        frutris.moving_blocks.shift(RIGHT)
        wait(frutris)
    for i in range(4):
        frutris.moving_blocks.rotate()
        wait(frutris)
    for i in range(6):
        frutris.moving_blocks.drop()
        wait(frutris)

    time.sleep(2)