2024-06-09 09:43:29 发布
网友
我想知道如何在屏幕上移动一个点。就像经典的蠕虫游戏。 选择的键是w代表上s下a代表左,d代表右。 我使用的是python2.5.4
另外,我是一条Python
您可以从pygame使用!在
this是由pygame制作的简单的蛇游戏!在
或者使用以下代码:
import sys, pygame pygame.init() size = width, height = 800, 400 screen = pygame.display.set_mode(size) position=[20,20] white=[255,255,255] while True: for event in pygame.event.get(): if event.type == pygame.QUIT: loop=False if event.type==pygame.KEYDOWN: if event.key==pygame.D_KEY: position[0]+=20 screen.fill(white) pygame.draw.circle(screen,[255,0,0],position,100,3) pygame.display.flip() pygame.quit()
您可以从pygame使用!在
this是由pygame制作的简单的蛇游戏!在
或者使用以下代码:
相关问题 更多 >
编程相关推荐