@@ -25,8 +25,8 @@ class Snowflake(arcade.SpriteCircle):
2525 Based on drawing filled-circles.
2626 """
2727
28- def __init__ (self , size , speed , drift ):
29- super ().__init__ (size , arcade .color .WHITE )
28+ def __init__ (self , size , speed , drift , center_x : float = 0 , center_y : float = 0 ):
29+ super ().__init__ (size , arcade .color .WHITE , center_x = center_x , center_y = center_y )
3030 self .speed = speed
3131 self .drift = drift
3232
@@ -37,7 +37,7 @@ def reset_pos(self):
3737 random .randrange (WINDOW_HEIGHT , WINDOW_HEIGHT + 100 ),
3838 )
3939
40- def update (self , delta_time : float = 1 / 60 ) -> None :
40+ def update (self , delta_time : float = 1 / 60 ) -> None :
4141 self .center_y -= self .speed * delta_time
4242
4343 # Check if snowflake has fallen below screen
@@ -50,10 +50,10 @@ def update(self, delta_time: float = 1/60) -> None:
5050
5151
5252class GameView (arcade .View ):
53- """ Main application class. """
53+ """Main application class."""
5454
5555 def __init__ (self ):
56- """ Initializer """
56+ """Initializer"""
5757 # Calls "__init__" of parent class (arcade.Window) to setup screen
5858 super ().__init__ ()
5959
@@ -66,38 +66,36 @@ def __init__(self):
6666 self .background_color = arcade .color .BLACK
6767
6868 def start_snowfall (self ):
69- """ Set up snowfall and initialize variables. """
69+ """Set up snowfall and initialize variables."""
7070 for i in range (SNOWFLAKE_COUNT ):
7171 # Create snowflake instance
7272 snowflake = Snowflake (
7373 size = random .randrange (1 , 4 ),
7474 speed = random .randrange (20 , 40 ),
7575 drift = random .uniform (math .pi , math .pi * 2 ),
76- )
77- # Randomly position snowflake
78- snowflake .position = (
79- random .randrange (WINDOW_WIDTH ),
80- random .randrange (WINDOW_HEIGHT + 200 ),
76+ # Randomly position snowflake
77+ center_x = random .randrange (WINDOW_WIDTH ),
78+ center_y = random .randrange (WINDOW_HEIGHT + 200 ),
8179 )
8280 # Add snowflake to snowflake list
8381 self .snowflake_list .append (snowflake )
8482
8583 def on_draw (self ):
86- """ Render the screen. """
84+ """Render the screen."""
8785 # Clear the screen to the background color
8886 self .clear ()
8987
9088 # Draw the current position of each snowflake
9189 self .snowflake_list .draw ()
9290
9391 def on_update (self , delta_time ):
94- """ All the logic to move, and the game logic goes here. """
92+ """All the logic to move, and the game logic goes here."""
9593 # Call update on all the snowflakes
9694 self .snowflake_list .update (delta_time )
9795
9896
9997def main ():
100- """ Main function """
98+ """Main function"""
10199 # Create a window class. This is what actually shows up on screen
102100 window = arcade .Window (WINDOW_WIDTH , WINDOW_HEIGHT , WINDOW_TITLE )
103101
0 commit comments