def _load_characters(self): # Just load the knight for now knight_north = load_sprite_asset("knight/look_north") knight_west = load_sprite_asset("knight/look_west") knight_walk_west = load_sprite_animation("knight", "walk_west", 8, 0.15) knight_walk_north = load_sprite_animation("knight", "walk_north", 8, 0.15) #knight_walk_west = knight_walk_north = pyglet.image.load_animation("assets/knight/walk_west.gif") # knight_walk_west.anchor_x = knight_walk_west.width / 2 knight_x, knight_y = self.map.get_coordinates(5, 5) knight_faces = faces_from_images(north=knight_north, west=knight_west) knight_walks = [ knight_walk_north, knight_walk_west, knight_walk_north, knight_walk_west ] knight = MovingSprite(knight_x, knight_y, knight_faces, knight_walks) knight.scale = 1 knight.is_player = True knight.zindex = 10 knight_x, knight_y = self.map.get_coordinates(5, 0) knight2 = MovingSprite(knight_x, knight_y, knight_faces, knight_walks) knight2.scale = 1 knight2.is_player = True knight2.zindex = 10 knight2.look(2) return [knight, knight2]
def _load_characters(self): # Just load the knight for now knight_north = load_sprite_asset("knight/look_north") knight_west = load_sprite_asset("knight/look_west") knight_walk_west = load_sprite_animation("knight", "walk_west", 8, 0.15) knight_walk_north = load_sprite_animation("knight", "walk_north", 8, 0.15) #knight_walk_west = knight_walk_north = pyglet.image.load_animation("assets/knight/walk_west.gif") # knight_walk_west.anchor_x = knight_walk_west.width / 2 knight_x, knight_y = self.map.get_coordinates(5, 5) knight_faces = faces_from_images(north=knight_north, west=knight_west) knight_walks = [knight_walk_north, knight_walk_west, knight_walk_north, knight_walk_west] knight = MovingSprite(knight_x, knight_y, knight_faces, knight_walks) knight.scale=1 knight.is_player=True knight.zindex=10 knight_x, knight_y = self.map.get_coordinates(5, 0) knight2 = MovingSprite(knight_x, knight_y, knight_faces, knight_walks) knight2.scale=1 knight2.is_player=True knight2.zindex=10 knight2.look(2) return [knight, knight2]
def _generate_map(self): x, y = GameScene.MAP_START_X, GameScene.MAP_START_Y x_offset, y_offset = self.GRID_WIDTH / 2, self.GRID_HEIGHT / 2 columns, rows = GameScene.MAP_WIDTH, GameScene.MAP_HEIGHT column_starts = [(x + i * x_offset, y - i * y_offset) for i in range(columns)] map_points = [[(x - i * x_offset, y - i * y_offset) for i in range(rows)] for x, y in column_starts] map = Map(columns, rows) for i, column in enumerate(map_points): for j, (x, y) in enumerate(column): image = load_sprite_asset("grass") image.anchor_x = image.width / 2 image.anchor_y = image.height / 2 sprite = PixelAwareSprite(image, x, y, batch=self.map_batch, centery=True) sprite.scale = 1 sprite.zindex = 0 map.add_sprite(i, j, sprite) return map
def _load_moogle(self): moogle_image = load_sprite_asset("moogle") moogle_image.anchor_x = moogle_image.width / 2 moogle_image.anchor_y = moogle_image.height / 2 moog_sprite = Sprite(moogle_image, 40 + self.camera.offset_x, 40 + self.camera.offset_y) return moog_sprite