arxivgpt kim commited on
Update app.py
Browse files
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 |
-
|
| 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:
|