pymunk_demo_platformer_03.py Diff

pymunk_demo_platformer_03.py
--- /home/docs/checkouts/readthedocs.org/user_builds/arcade-library/checkouts/stable/doc/tutorials/pymunk_platformer/pymunk_demo_platformer_02.py
+++ /home/docs/checkouts/readthedocs.org/user_builds/arcade-library/checkouts/stable/doc/tutorials/pymunk_platformer/pymunk_demo_platformer_03.py
@@ -1,6 +1,9 @@
 """
 Example of Pymunk Physics Engine Platformer
 """
+
+import math
+from typing import Optional
 import arcade
 
 SCREEN_TITLE = "PyMunk Platformer"
@@ -25,37 +28,53 @@
 
 
 class GameWindow(arcade.Window):
-    """ Main Window """
+    """Main Window"""
 
     def __init__(self, width, height, title):
-        """ Create the variables """
+        """Create the variables"""
 
         # Init the parent class
         super().__init__(width, height, title)
 
+        # Player sprite
+        self.player_sprite: arcade.Sprite | None = None
+
+        # Sprite lists we need
+        self.player_list: arcade.SpriteList | None = None
+        self.wall_list: arcade.SpriteList | None = None
+        self.bullet_list: arcade.SpriteList | None = None
+        self.item_list: arcade.SpriteList | None = None
+
+        # Track the current state of what key is pressed
+        self.left_pressed: bool = False
+        self.right_pressed: bool = False
+
+        # Set background color
+        self.background_color = arcade.color.AMAZON
+
     def setup(self):
-        """ Set up everything with the game """
+        """Set up everything with the game"""
         pass
 
     def on_key_press(self, key, modifiers):
-        """Called whenever a key is pressed. """
+        """Called whenever a key is pressed."""
         pass
 
     def on_key_release(self, key, modifiers):
-        """Called when the user releases a key. """
+        """Called when the user releases a key."""
         pass
 
     def on_update(self, delta_time):
-        """ Movement and game logic """
+        """Movement and game logic"""
         pass
 
     def on_draw(self):
-        """ Draw everything """
+        """Draw everything"""
         self.clear()
 
 
 def main():
-    """ Main function """
+    """Main function"""
     window = GameWindow(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
     window.setup()
     arcade.run()