待实现:出现一连串绿色代码
import pygame
import sys
import time
pygame.init()
screen = pygame.display.set_mode((600,500))
pygame.display.set_caption('猩球大战')
ball_x, ball_y = 300, 250
Down = True
while True:
for event in pygame.event.get():
print(event)
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
elif event.type == pygame.MOUSEMOTION:
ball_x,ball_y = event.pos
screen.fill((255,255,0))
if ball_y >= 450:
Down = False
elif ball_y <= 50:
Down = True
pygame.draw.circle(screen,(2, 20, 200), (ball_x, ball_y), 50)
pygame.display.update()
time.sleep(0.01)
pygame.quit()