arxivgpt kim commited on
Commit
811a908
Β·
verified Β·
1 Parent(s): f4b5eba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -2,12 +2,16 @@ import pygame
2
  import random
3
  import sys
4
 
 
 
 
 
5
  pygame.init()
6
 
7
  # κ²Œμž„ ν™”λ©΄ μ„€μ •
8
  screen_width, screen_height = 800, 600
9
  screen = pygame.display.set_mode((screen_width, screen_height))
10
- pygame.display.set_caption("Cat Ball Game") # μˆ˜μ •λ¨
11
 
12
  # 색상 μ„€μ •
13
  colors = [(255, 0, 0), (0, 255, 0), (0, 0, 255)]
@@ -41,12 +45,7 @@ def remove_ball(pos):
41
  distance = ((ball[0] - pos[0]) ** 2 + (ball[1] - pos[1]) ** 2) ** 0.5
42
  if distance < 20:
43
  balls.remove(ball)
44
- x = random.randint(20, screen_width - 20)
45
- y = random.randint(20, screen_height - 20)
46
- vx, vy = random.choice([-5, -4, -3, 3, 4, 5]), random.choice([-5, -4, -3, 3, 4, 5])
47
- color = random.choice(colors)
48
- balls.append([x, y, vx, vy, color])
49
- break
50
 
51
  running = True
52
  while running:
 
2
  import random
3
  import sys
4
 
5
+ # μ˜€λ””μ˜€ λͺ¨λ“ˆ λΉ„ν™œμ„±ν™”
6
+ pygame.mixer.quit()
7
+
8
+ # pygame μ΄ˆκΈ°ν™”
9
  pygame.init()
10
 
11
  # κ²Œμž„ ν™”λ©΄ μ„€μ •
12
  screen_width, screen_height = 800, 600
13
  screen = pygame.display.set_mode((screen_width, screen_height))
14
+ pygame.display.set_caption("Cat Ball Game")
15
 
16
  # 색상 μ„€μ •
17
  colors = [(255, 0, 0), (0, 255, 0), (0, 0, 255)]
 
45
  distance = ((ball[0] - pos[0]) ** 2 + (ball[1] - pos[1]) ** 2) ** 0.5
46
  if distance < 20:
47
  balls.remove(ball)
48
+ break # 곡이 제거된 ν›„ μƒˆ 곡을 μΆ”κ°€ν•˜μ§€ μ•ŠμŒ
 
 
 
 
 
49
 
50
  running = True
51
  while running: