Skip to content

Commit cb38dd6

Browse files
style: format code with autopep8
Format code with autopep8 This commit fixes the style issues introduced in b25ce3d according to the output from Autopep8. Details: None
1 parent b25ce3d commit cb38dd6

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Infinite Runner with Customizable Obstacles/infinite_runner.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
# Game loop
4343
running = True
4444
clock = pygame.time.Clock()
45-
pygame.mixer.music.play(-1)
45+
pygame.mixer.music.play(-1)
4646

4747
while running:
4848
for event in pygame.event.get():
@@ -82,14 +82,16 @@
8282
obstacles[i] = (obstacle_x, obstacle_y + obstacle_speed)
8383
elif obstacle_type == "tri":
8484
# Triangular obstacle: move diagonally
85-
obstacles[i] = (obstacle_x + obstacle_speed, obstacle_y + obstacle_speed)
85+
obstacles[i] = (obstacle_x + obstacle_speed,
86+
obstacle_y + obstacle_speed)
8687
elif obstacle_type == "circle":
8788
# Rotating circular obstacle: update the angle
8889
angle = 0.1 # Adjust the rotation speed
8990
rotated_obstacle_x = obstacle_x + (obstacle_width // 2)
9091
rotated_obstacle_y = obstacle_y + (obstacle_height // 2)
9192
obstacles[i] = (rotated_obstacle_x - obstacle_width // 2 * math.cos(angle),
92-
rotated_obstacle_y - obstacle_height // 2 * math.sin(angle),
93+
rotated_obstacle_y -
94+
obstacle_height // 2 * math.sin(angle),
9395
"circle")
9496

9597
# Remove obstacles that are off the screen
@@ -114,12 +116,14 @@
114116
screen.fill(WHITE)
115117

116118
# Draw the player
117-
pygame.draw.rect(screen, (0, 0, 255), (player_x, player_y, player_width, player_height))
119+
pygame.draw.rect(screen, (0, 0, 255), (player_x,
120+
player_y, player_width, player_height))
118121

119122
# Draw the obstacles
120123
for obstacle_x, obstacle_y, obstacle_type in obstacles:
121124
if obstacle_type == "rect":
122-
pygame.draw.rect(screen, (255, 0, 0), (obstacle_x, obstacle_y, obstacle_width, obstacle_height))
125+
pygame.draw.rect(screen, (255, 0, 0), (obstacle_x,
126+
obstacle_y, obstacle_width, obstacle_height))
123127
elif obstacle_type == "tri":
124128
pygame.draw.polygon(screen, (0, 255, 0), [(obstacle_x, obstacle_y), (obstacle_x + obstacle_width, obstacle_y),
125129
(obstacle_x + obstacle_width // 2, obstacle_y + obstacle_height)])

0 commit comments

Comments
 (0)