Python设计游戏看哪个能先走第17步?

例子介绍游戏,蜗牛爬墙

示例截图

核心代码

速度=

turtle _ right = py game . transform . rotate(turtle,90)

turtle _ top = py game . transform . rotate(turtle,180)

turtle _ left = py game . transform . rotate(turtle,270)

turtle _ bottom =乌龟

turtle=turtle_top

虽然正确:

对于pygame.event.get()中的事件:

如果event.type==QUIT:

sys.exit()

position=position.move(速度)

if position.right & gt宽度:

乌龟=乌龟_对

position = turtle _ rect = turtle . get _ rect()

position.left =宽度-turtle_rect .宽度

速度=

if position.bottom & gt高度:

龟=龟_底

position = turtle _ rect = turtle . get _ rect()

position.left =宽度-turtle_rect .宽度

position . top = height-turtle _ rect . height

速度=

if position.left & lt0:

乌龟=乌龟_左

position = turtle _ rect = turtle . get _ rect()

position . top = height-turtle _ rect . height

速度=[0,-5]

if position.top & lt0:

turtle=turtle_top

position = turtle _ rect = turtle . get _ rect()

速度=

屏幕填充(背景)

screen.blit(海龟,位置)

pygame.display.flip()

时钟.滴答(30)