import pygame
import random
import time
# python game
# loading... 初始化... 加载中....
pygame.init()
# 界面游戏 dis 分开 play玩 diaplay 展览展示的意思
# set设置 mode模式
chuang_kou = pygame.display.set_mode((500,700))
ballx = 250
bally=350
r,g,b = 125,125,125
banjing = 100
while 1 > 0:
# 控制电脑:按鼠标,按键盘
# 事件 event
for event in pygame.event.get():
print(event)
# type类型
if event.type == pygame.QUIT:
pygame.quit()
chuang_kou.fill((1,1,1))
# ballx = ballx + 1
bally=bally+1
if bally >=700:
bally=0
r=random.randint(0,255)
b = random.randint(0, 255)
g = random.randint(0, 255)
banjing = random.randint(50,150)
# 画一个圆 pygame.draw.circle(窗口, (r,g,b),(x,y),半径)
pygame.draw.circle(chuang_kou,(r,g,b ),(ballx,bally),banjing)
# 刷新 update up向上date日期
# time.sleep(0.1)
pygame.display.update()
junjie -接小球游戏
最新推荐文章于 2020-07-26 10:49:33 发布