Commit 81c4788c by BellCodeEditor

save project

parent 16f0d60e

2.05 KB | W: | H:

165 Bytes | W: | H:

apple.png
apple.png
apple.png
apple.png
  • 2-up
  • Swipe
  • Onion skin

22.5 KB | W: | H:

6.04 KB | W: | H:

bg.png
bg.png
bg.png
bg.png
  • 2-up
  • Swipe
  • Onion skin

1.4 KB | W: | H:

164 Bytes | W: | H:

body.png
body.png
body.png
body.png
  • 2-up
  • Swipe
  • Onion skin

2.01 KB | W: | H:

162 Bytes | W: | H:

down.png
down.png
down.png
down.png
  • 2-up
  • Swipe
  • Onion skin

2.07 KB | W: | H:

162 Bytes | W: | H:

left.png
left.png
left.png
left.png
  • 2-up
  • Swipe
  • Onion skin

2.05 KB | W: | H:

162 Bytes | W: | H:

right.png
right.png
right.png
right.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -6,6 +6,7 @@ pygame.init() ...@@ -6,6 +6,7 @@ pygame.init()
# 创建一个窗口 # 创建一个窗口
screen = pygame.display.set_mode((660, 480)) screen = pygame.display.set_mode((660, 480))
fps = pygame.time.Clock()
# 背景 # 背景
background = pygame.image.load('bg.png') background = pygame.image.load('bg.png')
...@@ -13,7 +14,10 @@ right = pygame.image.load('right.png') ...@@ -13,7 +14,10 @@ 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
while True: while True:
x+=30
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
# 接收到退出事件后退出程序 # 接收到退出事件后退出程序
...@@ -21,7 +25,7 @@ while True: ...@@ -21,7 +25,7 @@ while True:
# 将背景图画上去 # 将背景图画上去
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))
...@@ -29,4 +33,6 @@ while True: ...@@ -29,4 +33,6 @@ while True:
# 将果实画上去 # 将果实画上去
screen.blit(food, (360, 300)) screen.blit(food, (360, 300))
# 刷新画面 # 刷新画面
pygame.display.update()
\ No newline at end of file pygame.display.update()
fps.tick(3)
\ No newline at end of file

2.05 KB | W: | H:

162 Bytes | W: | H:

up.png
up.png
up.png
up.png
  • 2-up
  • Swipe
  • Onion skin
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