Commit 4c52ddd3 by BellCodeEditor

save project

parent 2a143850
Showing with 16 additions and 1 deletions
......@@ -3,7 +3,8 @@ from pygame import locals
FPSCLOCK=pygame.time.Clock()
# 初始化pygame,为使用硬件做准备
pygame.init()
b="right"
h=right
# 创建一个窗口
screen = pygame.display.set_mode((660, 480))
x,y=240,120
......@@ -18,6 +19,20 @@ while True:
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
if event.type==locals.KEYDOWN:
if event.key==locals.K_RIGHT and b!="left":
b="right"
h=right
if event.key==locals.K_LEFT and b!="right":
b="left"
h=left
if event.key==locals.K_UP and b!="down":
b="up"
h=up
if event.key==locals.K_DOWN and b!="up":
b="down"
h=down
x+=30
a.append((x,y))
a.pop(0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment