Commit 835a97cc by BellCodeEditor

auto save

parent 8b17b65e
Showing with 18 additions and 7 deletions
......@@ -3,8 +3,8 @@ from pygame import locals
# 初始化pygame,为使用硬件做准备
pygame.init()
# 创建一个窗口
heading="right"
k=()
screen = pygame.display.set_mode((660, 480))
kk=pygame.time.Clock()
# 背景
......@@ -18,17 +18,27 @@ while True:
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
# 将背景图画上去
if event.type == locals.KEYDOWN:
if event.KEY == locals.KEY_UP:
heading="up"
if event.KEY == locals.KEY_RIGHT:
heading="right"
if event.KEY == locals.KEY_LEFT:
heading="left"
if event.KEY == locals.KEY_DOWN:
haedng="down"
screen.blit(background, (0, 0))
# 将贪吃蛇画上去
x+=30
screen.blit(right, (x, y))
# 将贪吃蛇的身体画上去
screen.blit(body, (210, 120))
screen.blit(body, (180, 120))
screen.blit(body, (180, 90))
# 将果实画上去
screen.blit(food, (360, 300))
# 刷新画面
for
if heading="left"
if heading="right"
if heading="left"
if heading="left"
pygame.display.update()
kk.tick(3)
\ No newline at end of file
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