Exemplo n.º 1
0
 def setup(self):
     self.BoardSprite = arcade.Sprite("image/GUI/Menu.png")
     self.BoardSprite.center_x = self.WIDTH - 90
     self.BoardSprite.center_y = self.HEIGHT - 80
     self.BoardSprite._set_height(150)
     self.BoardSprite._set_width(180)
     self.panel.append(self.BoardSprite)
     
     num_textures = arcade.load_spritesheet('image/numbersheet_style1.png', 30, 45, 10, 10)
     x = self.BoardSprite.center_x
     y = self.BoardSprite.center_y - 5
     for i in range(3):
         sprite = arcade.Sprite()
         for j in range(10):
             sprite.append_texture(num_textures[j])
         sprite.set_texture(0)
         sprite._set_scale(0.6)
         sprite._set_center_x(x + 18 * (i - 1))
         sprite._set_center_y(y)
         self.ScoreList.append(sprite)
     
     level_textures = arcade.load_spritesheet('image/levelsheet.png', 100, 128, 13, 13)
     for i in range(4):
         sprite = arcade.Sprite()
         for j in range(13):
             sprite.append_texture(level_textures[j])
         sprite._set_scale(0.2)
         sprite.set_texture(0)
         self.LevelList.append(sprite)
     self.LevelList[0]._set_center_x(x)
     self.LevelList[0]._set_center_y(y - 40)
     self.LevelList[1]._set_center_x(x + 50)
     self.LevelList[1]._set_center_y(y)
     self.LevelList[2]._set_center_x(x)
     self.LevelList[2]._set_center_y(y + 40)
     self.LevelList[3]._set_center_x(x - 50)
     self.LevelList[3]._set_center_y(y)
         
     timer_textures = arcade.load_spritesheet('image/timersheet.png', 120, 160, 10, 10)
     for i in range(4):
         sprite = arcade.Sprite()
         for j in range(10):
             sprite.append_texture(timer_textures[j])
         sprite._set_scale(0.25)
         sprite.set_texture(0)
         self.TimerList.append(sprite)
     self.TimerList[0]._set_center_x(self.WIDTH / 2)
     self.TimerList[0]._set_center_y(300)
     self.TimerList[1]._set_center_x(340)
     self.TimerList[1]._set_center_y(self.HEIGHT / 2 + 10)
     self.TimerList[2]._set_center_x(self.WIDTH / 2)
     self.TimerList[2]._set_center_y(self.HEIGHT - 280)
     self.TimerList[3]._set_center_x(self.WIDTH - 340)
     self.TimerList[3]._set_center_y(self.HEIGHT / 2 + 10)
Exemplo n.º 2
0
    def setup(self):
        super().setup()
        # Load the background image. Do this in the setup so we don't keep reloading it all the time.
        self.add_textures(
            "background",
            [arcade.load_texture("pybgrx_assets/CribbageBoardBackground.png")])

        # Sprite lists
        # THEY WILL BE DRAWN IN THE ORDER THEY'RE ADDED, SO LAST ONE IS FRONT
        # then some peg sprites!
        peg_textures = arcade.load_spritesheet("pybgrx_assets/Pegs.png",
                                               sprite_width=9,
                                               sprite_height=9,
                                               columns=8,
                                               count=8)
        self.add_textures("pegs", peg_textures)

        peg_list = arcade.SpriteList()
        peg_sprites = [
        ]  # for keeping track of each player's front and back peg
        peg_colors = [
            1, 7
        ]  # hardcoded orange and pink - TODO figure out how to set this at game level
        peg_positions = [[[182, 141], [121, 141]], [[207, 125], [45, 125]]]
        for plnum in range(
                0, 2
        ):  # each player's pegs = list of 2 sprites, peg_sprites = list of those lists
            peg_sprites.append([])
            # argh we need a dummy peg to load for this until I figure out how to get None filename constructed
            # sprites to work, which might be never, bc this is a prototype
            # two pegs per player
            for j in range(0, 2):
                newpeg = Peg("pybgrx_assets/GreenPeg.png",
                             scale=SPRITE_SCALING)
                newpeg.append_texture(peg_textures[peg_colors[plnum]])  # swh
                newpeg.set_texture(1)
                newpeg.left = peg_positions[plnum][j][0] * SCALE_FACTOR
                newpeg.bottom = peg_positions[plnum][j][1] * SCALE_FACTOR
                peg_sprites[plnum].append(newpeg)
                peg_list.append(newpeg)
        self.add_sprite_list("pegs", peg_list, peg_sprites)

        # then let's make some stationary card sprites for where I think they might be in the real game
        # normal list of them to be able to access each and change things - do we need it?
        card_textures = arcade.load_spritesheet("pybgrx_assets/CardDeck.png",
                                                sprite_width=CARD_WIDTH,
                                                sprite_height=CARD_HEIGHT,
                                                columns=4,
                                                count=52)
        self.add_textures("cards", card_textures)
Exemplo n.º 3
0
    def __init__(self):
        """ Initializer """
        # Call the parent class initializer
        super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)

        # Set the working directory (where we expect to find files) to the same
        # directory this .py file is in.
        file_path = os.path.dirname(os.path.abspath(__file__))
        os.chdir(file_path)

        # Pre-load the animation frames. We don't do this in the __init__
        # of the explosion sprite because it
        # takes too long and would cause the game to pause.
        self.explosion_texture_list = []

        columns = 16
        count = 60
        sprite_width = 256
        sprite_height = 256
        file_name = file_path + "\\resources\images\explosion.png"

        # Load the explosions from a sprite sheet
        self.explosion_texture_list = arcade.load_spritesheet(file_name, sprite_width, sprite_height, columns, count)

        # Load sounds. Sounds from kenney.nl
        self.hit_sound = arcade.sound.load_sound(":resources:sounds/explosion2.wav")

        arcade.set_background_color(arcade.color.AMAZON)
Exemplo n.º 4
0
 def load_spritesheet(cls):
     cls.texture_list = arcade.load_spritesheet(
         constants.EXPLOSION_FILENAME,
         constants.EXPLOSION_SPRITESHEET_WIDTH,
         constants.EXPLOSION_SPRITESHEET_HEIGHT,
         constants.EXPLOSION_SPRITESHEET_COLUMNS,
         constants.EXPLOSION_SPRITESHEET_COUNT)
Exemplo n.º 5
0
    def __init__(self, tank_list, spritesheet="res/tank_spritesheet_v2.png"):
        self.texture_list = arcade.load_spritesheet(spritesheet, 120, 120, 3,
                                                    3)
        self.wheel_sprite = arcade.Sprite()
        self.wheel_sprite.append_texture(self.texture_list[0])
        self.wheel_sprite.set_texture(0)
        self.wheel_sprite.center_x = 0
        self.wheel_sprite.center_y = 0
        self.wheel_sprite.set_hit_box([[-50, -50], [50, -50], [50, 50],
                                       [-50, 50]])  # 120x120 px

        self.body_sprite = arcade.Sprite()
        self.body_sprite.append_texture(self.texture_list[1])
        self.body_sprite.set_texture(0)
        self.body_sprite.center_x = 0
        self.body_sprite.center_y = 0

        self.turret_sprite = arcade.Sprite()
        self.turret_sprite.append_texture(self.texture_list[2])
        self.turret_sprite.set_texture(0)
        self.turret_sprite.center_x = 0
        self.turret_sprite.center_y = 0

        tank_list.append(self.wheel_sprite)
        tank_list.append(self.body_sprite)
        tank_list.append(self.turret_sprite)

        self.movement_speed = 50
        self.rotation_speed = math.radians(150)
        self.rotation = math.radians(90)

        self.health = 100.0
        self.ai_fire_rate = 0.5
        self.ai_fire_dt = 0
    def __init__(self):

        super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT)
        self.player_list = None
        self.coin_list = None
        self.bullet_list = None
        self.explosions_list = None
        self.player_sprite = None
        self.score = 0
        self.set_mouse_visible(False)
        self.explosion_texture_list = []
        columns = 30
        count = 60
        sprite_width = 280
        sprite_height = 280
        file_name = "../IMAGES/espa.jpg"

        # Load the explosions from a sprite sheet
        self.explosion_texture_list = arcade.load_spritesheet(
            file_name, sprite_width, sprite_height, columns, count)
        self.gun_sound = arcade.sound.load_sound(
            ":resources:sounds/laser2.wav")
        self.hit_sound = arcade.sound.load_sound(
            ":resources:sounds/explosion2.wav")
        arcade.set_background_color(arcade.color.BLUE_SAPPHIRE)
Exemplo n.º 7
0
    def __init__(self):
        """ Initializer """
        # Call the parent class initializer
        super().__init__(SCREEN_WIDTH,
                         SCREEN_HEIGHT,
                         SCREEN_TITLE,
                         fullscreen=False)

        # Set the working directory (where we expect to find files) to the same
        # directory this .py file is in. You can leave this out of your own
        # code, but it is needed to easily run the examples using "python -m"
        # as mentioned at the top of this program.
        file_path = os.path.dirname(os.path.abspath(__file__))
        os.chdir(file_path)

        # Variables that will hold sprite lists
        self.player_list = None
        self.coin_list = None
        self.bullet_list = None
        self.explosions_list = None
        self.wall_list = None

        # Set up the player info
        self.player = None
        self.score = 0

        self.can_move = True

        self.light_layer = None
        self.player_light = None
        self.player_radius = 200

        # Pre-load the animation frames. We don't do this in the __init__
        # of the explosion sprite because it
        # takes too long and would cause the game to pause.
        self.explosion_texture_list = []

        columns = 16
        count = 60
        sprite_width = 256
        sprite_height = 256
        file_name = ":resources:images/spritesheets/explosion.png"

        # Load the explosions from a sprite sheet
        self.explosion_texture_list = arcade.load_spritesheet(
            file_name, sprite_width, sprite_height, columns, count)

        # Load sounds. Sounds from kenney.nl
        self.gun_sound = arcade.sound.load_sound(
            ":resources:sounds/laser2.wav")
        self.hit_sound = arcade.sound.load_sound(
            ":resources:sounds/explosion2.wav")

        self.a_down = False
        self.d_down = False
        self.s_down = False
        self.w_down = False

        self.VIEW_LEFT = 0 - (SCREEN_WIDTH / 2)
        self.VIEW_BOT = 0 - (SCREEN_HEIGHT / 2)
Exemplo n.º 8
0
    def __init__(self, width, height, track):
        super().__init__(width, height, title='Slot Car Racer')

        self.track = track
        self.car_sprites = arcade.SpriteList()
        self.track_bounds = self.track.get_track_bounds()
        self.explosions_list = None

        self.explosion_texture_list = []
        self.cars_crashed = []

        columns = 8
        count = 51
        sprite_width = 256
        sprite_height = 256
        file_name = 'visualization/images/spritesheet.png'

        # Load the explosions from a sprite sheet
        self.explosion_texture_list = arcade.load_spritesheet(
            file_name, sprite_width, sprite_height, columns, count)

        arcade.set_background_color(arcade.color.WHITE)

        self.round_timer = {}  # Car to current round time
        self.round_times = {}  # Car to list of round times
        self.best_times = {}  # Record times for each car
        self.global_time = 0  # The total time since game start
        self.previous_rails = {}  # Previous rail for car
Exemplo n.º 9
0
 def __init__(self):
     super().__init__()
     # Loads the spritesheet for the character
     textures = arcade.load_spritesheet(
         'Pokemon_project_sprites/trainer_sprites.png', 15, 19, 3, 12)
     self.textures = textures
     self.set_texture(0)
Exemplo n.º 10
0
    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()
Exemplo n.º 11
0
    def __init__(self):
        super().__init__()
        """La biblioteca "os" permite localizar archivos lo que permmite importar imagenes mas facilmente"""
        file_path = os.path.dirname(os.path.abspath(__file__))
        os.chdir(file_path)

        self.frame_count = 0

        self.nave_list = arcade.SpriteList()
        self.enemy_list = arcade.SpriteList()
        self.bullet_list = arcade.SpriteList()
        self.nave_sprite = arcade.SpriteList()
        self.explosions_list = arcade.SpriteList()
        self.enemybullet_list = arcade.SpriteList()
        self.background1 = arcade.load_texture("." + os.path.sep + ".." + os.path.sep + "Fondos JPG" + os.path.sep + "FondoMarino.jpg")
        self.background2 = arcade.load_texture("." + os.path.sep + ".." + os.path.sep + "Fondos JPG" + os.path.sep + "FondoMarino2.jpg")
        self.background3 = arcade.load_texture("." + os.path.sep + ".." + os.path.sep + "Fondos JPG" + os.path.sep + "FondoMarino3.jpg")
        self.background4 = arcade.load_texture("." + os.path.sep + ".." + os.path.sep + "Fondos JPG" + os.path.sep + "NaveCayendose.jpg")
        self.background5 = arcade.load_texture("." + os.path.sep + ".." + os.path.sep + "Fondos JPG" + os.path.sep + "NaveCayendose2.jpg")
        self.background6 = arcade.load_texture("." + os.path.sep + ".." + os.path.sep + "Fondos JPG" + os.path.sep + "NaveCayendose3.jpg")
        self.background7 = arcade.load_texture("." + os.path.sep + ".." + os.path.sep + "Fondos JPG" + os.path.sep + "FondoGalaxia.jpg")
        self.background8 = arcade.load_texture("." + os.path.sep + ".." + os.path.sep + "Fondos JPG" + os.path.sep + "FondoGalaxia2.jpg")
        self.background9 = arcade.load_texture("." + os.path.sep + ".." + os.path.sep + "Fondos JPG" + os.path.sep + "FondoGalaxia3.jpg")
        self.background10 = arcade.load_texture("." + os.path.sep + ".." + os.path.sep + "Fondos JPG" + os.path.sep + "JefePezLinternaFondo.jpg")
        self.score = 0
        self.Vidas = 3
        self.nivel = 1 # PAra testear ciertos niveles tan solo hay que cambiar esta variable
        self.time_taken = 0
        self.lista_elite = []
        self.lista_mosquito = []
        self.lista_persecutora = []
        self.lista_bala = []
        self.lista_lintera = []
        self.lista_barrera = []
        self.lista_jefeFinal = []
        self.lista3 = []
        self.nivel_1()
        self.nave_sprite = nave("." + os.path.sep + ".." + os.path.sep + "Sprites" + os.path.sep + "NewNave.png", SPRITE_SCALING_NAVE)
        self.nave_sprite.center_x = 750
        self.nave_sprite.center_y = 125
        self.nave_list.append(self.nave_sprite)

        self.left_pressed = False
        self.right_pressed = False
        self.up_pressed = False
        self.down_pressed = False
        """Tamaño de la explosion cuando derribas una nave"""
        self.explosion_texture_list = []
        columns = 16
        count = 60
        sprite_width = 256
        sprite_height = 256
        explosion = ":resources:images/spritesheets/explosion.png"
        self.explosion_texture_list = arcade.load_spritesheet(explosion, sprite_width, sprite_height, columns, count)

        self.gun_sound = arcade.load_sound("." + os.path.sep + ".." + os.path.sep + "Fondos JPG" + os.path.sep +"hurt5.wav")
        self.hit_sound = arcade.load_sound("." + os.path.sep + ".." + os.path.sep + "Fondos JPG" + os.path.sep +"hit5.wav")

        arcade.set_background_color(arcade.color.BLACK)
Exemplo n.º 12
0
 def create_texture_list(asset, columns, count, sprite_width,
                         sprite_height):
     texture_list = arcade.load_spritesheet(
         file_name=asset,
         sprite_width=sprite_width,  # Sprite width of each frame
         sprite_height=sprite_height,  # Sprite height of each frame
         columns=columns,  # Number of columns in spritesheet
         count=count  # Total number of frames in spritesheet
     )
     return texture_list
Exemplo n.º 13
0
    def __init__(self, solid: bool, center_x: int, center_y: int, scale: float, vertical: bool = False):
        if solid:
            super().__init__('sprites/wall_00.png', scale=scale)
            self.textures = arcade.load_spritesheet('sprites/wall_spritesheet.png', 64, 16, 2, 15)
        else:
            super().__init__('sprites/log_00.png', scale=scale)
            self.textures = arcade.load_spritesheet('sprites/log_spritesheet.png', 64, 16, 2, 16)

        if vertical:
            self.angle = random.choice([90, 270])
        else:
            self.angle = 0

        self.center_x = center_x
        self.center_y = center_y
        self.breakable = not solid
        self.animate = False
        self.current_texture = 0
        self.animation_speed = 0.25
Exemplo n.º 14
0
 def __init__(self, sheet_name):
     super().__init__()
     self.textures = arcade.load_spritesheet(sheet_name,
                                             sprite_width=SPRITE_SIZE,
                                             sprite_height=SPRITE_SIZE,
                                             columns=3,
                                             count=12)
     self.cur_texture_index = 0
     self.texture = self.textures[self.cur_texture_index]
     self.inventory = []
Exemplo n.º 15
0
    def __load_2d(spritesheet, sp_width, sp_height, columns, count, margin=0):
        images = arcade.load_spritesheet(C.RESOURCES + spritesheet, sp_width,
                                         sp_height, columns, count, margin)
        x_axis = []
        for x in range(count // columns):
            rows = []
            x_axis.append(rows)
            for y in range(x * columns, x * columns + columns):
                rows.append(images[y])

        return x_axis
Exemplo n.º 16
0
    def _loadWarpEffectTextures(self) -> TextureList:

        nColumns:  int = 4
        tileCount: int = 4
        spriteWidth:  int = 32
        spriteHeight: int = 32
        bareFileName: str = f'WarpEffectSpriteSheet.png'
        fqFileName:   str = LocateResources.getResourcesPath(resourcePackageName=LocateResources.IMAGE_RESOURCES_PACKAGE_NAME, bareFileName=bareFileName)

        textureList: TextureList = cast(TextureList, load_spritesheet(fqFileName, spriteWidth, spriteHeight, nColumns, tileCount))

        return textureList
Exemplo n.º 17
0
    def __init__(self, start_pos_x: int, start_pos_y: int, direction: tuple):
        super().__init__('sprites/sawblade_0.png')
        self.center_x = start_pos_x
        self.center_y = start_pos_y

        self.current_texture = 0
        self.textures = arcade.load_spritesheet('sprites/sawblade_spritesheet.png', 16, 16, 3, 8)

        self.change_x = direction[0]
        self.change_y = direction[1]

        self.animation_speed = 0.25
Exemplo n.º 18
0
    def setup(self):
        self.player_list = arcade.SpriteList()
        self.enemy_list = arcade.SpriteList()
        self.bullet_list = arcade.SpriteList()
        self.player_bullet_list = arcade.SpriteList()
        self.explosions_list = arcade.SpriteList()
        self.ship_life_list = arcade.SpriteList()

        #Load the backgrounds and sounds
        self.background = arcade.load_texture("stars.jpg")
        #When a bullet is fired
        self.gun_sound = arcade.load_sound(":resources:sounds/hurt5.wav")
        #When a bullet hits a player or enemy
        self.hit_sound = arcade.sound.load_sound(
            ":resources:sounds/explosion2.wav")
        #When shield is deployed
        self.shield_sound = arcade.sound.load_sound(
            ":resources:sounds/upgrade5.wav")
        #When game is over
        self.gameOver_sound = arcade.sound.load_sound(
            ":resources:sounds/gameover1.wav")

        # Add player ship
        self.player = PlayerSprite(
            ":resources:images/space_shooter/playerShip3_orange.png", 0.5)
        self.player.center_x = SCREEN_WIDTH / 2
        self.player.center_y = 20
        self.player_list.append(self.player)

        #Add enemies
        self.spawnEnemies()

        #Add the little icons at the bottom left corner represeting lives
        cur_pos = 0
        for i in range(self.lives):
            life = arcade.Sprite(
                ":resources:images/space_shooter/playerLife1_orange.png", 0.7)
            life.center_x = cur_pos + life.width
            life.center_y = life.height
            cur_pos += life.width
            self.ship_life_list.append(life)

        # Load the explosions from a sprite sheet
        columns = 16
        count = 60
        sprite_width = 256
        sprite_height = 256
        file_name = ":resources:images/spritesheets/explosion.png"
        self.explosion_texture_list = arcade.load_spritesheet(
            file_name, sprite_width, sprite_height, columns, count)

        #Play song
        self.play_song()
Exemplo n.º 19
0
    def _loadTorpedoExplosionTextures(self) -> TextureList:

        nColumns:  int = 3
        tileCount: int = 9
        spriteWidth:  int = 32
        spriteHeight: int = 32
        bareFileName: str = f'SuperCommanderTorpedoExplosionSpriteSheet.png'
        fqFileName:   str = LocateResources.getResourcesPath(resourcePackageName=LocateResources.IMAGE_RESOURCES_PACKAGE_NAME, bareFileName=bareFileName)

        textureList: TextureList = cast(TextureList, load_spritesheet(fqFileName, spriteWidth, spriteHeight, nColumns, tileCount))

        return textureList
Exemplo n.º 20
0
    def __init__(self, width, height, title):
        """
        Initializer
        """

        super().__init__(width, height, title)

        # Sprite lists

        # We use an all-wall list to check for collisions.
        self.all_wall_list = None

        # Drawing non-moving walls separate from moving walls improves performance.
        self.static_wall_list = None
        self.moving_wall_list = None
        self.floor_list = None
        self.explosions_list = None
        self.explosion_texture_list = []

        columns = 16
        count = 60
        sprite_width = 256
        sprite_height = 256
        file_name = ":resources:images/spritesheets/explosion.png"

        # Load the explosions from a sprite sheet
        self.explosion_texture_list = arcade.load_spritesheet(
            file_name, sprite_width, sprite_height, columns, count)
        self.hit_sound = arcade.sound.load_sound(
            ":resources:sounds/explosion2.wav")

        self.player_list = None

        # Set up the player
        self.player_sprite = None
        self.physics_engine = None
        self.view_left = 0
        self.view_bottom = 0
        self.end_of_map = 0
        self.game_over = False

        # Start 'state' will be showing the first page of instructions.
        self.current_state = INSTRUCTIONS_PAGE_0
        self.instructions = []
        texture = arcade.load_texture("game_over_PNG57.png")
        self.instructions.append(texture)

        texture = arcade.load_texture("275-2755358_play-again-button-png-clip-art.png")
        self.instructions.append(texture)
Exemplo n.º 21
0
    def explosion(self):
        # Pre-load the animation frames. We don't do this in the __init__
        # of the explosion sprite because it
        # takes too long and would cause the game to pause.
        self.explosion_texture_list = []

        columns = 16
        count = 60
        sprite_width = 256
        sprite_height = 256
        file_name = ":resources:images/spritesheets/explosion.png"

        # Load the explosions from a sprite sheet
        self.explosion_texture_list = arcade.load_spritesheet(
            file_name, sprite_width, sprite_height, columns, count)
Exemplo n.º 22
0
    def attack(self):
        # Pre-load the animation frames. We don't do this in the __init__
        # of the explosion sprite because it
        # takes too long and would cause the game to pause.
        self.attack_texture_list = []

        columns = 5
        count = 25
        sprite_width = 200
        sprite_height = 200
        file_name = "planning/assets/sprites/sword_attack.png"

        # Load the explosions from a sprite sheet
        self.attack_texture_list = arcade.load_spritesheet(
            file_name, sprite_width, sprite_height, columns, count)
Exemplo n.º 23
0
    def __init__(self):
        super().__init__()
        """La biblioteca "os" permite localizar archivos lo que permmite importar imagenes mas facilmente"""
        file_path = os.path.dirname(os.path.abspath(__file__))
        os.chdir(file_path)

        self.frame_count = 0

        self.nave_list = arcade.SpriteList()
        self.enemy_list = arcade.SpriteList()
        self.bullet_list = arcade.SpriteList()
        self.nave_sprite = arcade.SpriteList()
        self.explosions_list = arcade.SpriteList()
        self.enemybullet_list = arcade.SpriteList()
        self.background1 = arcade.load_texture(
            "C:/Users/Revij/PycharmProjects/Ejemplo/Fondos/FondoMarino.jpg")
        self.background2 = arcade.load_texture(
            "C:/Users/Revij/PycharmProjects/Ejemplo/Fondos/FondoEstelar.jpg")
        self.score = 0
        self.Vidas = 3
        self.nivel = 1
        self.time_taken = 0
        self.liston = []
        self.listado = []
        self.nivel_1()
        self.nave_sprite = nave("Sprites/nave.png", SPRITE_SCALING_NAVE)
        self.nave_sprite.center_x = 600
        self.nave_sprite.center_y = 75
        self.nave_list.append(self.nave_sprite)

        self.left_pressed = False
        self.right_pressed = False
        self.up_pressed = False
        self.down_pressed = False
        """Tamaño de la explosion cuando derribas una nave"""
        self.explosion_texture_list = []
        columns = 16
        count = 60
        sprite_width = 256
        sprite_height = 256
        explosion = ":resources:images/spritesheets/explosion.png"
        self.explosion_texture_list = arcade.load_spritesheet(
            explosion, sprite_width, sprite_height, columns, count)

        self.gun_sound = arcade.load_sound(":resources:sounds/hurt5.wav")
        self.hit_sound = arcade.load_sound(":resources:sounds/hit5.wav")

        arcade.set_background_color(arcade.color.BLACK)
Exemplo n.º 24
0
    def _loadFirePhaserTextures(self) -> TextureList:

        nColumns: int = 3
        tileCount: int = 17
        spriteWidth: int = 231
        spriteHeight: int = 134
        bareFileName: str = f'PhaserSpriteSheet.png'
        fqFileName: str = LocateResources.getResourcesPath(
            resourcePackageName=LocateResources.IMAGE_RESOURCES_PACKAGE_NAME,
            bareFileName=bareFileName)

        textureList: TextureList = cast(
            TextureList,
            load_spritesheet(fqFileName, spriteWidth, spriteHeight, nColumns,
                             tileCount))

        return textureList
Exemplo n.º 25
0
    def __init__(self):
        super().__init__()

        # background image will be stored in here
        self.background = None

        # initiate the frame count here
        self.frame_count = 0

        # variables that will hold sprite lists
        self.player_list = None
        self.bullet_list = None
        self.enemy_list = None
        self.explosions_list = None

        # set up the player info
        self.player_sprite = None
        self.score = 0

        # track the state of which key is pressed
        self.left_pressed = False
        self.right_pressed = False
        self.up_pressed = False
        self.down_pressed = False

        # preload the animation frames
        self.explosion_texture_list = []

        columns = 16
        count = 60
        sprite_width = 256
        sprite_height = 256
        file_name = ":resources:images/spritesheets/explosion.png"

        # load explosions from a sprite sheet
        self.explosion_texture_list = arcade.load_spritesheet(
            file_name, sprite_width, sprite_height, columns, count)

        #add gun sounds here
        """
        self.gun_sound = arcade.load_sound( "some resource" )
        self.hit_sound = arcade.load_sound( "some resource" )
        """

        # sets the background color
        arcade.set_background_color(arcade.color.AMAZON)
Exemplo n.º 26
0
    def __init__(self):
        """ Declares variables for the GameView class
        Args:
            self (Gameview): an instance of Gameview
        Contributors:
            Reed Hunsaker
            Adrianna Lund
            Isabel Aranguren
            Jordan McIntyre
            Juliano Nascimiento
        """
        super().__init__()

        self._score = Score()
        self.texture = arcade.load_texture(constants.BACKGROUND)
        self.game_ending = False
        self.name = ""

        # physics engines
        self.physics_engine = None
        self.physics_engine2 = None
        self.physics_engine3 = None
        self.physics_engine4 = None

        # sprite lists
        self.bullet_list = None
        self.explosions_list = None
        self.explosion_texture_list = []

        # sounds
        self.powerup_sound = arcade.load_sound(constants.POWERUPS_SOUND)
        self.powerdown_sound = arcade.load_sound(constants.POWERDOWN_SOUND)
        self.tank_explode = arcade.load_sound(constants.EXPLOSION_SOUND)

        # explosion details
        self.columns = 16
        self.count = 8
        self.sprite_width = 256
        self.sprite_height = 256
        self.file_name = ":resources:images/spritesheets/explosion.png"
        self.explosion_texture_list = arcade.load_spritesheet(
            self.file_name, self.sprite_width, self.sprite_height,
            self.columns, self.count)
Exemplo n.º 27
0
    def __init__(self):
        """ Initializer """
        # Call the parent class initializer
        super().__init__()

        file_path = os.path.dirname(os.path.abspath(__file__))
        os.chdir(file_path)

        # Variables that will hold sprite lists
        self.frame_count = 0
        self.player_list = None
        self.enemy_list = None
        self.island_list = None
        self.background_map = None
        self.bullet_list = None
        self.bullet_player_list = None
        self.logo = None

        # Set up the player info
        self.player_sprite = None
        self.score = 0

        # Don't show the mouse cursor
        self.window.set_mouse_visible(False)

        arcade.set_background_color(arcade.color.AQUA)

        # of the explosion sprite because it
        # takes too long and would cause the game to pause.
        self.explosion_texture_list = []

        columns = 16
        count = 60
        sprite_width = 256
        sprite_height = 256
        file_name = ":resources:images/spritesheets/explosion.png"

        # Load the explosions from a sprite sheet
        self.explosion_texture_list = arcade.load_spritesheet(file_name, sprite_width, sprite_height, columns, count)

        # Used to keep track of our scrolling
        self.view_bottom = 0
        self.view_left = 0
Exemplo n.º 28
0
def get_tile_set(img, tile_size):
    """
    読み込んだタイルセットイメージからtile_sizeに従って一つずつ画像オブジェクトに変換する
    null_tileがTrueならタイルセットイメージの空白部分を取り除くようにがんばる(?)
    """
    tile_img = arcade.load_texture(img)
    # print(f"タイルセットの画像サイズ, {tile_img.width} x {tile_img.height}")
    tile_column = tile_img.width // tile_size
    # print("列のタイル数", tile_column)
    tile_count = (tile_img.height // tile_size) * tile_column
    # print("暫定タイルの数", tile_count)
    textures = arcade.load_spritesheet(img, tile_size, tile_size, tile_column,
                                       tile_count)

    # 空白タイルを取り除く
    textures = [i for i in textures if i.image.getbbox()]

    # print("タイル総数:", len(textures), type(textures[0]), textures[0].width)

    return textures
Exemplo n.º 29
0
    def __init__(self, width, height, title):
        super().__init__(width, height, title)

        arcade.set_background_color(arcade.color.AMAZON)

        self.texture = arcade.load_texture(":resources:images/space_shooter/playerShip1_orange.png")
        assert self.texture.width == 99
        assert self.texture.height == 75

        self.circle_texture = arcade.make_circle_texture(10, arcade.color.RED)
        self.soft_circle_texture = arcade.make_soft_circle_texture(10, arcade.color.RED, 255, 0)
        self.soft_square_texture = arcade.make_soft_square_texture(10, arcade.color.RED, 255, 0)

        columns = 16
        count = 60
        sprite_width = 256
        sprite_height = 256
        file_name = ":resources:images/spritesheets/explosion.png"

        # Load the explosions from a sprite sheet
        self.explosion_texture_list = arcade.load_spritesheet(file_name, sprite_width, sprite_height, columns, count)
Exemplo n.º 30
0
    def _loadPhotonTorpedoExplosions(self) -> TextureList:
        """
        Cache the torpedo explosion textures

        Returns:  The texture list
        """
        nColumns: int = 8
        tileCount: int = 21
        spriteWidth: int = 128
        spriteHeight: int = 128
        bareFileName: str = f'PhotonTorpedoExplosionSpriteSheet.png'
        fqFileName: str = LocateResources.getResourcesPath(
            resourcePackageName=LocateResources.IMAGE_RESOURCES_PACKAGE_NAME,
            bareFileName=bareFileName)

        explosions: TextureList = cast(
            TextureList,
            load_spritesheet(fqFileName, spriteWidth, spriteHeight, nColumns,
                             tileCount))

        return explosions