import pygame,time pygame.init() screen = pygame.display.set_mode([900, 700]) pygame.display.est_caption(弹球) red = 255,0,0 black = 0,0,0 x = 10 y = 10 dx = 2 dy = 1 redius = 10 KeepGoing = True whil
时间: 2024-04-12 07:34:19 浏览: 68
Python库 | pygame_easy_menu-0.0.11-py3-none-any.whl
e KeepGoing:
for event in pygame.event.get():
if event.type == pygame.QUIT:
KeepGoing = False
screen.fill(black)
pygame.draw.circle(screen, red, (x, y), radius)
pygame.display.flip()
x += dx
y += dy
if x + radius > 900 or x - radius < 0:
dx *= -1
if y + radius > 700 or y - radius < 0:
dy *= -1
time.sleep(0.01)
pygame.quit()
阅读全文