用户:
永退者查看:0 回复:0 评论:0 创建时间:2021-04-05T21:31:13
你以为两个方块速度不同?按鼠标左键试试
import pgzrun as game
WIDTH = 800
HEIGHT = 400
blackshow = True
x = 0
def draw():
screen.fill("white")
if blackshow:
for y in range(0, 800,40):
box = Rect((y, 0),(20, HEIGHT))
screen.draw.filled_rect(box,"black")
b1 = Rect((x, 100), (80,40))
screen.draw.filled_rect(b1, "light yellow")
b2 = Rect((x, 300), (80, 40))
screen.draw.filled_rect(b2, "blue")
def update():
global x
x += 1
if x >= WIDTH:
x = 0
def on_mouse_down():
global blackshow
blackshow = not blackshow
game.go()