Commit f4cdd193 by BellCodeEditor

save project

parent 376ab963
Showing with 4 additions and 2 deletions
...@@ -10,6 +10,8 @@ right = pygame.image.load('right.png') #头 朝右 ...@@ -10,6 +10,8 @@ right = pygame.image.load('right.png') #头 朝右
food = pygame.image.load('apple.png') #食物 苹果 food = pygame.image.load('apple.png') #食物 苹果
body = pygame.image.load('body.png') body = pygame.image.load('body.png')
x,y = 240,120 #初始化贪吃蛇的头的坐标
# 创建一个窗口 # 创建一个窗口
screen=pygame.display.set_mode((660,480)) screen=pygame.display.set_mode((660,480))
...@@ -18,11 +20,11 @@ while True: ...@@ -18,11 +20,11 @@ while True:
if event.type == locals.QUIT: if event.type == locals.QUIT:
#接收到退出事件后退出程序 #接收到退出事件后退出程序
exit() exit()
x += 30
#将背景图画上去 #将背景图画上去
screen.blit(background,(0,0)) screen.blit(background,(0,0))
#将贪吃蛇画上去 #将贪吃蛇画上去
screen.blit(right,(240,120)) screen.blit(right,(x,y))
#将身体画上去 #将身体画上去
screen.blit(body,(210,120)) screen.blit(body,(210,120))
screen.blit(body,(180,120)) screen.blit(body,(180,120))
......
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