How to use the arcade.load_texture function in arcade

To help you get started, we’ve selected a few arcade examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pvcraven / arcade / tests / unit2 / test_textured_rects.py View on Github external
def __init__(self, width, height, title):
        super().__init__(width, height, title)

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

        arcade.set_background_color(arcade.color.AMAZON)

        self.texture = arcade.load_texture(":resources:images/space_shooter/playerShip1_orange.png")
github pvcraven / arcade / tests / unit2 / test_load_textures.py View on Github external
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()

        self.player.stand_right_textures = [arcade.load_texture(":resources:images/animated_characters/robot/robot_idle.png")]

        self.player.stand_left_textures = [arcade.load_texture(":resources:images/animated_characters/robot/robot_idle.png", mirrored=True)]

        self.player.walk_right_textures = [arcade.load_texture(":resources:images/animated_characters/robot/robot_walk0.png"),
                                           arcade.load_texture(":resources:images/animated_characters/robot/robot_walk1.png"),
                                           arcade.load_texture(":resources:images/animated_characters/robot/robot_walk2.png"),
                                           arcade.load_texture(":resources:images/animated_characters/robot/robot_walk3.png"),
                                           arcade.load_texture(":resources:images/animated_characters/robot/robot_walk4.png"),
                                           arcade.load_texture(":resources:images/animated_characters/robot/robot_walk5.png"),
                                           arcade.load_texture(":resources:images/animated_characters/robot/robot_walk6.png"),
                                           arcade.load_texture(":resources:images/animated_characters/robot/robot_walk7.png")]

        self.player.walk_left_textures = [arcade.load_texture(":resources:images/animated_characters/robot/robot_walk0.png", mirrored=True),
                                          arcade.load_texture(":resources:images/animated_characters/robot/robot_walk1.png", mirrored=True),
                                          arcade.load_texture(":resources:images/animated_characters/robot/robot_walk2.png", mirrored=True),
                                          arcade.load_texture(":resources:images/animated_characters/robot/robot_walk3.png", mirrored=True),
                                          arcade.load_texture(":resources:images/animated_characters/robot/robot_walk4.png", mirrored=True),
                                          arcade.load_texture(":resources:images/animated_characters/robot/robot_walk5.png", mirrored=True),
                                          arcade.load_texture(":resources:images/animated_characters/robot/robot_walk6.png", mirrored=True),
                                          arcade.load_texture(":resources:images/animated_characters/robot/robot_walk7.png", mirrored=True)]
github pvcraven / arcade / examples / sprite_change_coins.py View on Github external
# Call update on all sprites (The sprites don't do much in this
        # example though.)
        self.all_sprites_list.update()

        # Generate a list of all sprites that collided with the player.
        hit_list = \
            arcade.check_for_collision_with_list(self.player_sprite,
                                                 self.coin_list)

        # Loop through each colliding sprite, change it, and add to the score.
        for coin in hit_list:
            # Have we collected this?
            if not coin.changed:
                # No? Then do so
                coin.texture = arcade.load_texture("images/bumper.png")
                coin.changed = True
                coin.width = 30
                coin.height = 30
                self.score += 1
github PdxCodeGuild / 20180116-FullStack-Day / Code / Anna / python / space_adventure / adventure_minigame.py View on Github external
# Set up the player info
        self.player_sprite = None
        self.score = 0

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

        arcade.set_background_color(arcade.color.BLACK)

        # STEP 1: Put each instruction page in an image. Make sure the image
        # matches the dimensions of the window, or it will stretch and look
        # ugly. You can also do something similar if you want a page between
        # each level.
        self.instructions = []
        texture = arcade.load_texture("backgrounds/instructions_0.png")
        self.instructions.append(texture)

        texture = arcade.load_texture("backgrounds/instructions_1.png")
        self.instructions.append(texture)

        self.total_time = 0.0
github pvcraven / arcade / arcade / examples / sprite_face_left_or_right.py View on Github external
def __init__(self):
        super().__init__()

        # Load a left facing texture and a right facing texture.
        # mirrored=True will mirror the image we load.
        texture = arcade.load_texture(":resources:images/animated_characters/female_person/femalePerson_idle.png", mirrored=True, scale=SPRITE_SCALING)
        self.textures.append(texture)
        texture = arcade.load_texture(":resources:images/animated_characters/female_person/femalePerson_idle.png", scale=SPRITE_SCALING)
        self.textures.append(texture)

        # By default, face right.
        self.set_texture(TEXTURE_RIGHT)
github pvcraven / arcade / arcade / gui.py View on Github external
def add_window_texture(self, window_texture):
        self.window_texture = arcade.load_texture(window_texture)
github pvcraven / arcade / arcade / gui.py View on Github external
def add_dialogue_box_texture(self, dialogue_box_texture):
        self.dialogue_box_texture = arcade.load_texture(dialogue_box_texture)
github pvcraven / arcade / arcade / examples / sprite_change_coins.py View on Github external
""" Movement and game logic """

        # Call update on all sprites (The sprites don't do much in this
        # example though.)
        self.player_list.update()
        self.coin_list.update()

        # Generate a list of all sprites that collided with the player.
        hit_list = arcade.check_for_collision_with_list(self.player_sprite, self.coin_list)

        # Loop through each colliding sprite, change it, and add to the score.
        for coin in hit_list:
            # Have we collected this?
            if not coin.changed:
                # No? Then do so
                coin.append_texture(arcade.load_texture(":resources:images/pinball/bumper.png"))
                coin.set_texture(1)
                coin.changed = True
                coin.width = 30
                coin.height = 30
                self.score += 1
github pvcraven / arcade / arcade / examples / drawing_primitives.py View on Github external
# Draw an rectangle outline
arcade.draw_text("draw_rect", 243, 3, arcade.color.BLACK, 10)
arcade.draw_rectangle_outline(295, 100, 45, 65,
                              arcade.color.BRITISH_RACING_GREEN)
arcade.draw_rectangle_outline(295, 160, 20, 45,
                              arcade.color.BRITISH_RACING_GREEN, 3, 45)

# Draw a filled in rectangle
arcade.draw_text("draw_filled_rect", 363, 3, arcade.color.BLACK, 10)
arcade.draw_rectangle_filled(420, 100, 45, 65, arcade.color.BLUSH)
arcade.draw_rectangle_filled(420, 160, 20, 40, arcade.color.BLUSH, 45)

# Load and draw an image to the screen
# Image from kenney.nl asset pack #1
arcade.draw_text("draw_bitmap", 483, 3, arcade.color.BLACK, 12)
texture = arcade.load_texture(":resources:images/space_shooter/playerShip1_orange.png")
scale = .6
arcade.draw_texture_rectangle(540, 120, scale * texture.width,
                              scale * texture.height, texture, 0)
arcade.draw_texture_rectangle(540, 60, scale * texture.width,
                              scale * texture.height, texture, 45)

# Finish the render.
# Nothing will be drawn without this.
# Must happen after all draw commands
arcade.finish_render()

# Keep the window up until someone closes it.
arcade.run()
github pvcraven / arcade / examples / sprite_move_animation.py View on Github external
# Set up the player
        self.score = 0
        self.player = arcade.AnimatedWalkingSprite()

        character_scale = 0.75
        self.player.stand_right_textures = []
        self.player.stand_right_textures.append(arcade.load_texture("images/character_sprites/character0.png",
                                                                    scale=character_scale))
        self.player.stand_left_textures = []
        self.player.stand_left_textures.append(arcade.load_texture("images/character_sprites/character0.png",
                                                                   scale=character_scale, mirrored=True))

        self.player.walk_right_textures = []

        self.player.walk_right_textures.append(arcade.load_texture("images/character_sprites/characterw0.png",
                                                                   scale=character_scale))
        self.player.walk_right_textures.append(arcade.load_texture("images/character_sprites/characterw1.png",
                                                                   scale=character_scale))
        self.player.walk_right_textures.append(arcade.load_texture("images/character_sprites/characterw2.png",
                                                                   scale=character_scale))
        self.player.walk_right_textures.append(arcade.load_texture("images/character_sprites/characterw3.png",
                                                                   scale=character_scale))

        self.player.walk_left_textures = []

        self.player.walk_left_textures.append(arcade.load_texture("images/character_sprites/characterw0.png",
                                                                  scale=character_scale, mirrored=True))
        self.player.walk_left_textures.append(arcade.load_texture("images/character_sprites/characterw1.png",
                                                                  scale=character_scale, mirrored=True))
        self.player.walk_left_textures.append(arcade.load_texture("images/character_sprites/characterw2.png",
                                                                  scale=character_scale, mirrored=True))