def setup(self): """ Set up the game and initialize the variables. """ # Sprite lists self.all_sprites_list = arcade.SpriteList() self.coin_list = arcade.SpriteList() # Set up the player self.score = 0 self.player = arcade.AnimatedWalkingSprite() filename = "images/character_sheet.png" image_location_list = [[0, 6, 59, 92]] self.player.stand_right_textures = \ arcade.load_textures(filename, image_location_list, False) self.player.stand_left_textures = \ arcade.load_textures(filename, image_location_list, True) image_location_list = [[591, 5, 64, 93], [655, 10, 75, 88], [730, 7, 54, 91], [784, 3, 59, 95], [843, 6, 56, 92]] self.player.walk_right_textures = \ arcade.load_textures(filename, image_location_list, False) self.player.walk_left_textures = \ arcade.load_textures(filename, image_location_list, True) self.player.texture_change_distance = 20 self.player.center_x = SCREEN_WIDTH // 2 self.player.center_y = SCREEN_HEIGHT // 2 self.player.scale = 0.8 self.all_sprites_list.append(self.player) for i in range(COIN_COUNT): coin = arcade.AnimatedTimeSprite(scale=0.5) coin.center_x = random.randrange(SCREEN_WIDTH) coin.center_y = random.randrange(SCREEN_HEIGHT) coin.textures = [] coin.textures.append(arcade.load_texture("images/gold_1.png", scale=COIN_SCALE)) coin.textures.append(arcade.load_texture("images/gold_2.png", scale=COIN_SCALE)) coin.textures.append(arcade.load_texture("images/gold_3.png", scale=COIN_SCALE)) coin.textures.append(arcade.load_texture("images/gold_4.png", scale=COIN_SCALE)) coin.textures.append(arcade.load_texture("images/gold_3.png", scale=COIN_SCALE)) coin.textures.append(arcade.load_texture("images/gold_2.png", scale=COIN_SCALE)) coin.cur_texture_index = random.randrange(len(coin.textures)) self.coin_list.append(coin) self.all_sprites_list.append(coin) # Set the background color arcade.set_background_color(arcade.color.AMAZON)
def __start__(self): random.seed() # load the sounds self.snds['music'] = arcade.Sound('resources/music.wav', True) self.snds['victory'] = arcade.Sound('resources/victory.wav') self.snds['select'] = arcade.Sound('resources/select.wav') self.snds['no-select'] = arcade.Sound('resources/no-select.wav') self.snds['confirm'] = arcade.Sound('resources/confirm.wav') self.snds['wall-hit'] = arcade.Sound('resources/wall_hit.wav') self.snds['paddle-hit'] = arcade.Sound('resources/paddle_hit.wav') self.snds['pause'] = arcade.Sound('resources/pause.wav') self.snds['score'] = arcade.Sound('resources/score.wav') self.snds['brick-hit-1'] = arcade.Sound('resources/brick-hit-1.wav') self.snds['brick-hit-2'] = arcade.Sound('resources/brick-hit-2.wav') self.snds['high_score'] = arcade.Sound('resources/high_score.wav') self.snds['recover'] = arcade.Sound('resources/recover.wav') self.window = arcade.Window(const.SCREEN_WIDTH, const.SCREEN_HEIGHT - 10, const.SCREEN_TITLE) arcade.set_viewport(0, const.SCREEN_WIDTH, 5, const.SCREEN_HEIGHT - 5) self.snds['music'].play(const.VOLUME) # load the textures self.textures['bricks'] = arcade.load_spritesheet( const.BRICK_TEXTURES, const.BRICK_WIDTH, const.BRICK_HEIGHT, const.BRICK_COL, const.BRICK_COUNT) self.textures['balls'] = arcade.load_textures(const.BALL_TEXTURES, const.BALL_LOCATIOINS) self.textures['paddles'] = arcade.load_textures( const.PADDLE_TEXTURES, const.PADDLE_LOCATIONS) self.textures['arrows'] = arcade.load_textures(const.ARROW_TEXTURES, const.ARROW_LOCATIONS) # create the game controller interface self.gc = game_controller(game_device.setup()) self.sprites = arcade.SpriteList()
def assingTextures(self): file = "images/SBM2-Bomberman.gif" stand_left_right = [[52, 00, 16, 28]] self.stand_right_textures = arcade.load_textures( file, stand_left_right, False) self.stand_left_textures = arcade.load_textures( file, stand_left_right, True) stand_up = [[00, 00, 18, 28]] self.stand_up_textures = arcade.load_textures(file, stand_up, False) stand_down = [[105, 00, 18, 28]] self.stand_down_textures = arcade.load_textures( file, stand_down, False) walk_sprites = [[52, 00, 16, 28], [72, 00, 16, 28], [52, 00, 16, 28], [89, 00, 16, 28]] self.walk_right_textures = \ arcade.load_textures(file, walk_sprites, False) self.walk_left_textures = \ arcade.load_textures(file, walk_sprites, True) walk_sprites = [[00, 00, 18, 28], [18, 00, 18, 28], [00, 00, 18, 28], [36, 00, 18, 28]] self.walk_up_walk_textures = arcade.load_textures( file, walk_sprites, False) walk_sprites = [[105, 00, 18, 28], [123, 00, 18, 28], [105, 00, 18, 28], [141, 00, 18, 28]] self.walk_down_textures = arcade.load_textures(file, walk_sprites, False)
def __init__(self): super().__init__() self.texture_change_distance = 10 self.speed = 3 self.jump_speed = 10 t_trim = 100 l_trim = 2 r_trim = 2 image_location_list = [ [520 + l_trim, 516 + t_trim, 128 - l_trim - r_trim, 256 - t_trim], [520 + l_trim, 258 + t_trim, 128 - l_trim - r_trim, 256 - t_trim], [520 + l_trim, 0 + t_trim, 128 - l_trim - r_trim, 256 - t_trim], [390 + l_trim, 1548 + t_trim, 128 - l_trim - r_trim, 256 - t_trim], [390 + l_trim, 1290 + t_trim, 128 - l_trim - r_trim, 256 - t_trim], [390 + l_trim, 516 + t_trim, 128 - l_trim - r_trim, 256 - t_trim], [390 + l_trim, 258 + t_trim, 128 - l_trim - r_trim, 256 - t_trim] ] texture_info_list = \ arcade.load_textures("images/spritesheet_complete.png", image_location_list) for texture_info in texture_info_list: texture = texture_info self.append_texture(texture) texture_info_list = \ arcade.load_textures("images/spritesheet_complete.png", image_location_list, True) for texture_info in texture_info_list: texture = texture_info self.append_texture(texture) self.set_left_walk_textures([12, 13]) self.set_right_walk_textures([5, 6]) self.set_left_jump_textures([10]) self.set_right_jump_textures([3]) self.set_left_stand_textures([11]) self.set_right_stand_textures([4]) self.scale = SCALE self.set_texture(4) self.facing = "right" self.apply_gravity = True
def __init__(self): super().__init__() self.texture_change_distance = 10 self.speed = 3 self.jump_speed = 10 t_trim = 100 l_trim = 2 r_trim = 2 image_location_list = [ [520 + l_trim, 516 + t_trim, 128 - l_trim - r_trim, 256 - t_trim], [520 + l_trim, 258 + t_trim, 128 - l_trim - r_trim, 256 - t_trim], [520 + l_trim, 0 + t_trim, 128 - l_trim - r_trim, 256 - t_trim], [390 + l_trim, 1548 + t_trim, 128 - l_trim - r_trim, 256 - t_trim], [390 + l_trim, 1290 + t_trim, 128 - l_trim - r_trim, 256 - t_trim], [390 + l_trim, 516 + t_trim, 128 - l_trim - r_trim, 256 - t_trim], [390 + l_trim, 258 + t_trim, 128 - l_trim - r_trim, 256 - t_trim]] texture_info_list = \ arcade.load_textures("images/spritesheet_complete.png", image_location_list) for texture_info in texture_info_list: texture = texture_info self.append_texture(texture) texture_info_list = \ arcade.load_textures("images/spritesheet_complete.png", image_location_list, True) for texture_info in texture_info_list: texture = texture_info self.append_texture(texture) self.set_left_walk_textures([12, 13]) self.set_right_walk_textures([5, 6]) self.set_left_jump_textures([10]) self.set_right_jump_textures([3]) self.set_left_stand_textures([11]) self.set_right_stand_textures([4]) self.scale = SCALE self.set_texture(4) self.facing = "right" self.apply_gravity = True
def __init__(self, board, row, col, hero): super().__init__(board, row, col, 'img/ninja.png', 0.05, hero) self.textures.extend( arcade.load_textures('img/Ninja.png', [ [0, 0, 1, 1], [0, 0, 1, 1], ]))
def __init__(self, index, position): super().__init__(center_x=position[0], center_y=position[1]) # Animation timing self.time = 1 self.update_time = 0 self.rate = 1 / 60 self.angle = -45 self.character_face_direction = RIGHT_FACING # Used for flipping between image sequences self.cur_texture = 0 self.scale = CHARACTER_SCALING # --- Load Textures --- texture_coords = [] for i in range(FRAMES): texture_coords.append((i * SPRITE_WIDTH * 2, index * SPRITE_HEIGHT, SPRITE_WIDTH, SPRITE_HEIGHT)) texture_coords.append( (i * SPRITE_WIDTH * 2 + SPRITE_WIDTH, index * SPRITE_HEIGHT, SPRITE_WIDTH, SPRITE_HEIGHT)) self.walk_textures = arcade.load_textures( asset('sprites/butterflies.png'), texture_coords) self.idle_texture_pair = [self.walk_textures[0], self.walk_textures[1]] self.texture = self.idle_texture_pair[self.character_face_direction]
def load_tile_table(filename, largeur, hauteur): locations = [] for image_y in range(0, int(512 / hauteur)): for image_x in range(0, int(512 / largeur)): locations.append((image_x * largeur, image_y * hauteur, largeur, hauteur)) images = arcade.load_textures(filename, locations) return images
def __init__(self, texture, index, x, y): super().__init__(texture, center_x=x, center_y=y, hit_box_algorithm='None') self.textures = load_textures(texture, [(i * 29, 0, 29, 28) for i in range(8)]) self.set_texture(index)
def __load(image_set, width, height): image = arcade.load_texture(C.RESOURCES + image_set) img_x = image.width img_y = image.height locations = [] for image_y in range(0, int(img_y / height)): for image_x in range(0, int(img_x / width)): locations.append( (image_x * width, image_y * height, width, height)) images = arcade.load_textures(C.RESOURCES + image_set, locations) return images
def getSpriteFromSpriteSheet(filename, width=None, height=None, rows=None, cols=None, rects=None): argsType = '' # there should be exactly 1 set of arguments passed (i.e. don't pass width/height AND rows/cols) if (width is not None or height is not None) and (argsType == ''): argsType = 'width/height' assert width is not None and height is not None, 'Both width and height must be specified' assert type(width) == int and width > 0, 'width arg must be a non-zero positive integer' assert type(height) == int and height > 0, 'height arg must be a non-zero positive integer' if (rows is not None or cols is not None) and (argsType == ''): argsType = 'rows/cols' assert rows is not None and cols is not None, 'Both rows and cols must be specified' assert type(rows) == int and rows > 0, 'rows arg must be a non-zero positive integer' assert type(cols) == int and cols > 0, 'cols arg must be a non-zero positive integer' if (rects is not None) and (argsType == ''): argsType = 'rects' for i, rect in enumerate(rects): assert len(rect) == 4, 'rect at index %s is not a sequence of four ints: (left, top, width, height)' % (i) assert (type(rect[0]), type(rect[1]), type(rect[2]), type(rect[3])) == (int, int, int, int), 'rect ' if (rects is None): rects = [] if argsType == '': raise ValueError('Only pass one set of args: width & height, rows & cols, *or* rects') sheetImage = Image.open(filename) print("sheetImage.size: {}".format(sheetImage.size)) sheetImage.close() if argsType == 'width/height': for y in range(0, sheetImage.height, height): if y + height > sheetImage.height: continue for x in range(0, sheetImage.width, width): if x + width > sheetImage.width: continue rects.append((x, y, width, height)) if argsType == 'rows/cols': spriteWidth = sheetImage.width // cols spriteHeight = sheetImage.height // rows for y in range(0, sheetImage.height, spriteHeight): if y + spriteHeight > sheetImage.height: continue for x in range(0, sheetImage.width, spriteWidth): if x + spriteWidth > sheetImage.width: continue rects.append([x, y, spriteWidth, spriteHeight]) print("#sprites: {}".format(len(rects))) # create a list of textures objects from the sprite sheet textures = arcade.load_textures(filename, rects) return textures
def _load_textures_and_reset_hitbox(self, texture_name: str): """ Create 8 lists of 8-texture spritesheets for each combination of hull and turret directions. """ full_texture_name = get_path_to_file(texture_name) width, height = get_texture_size(texture_name, columns=8) self.all_textures[IDLE] = load_textures(full_texture_name, [(i * width, 0, width, height) for i in range(8)]) self.textures = self.all_textures[self.pose] self.set_texture(self.facing_direction) self.set_hit_box(self.texture.hit_box_points)
def _load_textures_and_reset_hitbox(self, texture_name: str): """ Create 8 lists of 8-texture spritesheets for each combination of hull and turret directions. """ width, height = get_texture_size(texture_name, 8, 8) full_texture_name = get_path_to_file(texture_name) self.textures = [ load_textures(full_texture_name, [(i * width, j * height, width, height) for i in range(8)]) for j in range(8) ] self.set_texture(self.facing_direction) self.set_hit_box(self.texture.hit_box_points)
def __init__(self, board): super().__init__(board, row=10, col=12) self.health = 3 self.textures.extend( arcade.load_textures('img/Hero.png', [ [0, 0, 32, 32], [32, 0, 32, 32], [64, 0, 32, 32], [0, 32, 32, 32], [32, 32, 32, 32], [64, 32, 32, 32], [0, 64, 32, 32], ])) self.board = board self.set_texture(2) self.is_ghost = False self.has_shoe = False self.last_direction = Direction.RIGHT self.next_direction = None self.shoot_direction = None
def setup(self): """Sets up the game to play. To restart the game, this function is called. """ # Reset the score self.score = 0 # Clear the sprite lists for sprite in self.sprite_list: sprite.kill() # Create the player sprite self.player = arcade.Sprite("space_invaders/images/player.png", scale=SCALING) self.player.center_x = 400 self.player.center_y = 100 self.sprite_list.append(self.player) # Create all the enemy sprites # Five rows of 11 enemies each alien_rows = [ ("space_invaders/images/alien1.png", 30, 800), ("space_invaders/images/alien2.png", 20, 700), ("space_invaders/images/alien2.png", 20, 600), ("space_invaders/images/alien3.png", 10, 500), ("space_invaders/images/alien3.png", 10, 400), ] alien_locations = ((0, 0, 16, 8), (16, 0, 16, 8)) for alien_data in alien_rows: alien_file_name, alien_points, alien_center_y = alien_data alien_texture = arcade.load_textures(alien_file_name, alien_locations, scale=SCALING) for i in range(10): alien = Enemy(alien_texture, alien_points) alien.center_x, alien.center_y = ( i * 16 * SCALING + 120, alien_center_y, ) self.enemy_list.append(alien) self.sprite_list.append(alien)
def _load_textures_and_reset_hitbox(self, texture_name: str): width, height = get_texture_size(texture_name, columns=8) full_texture_name = get_path_to_file(texture_name) self.textures = load_textures(get_path_to_file(full_texture_name), [(i * width, 0, width, height) for i in range(8)])
], 'item_gascan': [ arcade.load_texture('assets/gascan.png'), arcade.load_texture('assets/gascan.png', mirrored=True), ], 'item_wading_boots': [ arcade.load_texture('assets/wadingboots.png'), arcade.load_texture('assets/wadingboots.png', mirrored=True), ], 'item_composite_bow': [arcade.load_texture('assets/compositebow.png')], 'item_shield': [arcade.load_texture('assets/shield.png')], 'pointer': arcade.load_textures( 'assets/pointer.png', [ (0, 0, 64, 64), (64, 0, 64, 64), (128, 0, 64, 64), ], ), 'bg': [arcade.load_texture('assets/bg.png')], } class InventoryTile: __slots__ = ('x', 'y', 'size') def __init__(self, x, y, size): self.x = x self.y = y self.size = size
def __init__(self, width, height): """ Initializer :param width: :param height: """ super().__init__(width, height) """ Set up the game and initialize the variables. """ # Sprite lists self.all_sprites_list = arcade.SpriteList() self.coin_list = arcade.SpriteList() # Set up the player self.score = 0 self.player = arcade.AnimatedWalkingSprite() filename = "images/character_sheet.png" image_location_list = [[0, 6, 59, 92]] self.player.stand_right_textures = \ arcade.load_textures(filename, image_location_list, False) self.player.stand_left_textures = \ arcade.load_textures(filename, image_location_list, True) image_location_list = [[591, 5, 64, 93], [655, 10, 75, 88], [730, 7, 54, 91], [784, 3, 59, 95], [843, 6, 56, 92]] self.player.walk_right_textures = \ arcade.load_textures(filename, image_location_list, False) self.player.walk_left_textures = \ arcade.load_textures(filename, image_location_list, True) self.player.texture_change_distance = 20 self.player.center_x = SCREEN_WIDTH // 2 self.player.center_y = SCREEN_HEIGHT // 2 self.player.scale = 0.8 self.all_sprites_list.append(self.player) for i in range(COIN_COUNT): coin = arcade.AnimatedTimeSprite(scale=0.5) coin.center_x = random.randrange(SCREEN_WIDTH) coin.center_y = random.randrange(SCREEN_HEIGHT) coin.textures = [] coin.textures.append(arcade.load_texture("images/gold_1.png", scale=COIN_SCALE)) coin.textures.append(arcade.load_texture("images/gold_2.png", scale=COIN_SCALE)) coin.textures.append(arcade.load_texture("images/gold_3.png", scale=COIN_SCALE)) coin.textures.append(arcade.load_texture("images/gold_4.png", scale=COIN_SCALE)) coin.textures.append(arcade.load_texture("images/gold_3.png", scale=COIN_SCALE)) coin.textures.append(arcade.load_texture("images/gold_2.png", scale=COIN_SCALE)) coin.cur_texture_index = random.randrange(len(coin.textures)) self.coin_list.append(coin) self.all_sprites_list.append(coin) # Set the background color arcade.set_background_color(arcade.color.AMAZON)
def get_bomb_textures(): # TODO Bomb Background 192,192,192 Make transparent file = "images/14bomberman.PNG" loc = [[50, 255, 16, 17], [33, 255, 16, 17], [18, 255, 16, 17], [33, 255, 16, 17]] return arcade.load_textures(file, loc, False)
def __init__(self, width, height, title): super().__init__(width, height, title) file_path = os.path.dirname(os.path.abspath(__file__)) os.chdir(file_path) self.frame_count = 0 arcade.set_background_color(arcade.color.AMAZON) self.character_list = arcade.SpriteList() self.player = arcade.AnimatedWalkingSprite() character_scale = 1 self.player.stand_right_textures = [] self.player.stand_right_textures = arcade.load_textures( "../../arcade/examples/images/character_sheet.png", ((0, 0, 59, 97), )) self.player.stand_left_textures = [] self.player.stand_left_textures = arcade.load_textures( "../../arcade/examples/images/character_sheet.png", ((0, 0, 59, 97), ), mirrored=True) self.player.walk_right_textures = [] self.player.walk_right_textures = arcade.load_textures( "../../arcade/examples/images/character_sheet.png", ( (592, 0, 63, 97), (656, 0, 731 - 656, 97), (731, 0, 783 - 731, 97), (786, 0, 843 - 786, 97), (844, 0, 898 - 844, 97), )) self.player.walk_left_textures = [] self.player.walk_left_textures = arcade.load_textures( "../../arcade/examples/images/character_sheet.png", ( (592, 0, 63, 97), (656, 0, 731 - 656, 97), (731, 0, 783 - 731, 97), (786, 0, 843 - 786, 97), (844, 0, 898 - 844, 97), ), mirrored=True) self.player.texture_change_distance = 20 self.player.center_x = SCREEN_WIDTH // 2 self.player.center_y = SCREEN_HEIGHT // 2 self.player.scale = 0.8 self.player.change_x = 2 self.player.texture = self.player.stand_left_textures[0] self.character_list.append(self.player) self.coin_list = arcade.SpriteList() coin = arcade.AnimatedTimeSprite(scale=0.5) coin.center_x = 500 coin.center_y = 500 coin.textures = [] coin.textures.append( arcade.load_texture("../../arcade/examples/images/gold_1.png", scale=COIN_SCALE)) coin.textures.append( arcade.load_texture("../../arcade/examples/images/gold_2.png", scale=COIN_SCALE)) coin.textures.append( arcade.load_texture("../../arcade/examples/images/gold_3.png", scale=COIN_SCALE)) coin.textures.append( arcade.load_texture("../../arcade/examples/images/gold_4.png", scale=COIN_SCALE)) coin.textures.append( arcade.load_texture("../../arcade/examples/images/gold_3.png", scale=COIN_SCALE)) coin.textures.append( arcade.load_texture("../../arcade/examples/images/gold_2.png", scale=COIN_SCALE)) coin.set_texture(0) self.coin_list.append(coin)
import arcade arcade.open_window("Sprite Example", 800, 600) player = arcade.PlatformerSpriteSheetSprite() top_trim = 100 ltrim = 2 rtrim = 2 image_location_list = [ [520 + ltrim, 516 + top_trim, 128 - ltrim - rtrim, 256 - top_trim], [520 + ltrim, 258 + top_trim, 128 - ltrim - rtrim, 256 - top_trim], [520 + ltrim, 0 + top_trim, 128 - ltrim - rtrim, 256 - top_trim], [390 + ltrim, 1548 + top_trim, 128 - ltrim - rtrim, 256 - top_trim], [390 + ltrim, 1290 + top_trim, 128 - ltrim - rtrim, 256 - top_trim], [390 + ltrim, 516 + top_trim, 128 - ltrim - rtrim, 256 - top_trim], [390 + ltrim, 258 + top_trim, 128 - ltrim - rtrim, 256 - top_trim]] filename = "doc/source/examples/images/spritesheet_complete.png" texture_info_list = arcade.load_textures(filename, image_location_list) for texture_info in texture_info_list: texture = texture_info player.append_texture(texture) texture_info_list = arcade.load_textures(\ filename, image_location_list, True) for texture_info in texture_info_list: texture = texture_info player.append_texture(texture) player.set_left_walk_textures([12, 13]) player.set_right_walk_textures([5, 6]) player.set_left_jump_textures([10]) player.set_right_jump_textures([3]) player.set_left_stand_textures([11]) player.set_right_stand_textures([4]) player.texture_change_distance = 5
from arcade import load_textures from character import Character up = load_textures("assets/player/up.png", [[0, 0, 50, 50], [50, 0, 50, 50], [100, 0, 50, 50]]) down = load_textures("assets/player/down.png", [[0, 0, 50, 50], [50, 0, 50, 50], [100, 0, 50, 50]]) left = load_textures("assets/player/left.png", [[0, 0, 50, 50], [50, 0, 50, 50], [100, 0, 50, 50]]) right = load_textures("assets/player/right.png", [[0, 0, 50, 50], [50, 0, 50, 50], [100, 0, 50, 50]]) stationary_up = up[0] stationary_down = down[0] stationary_left = left[0] stationary_right = right[0] moving_up = up moving_down = down moving_left = left moving_right = right class Player(Character): def __init__(self, center_x, center_y): super().__init__(
def get_bomb_textures(): file = "images/14bomberman.PNG" loc = [[50, 255, 16, 17], [33, 255, 16, 17], [18, 255, 16, 17], [33, 255, 16, 17]] return arcade.load_textures(file, loc, False)
from utils.colors import GREEN, RED, YELLOW from game import Game from players_and_factions.player import PlayerEntity from units.units import Unit, Vehicle from utils.functions import get_path_to_file, ignore_in_menu from utils.geometry import average_position_of_points_group UNIT_HEALTH_BAR_WIDTH = 5 SOLDIER_HEALTH_BAR_WIDTH = 4 BUILDING_HEALTH_BAR_WIDTH = 10 UNIT_HEALTHBAR_LENGTH_RATIO = 0.6 SOLDIER_HEALTHBAR_LENGTH_RATIO = 0.4 BUILDING_HEALTHBAR_LENGTH_RATIO = 1.8 selection_textures = load_textures( get_path_to_file('unit_selection_marker.png'), [(i * 60, 0, 60, 60) for i in range(10)]) building_selection_texture = load_texture( get_path_to_file('building_selection_marker.png'), 0, 0, 180, 180) soldier_selection_texture = load_texture( get_path_to_file('soldier_selection_marker.png'), 0, 0, 40, 40) def selected_unit_marker(entity): if entity.is_infantry: return SelectedSoldierMarker(entity) else: return SelectedUnitMarker(entity) class SelectedEntityMarker:
def __init__(self): self.MOVEMENT_SPEED = 4.7 super().__init__() # set initial direction self.action = RIGHT_FACING # load all santa sprites # right and left for idle self.idle_textures = load_texture_pair( "images/present_catch/santa_idle.png") # get running textures from sprite map self.animated_textures = [ arcade.load_textures( "images/present_catch/santa_running.png", [ # moving right [0, 0, 128, 128], [128, 0, 128, 128], [256, 0, 128, 128], [384, 0, 128, 128] ]), arcade.load_textures( "images/present_catch/santa_running.png", [ # moving left [0, 128, 128, 128], [128, 128, 128, 128], [256, 128, 128, 128], [384, 128, 128, 128] ]), arcade.load_textures( "images/present_catch/santa_dancing.png", [ # dance 1 - something [0, 0, 128, 128], [128, 0, 128, 128], [256, 0, 128, 128], [384, 0, 128, 128], [512, 0, 128, 128], [640, 0, 128, 128], [768, 0, 128, 128], [896, 0, 128, 128] ]), arcade.load_textures( "images/present_catch/santa_dancing.png", [ # dance 2 - kicking [0, 128, 128, 128], [128, 128, 128, 128], [256, 128, 128, 128], [384, 128, 128, 128] ]), arcade.load_textures( "images/present_catch/santa_dancing.png", [ # dance 3 - clapping [512, 128, 128, 128], [640, 128, 128, 128], [768, 128, 128, 128], [896, 128, 128, 128] ]) ] # animation updates per frame self.FRAMES_PER_UPDATE = 10 # current texture in animation self.current_texture = 0 # hitbox self.points = [[-40, 64], [40, 64], [40, -64], [-40, -64]]