diff --git a/top-python-game-engines/arcade/arcade_basic.py b/top-python-game-engines/arcade/arcade_basic.py index 2302f24faf..a250b0ad0f 100644 --- a/top-python-game-engines/arcade/arcade_basic.py +++ b/top-python-game-engines/arcade/arcade_basic.py @@ -40,7 +40,7 @@ def on_draw(self): """Called once per frame to render everything on the screen""" # Start rendering - arcade.start_render() + self.clear() # Draw a blue circle with a radius of 50 in the center of the screen arcade.draw_circle_filled( @@ -52,7 +52,7 @@ def on_draw(self): ) # Draw a red-outlined square in the top-left corner of the screen - arcade.draw_lrtb_rectangle_outline( + arcade.draw_lrbt_rectangle_outline( left=50, top=HEIGHT - 50, bottom=HEIGHT - 100, @@ -64,8 +64,8 @@ def on_draw(self): # Draw an orange caption along the bottom in 60-point font arcade.draw_text( text="Hello, World! From Arcade!", - start_x=100, - start_y=50, + x=100, + y=50, font_size=28, color=arcade.color.ORANGE, ) diff --git a/top-python-game-engines/arcade/arcade_game.py b/top-python-game-engines/arcade/arcade_game.py index 61975b349f..296423ef56 100644 --- a/top-python-game-engines/arcade/arcade_game.py +++ b/top-python-game-engines/arcade/arcade_game.py @@ -72,7 +72,7 @@ def setup(self): # Set up the player sprite_image = ASSETS_PATH / "images" / "alien_green_stand.png" self.player = arcade.Sprite( - filename=sprite_image, center_x=WIDTH // 2, center_y=HEIGHT // 2 + sprite_image, center_x=WIDTH // 2, center_y=HEIGHT // 2 ) # Spawn a new coin @@ -95,7 +95,7 @@ def add_coin(self, dt: float): # Create a new coin coin_image = ASSETS_PATH / "images" / "coin_gold.png" new_coin = arcade.Sprite( - filename=coin_image, + coin_image, center_x=randint(20, WIDTH - 20), center_y=randint(20, HEIGHT - 20), ) @@ -131,8 +131,8 @@ def on_mouse_motion(self, x: float, y: float, dx: float, dy: float): """ # Ensure the player doesn't move off-screen - self.player.center_x = arcade.clamp(x, 0, WIDTH) - self.player.center_y = arcade.clamp(y, 0, HEIGHT) + self.player.center_x = arcade.math.clamp(x, 0, WIDTH) + self.player.center_y = arcade.math.clamp(y, 0, HEIGHT) def on_update(self, delta_time: float): """Update all the game objects @@ -172,19 +172,19 @@ def on_draw(self): """Draw everything""" # Start the rendering pass - arcade.start_render() + self.clear() # Draw the coins self.coins.draw() # Draw the player - self.player.draw() + arcade.draw_sprite(self.player) # Draw the score in the lower-left corner arcade.draw_text( text=f"Score: {self.score}", - start_x=50, - start_y=50, + x=50, + y=50, font_size=32, color=arcade.color.BLACK, ) diff --git a/top-python-game-engines/requirements.txt b/top-python-game-engines/requirements.txt index 4c3151f615..06f2d0bb8a 100644 --- a/top-python-game-engines/requirements.txt +++ b/top-python-game-engines/requirements.txt @@ -1,4 +1,4 @@ adventurelib==1.2.1 -arcade==2.6.10 +arcade==3.3.3 pgzero==1.2.1 -pygame==2.1.2 +pygame==2.6.1