@@ -51,7 +51,10 @@ def __init__(self):
5151 self .rect = pygame .Rect
5252
5353 def draw (
54- self , screen : pygame .Surface , color : tuple , specific_rect : pygame .Rect = None
54+ self ,
55+ screen : pygame .Surface ,
56+ color : tuple ,
57+ specific_rect : pygame .Rect = None ,
5558 ):
5659 """
5760 Draws a rectangle onto the screen in the specified color.
@@ -121,10 +124,16 @@ def __init__(self, bottom_tube_height: int):
121124 and TUBEWIDTH variables as dimensions.
122125 """
123126 self .bottom_tube = pygame .Rect (
124- width , height - bottom_tube_height , self .TUBEWIDTH , bottom_tube_height
127+ width ,
128+ height - bottom_tube_height ,
129+ self .TUBEWIDTH ,
130+ bottom_tube_height ,
125131 )
126132 self .top_tube = pygame .Rect (
127- width , 0 , self .TUBEWIDTH , height - bottom_tube_height - self .TUBEGAP
133+ width ,
134+ 0 ,
135+ self .TUBEWIDTH ,
136+ height - bottom_tube_height - self .TUBEGAP ,
128137 )
129138
130139 def draw (self , screen : pygame .Surface ):
@@ -229,8 +238,12 @@ def process_spritesheet(
229238 @param offset_y: int - the y offset before the sprite columns start
230239 """
231240 self .sprites = []
232- self .sprite_frame_width = (spritesheet .get_width () - offset_x ) // num_pics_x
233- self .sprite_frame_height = (spritesheet .get_height () - offset_y ) // num_pics_y
241+ self .sprite_frame_width = (
242+ spritesheet .get_width () - offset_x
243+ ) // num_pics_x
244+ self .sprite_frame_height = (
245+ spritesheet .get_height () - offset_y
246+ ) // num_pics_y
234247 for row in range (num_pics_x ):
235248 for column in range (num_pics_y ):
236249 temp = spritesheet .subsurface (
@@ -255,7 +268,9 @@ def draw(self, screen: pygame.Surface, framecount: int):
255268 # so that it won't be bigger or smaller than the new sprite
256269 self .cur_sprite_idx = curr_sprite_idx
257270 temp = self .sprites [self .cur_sprite_idx ]
258- self .rect = temp .get_rect ().move (self .rect .topleft [0 ], self .rect .topleft [1 ])
271+ self .rect = temp .get_rect ().move (
272+ self .rect .topleft [0 ], self .rect .topleft [1 ]
273+ )
259274 super ().draw (screen , BLACK )
260275
261276 def blit (self , screen : pygame .Surface ):
@@ -332,8 +347,12 @@ def __init__(self):
332347
333348 def create_buttons (self , button1text = "Start Game" , button2bg = RED ):
334349 self .buttons = {
335- "start" : Button (width // 2 , height // 4 , LGREEN , LILAC , button1text ),
336- "quit" : Button (width // 2 , height // 4 * 3 , button2bg , LILAC , "Quit Game" ),
350+ "start" : Button (
351+ width // 2 , height // 4 , LGREEN , LILAC , button1text
352+ ),
353+ "quit" : Button (
354+ width // 2 , height // 4 * 3 , button2bg , LILAC , "Quit Game"
355+ ),
337356 }
338357
339358 def mainloop (self ):
@@ -411,10 +430,15 @@ def create_tubes(self):
411430 """
412431 Creates tubes and puts a coin in the middle of each tube.
413432 """
414- if len (self .tubes ) == 0 or self .tubes [- 1 ].bottom_tube .right < width - 200 :
433+ if (
434+ len (self .tubes ) == 0
435+ or self .tubes [- 1 ].bottom_tube .right < width - 200
436+ ):
415437 bottom_tube_height = random .randint (0 , height - Tubes .TUBEGAP )
416438 self .tubes .append (Tubes (bottom_tube_height ))
417- self .coins .append (Coin (height - bottom_tube_height - (Tubes .TUBEGAP // 2 )))
439+ self .coins .append (
440+ Coin (height - bottom_tube_height - (Tubes .TUBEGAP // 2 ))
441+ )
418442
419443 def draw_all (self ):
420444 # draw bird and coin rectangles before background so that they won't
0 commit comments