Fix insanely stupid logic

This commit is contained in:
Lncvrt committed 2024-12-13 22:46:58 -07:00
1 parent f2fe855b51
commit f09eb860eb
1 file changed
+3 -6
+3 -6
View File
@@ -92,7 +92,6 @@ food_y = 0
score = 1 score = 1
draw_hitboxes = False draw_hitboxes = False
auto_mode = False auto_mode = False
auto_key = 0
auto_color_change_interval = 100 auto_color_change_interval = 100
auto_color_change_timer = pygame.time.get_ticks() auto_color_change_timer = pygame.time.get_ticks()
@@ -169,7 +168,7 @@ def check_collision():
return False return False
def game_loop(): def game_loop():
global score, player_x, food_x, food_y, draw_hitboxes, auto_mode, auto_key, player_image, flipped global score, player_x, food_x, food_y, draw_hitboxes, auto_mode, player_image, flipped
dt = clock.tick(60) / 1000.0 dt = clock.tick(60) / 1000.0
@@ -186,20 +185,18 @@ def game_loop():
if event.key == pygame.K_h: if event.key == pygame.K_h:
draw_hitboxes = not draw_hitboxes draw_hitboxes = not draw_hitboxes
elif event.key == pygame.K_j: elif event.key == pygame.K_j:
auto_key += 1 if not auto_mode:
if auto_key == 3:
player_x = (WIDTH - player_width) // 2 player_x = (WIDTH - player_width) // 2
food_x = random.randint(0, WIDTH - food_width) food_x = random.randint(0, WIDTH - food_width)
food_y = 0 food_y = 0
score = "Auto" score = "Auto"
auto_mode = True auto_mode = True
elif auto_key == 4: else:
score = 1 score = 1
player_x = (WIDTH - player_width) // 2 player_x = (WIDTH - player_width) // 2
food_x = random.randint(0, WIDTH - food_width) food_x = random.randint(0, WIDTH - food_width)
food_y = 0 food_y = 0
auto_mode = False auto_mode = False
auto_key = 0
if not auto_mode: if not auto_mode:
keys = pygame.key.get_pressed() keys = pygame.key.get_pressed()