Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, width, height, title):
super().__init__(width, height, title)
arcade.set_background_color(arcade.color.AMAZON)
# 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
# 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.AMAZON)
self.coin_list = None
# Set up the player info
self.player_sprite = None
self.score = 0
# Don't show the mouse cursor
self.set_mouse_visible(False)
self.processing_time = 0
self.draw_time = 0
self.frame_count = 0
self.fps_start_timer = None
self.fps = None
arcade.set_background_color(arcade.color.AMAZON)
""" Initializer """
# Call the parent class initializer
super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, "Sprite Example")
# Variables that will hold sprite lists
self.player_list = None
self.coin_list = None
# 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.AMAZON)
def __init__(self):
""" Initializer """
# Call the parent class initializer
super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, "Shape Demo")
self.rect1 = arcade.create_rectangle_filled(100, 100, 50, 50, arcade.color.AFRICAN_VIOLET)
self.rect2 = arcade.create_rectangle_filled(200, 200, 50, 50, arcade.color.RADICAL_RED)
self.rect3 = arcade.create_rectangle_filled(300, 300, 50, 50, arcade.color.ALLOY_ORANGE)
self.line1 = arcade.create_line(400, 400, 500, 500, arcade.color.ASH_GREY, 10)
arcade.set_background_color(arcade.color.AMAZON)
self.all_sprites_list.append(wall)
self.wall_list.append(wall)
# Create a column of boxes
for y in range(273, 500, 64):
wall = arcade.Sprite("images/boxCrate_double.png", SPRITE_SCALING)
wall.center_x = 465
wall.center_y = y
self.all_sprites_list.append(wall)
self.wall_list.append(wall)
self.physics_engine = arcade.PhysicsEngineSimple(self.player_sprite,
self.wall_list)
# Set the background color
arcade.set_background_color(arcade.color.AMAZON)
os.chdir(file_path)
# Variables that will hold sprite lists
self.player_list = None
self.coin_list = None
# Set up the player info
self.player_sprite = None
# Set up sprite that will serve as trigger
self.trigger_sprite = None
# Don't show the mouse cursor
self.set_mouse_visible(False)
arcade.set_background_color(arcade.color.AMAZON)
""" Initializer """
# Call the parent class initializer
super().__init__(SCREEN_WIDTH, SCREEN_HEIGHT, "Sprite Example")
# Variables that will hold sprite lists
self.player_list = None
self.coin_list = None
# 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.AMAZON)
wall = arcade.Sprite("grassRight.png", SPRITE_SCALING)
if item >= 0:
# Calculate where the sprite goes
wall.left = column_index * 64
wall.top = (7 - row_index) * 64
# Add the sprite
self.wall_list.append(wall)
self.physics_engine = arcade.PhysicsEnginePlatformer(self.player_sprite,
self.wall_list,
gravity_constant=GRAVITY)
# Set the background color
arcade.set_background_color(arcade.color.AMAZON)
# Set the view port boundaries
# These numbers set where we have 'scrolled' to.
self.view_left = 0
self.view_bottom = 0
maze = make_maze_depth_first(MAZE_WIDTH, MAZE_HEIGHT)
# -- Set up several columns of walls
for row in range(MAZE_HEIGHT):
for column in range(MAZE_WIDTH):
if maze[row][column]:
wall = arcade.Sprite("images/boxCrate_double.png", SPRITE_SCALING)
wall.center_x = column * SPRITE_SIZE
wall.center_y = row * SPRITE_SIZE
self.all_sprites_list.append(wall)
self.wall_list.append(wall)
self.physics_engine = arcade.PhysicsEngineSimple(self.player_sprite, self.wall_list)
# Set the background color
arcade.set_background_color(arcade.color.AMAZON)
# Set the viewport boundaries
# These numbers set where we have 'scrolled' to.
self.view_left = 0
self.view_bottom = 0
print(f"Total wall blocks: {len(self.wall_list)}")