33
33
try :
34
34
piezo = pwmio .PWMOut (board .D23 , frequency = 440 , duty_cycle = 0 ,
35
35
variable_frequency = True )
36
- except Exception as e :
36
+ except Exception as e : # pylint: disable=broad-except
37
37
print ("Piezo initialization error:" , e )
38
38
piezo = None
39
39
@@ -171,17 +171,18 @@ def check_keys():
171
171
any_key = True
172
172
try :
173
173
key = sys .stdin .read (1 )
174
- if key in ('a' , 'A' ): # Left movement
174
+ if key in ('a' , 'A' ): # Left movement
175
175
l_pressed = True
176
176
elif key in ('d' , 'D' ): # Right movement
177
177
r_pressed = True
178
- elif key == ' ' : # Space for start/launch
178
+ elif key == ' ' : # Space for start/launch
179
179
s_pressed = True
180
- except Exception as e :
180
+ except Exception as e : # pylint: disable=broad-except
181
181
print ("Input error:" , e )
182
182
183
183
return (l_pressed , r_pressed , s_pressed , any_key )
184
184
185
+ # pylint: disable=redefined-outer-name
185
186
def create_game_elements ():
186
187
"""Create and return all game display elements"""
187
188
game_group = displayio .Group ()
@@ -288,7 +289,7 @@ def create_game_elements():
288
289
289
290
def reset_ball ():
290
291
"""Reset the ball position and set it initially stationary"""
291
- global ball_dx , ball_dy , ball_pos_x , ball_pos_y
292
+ global ball_dx , ball_dy , ball_pos_x , ball_pos_y # pylint: disable=global-statement
292
293
ball_pos_x = float (display .width // 2 )
293
294
ball_pos_y = float (display .height - PADDLE_HEIGHT - DISPLAY_LINE - BALL_RADIUS * 3 )
294
295
ball .x = int (ball_pos_x )
@@ -298,7 +299,7 @@ def reset_ball():
298
299
299
300
def launch_ball ():
300
301
"""Launch the ball in a random upward direction"""
301
- global ball_dx , ball_dy , ball_speed
302
+ global ball_dx , ball_dy , ball_speed # pylint: disable=global-statement
302
303
ball_speed = BALL_SPEED_INITIAL
303
304
angle = random .uniform (0.5 , 0.8 ) # Launch at angle between 45-65 degrees
304
305
ball_dx = ball_speed * random .choice ([- angle , angle ])
0 commit comments