Commit 04aea025 by BellCodeEditor

save project

parent e273e0b5
apple2.png

1.72 KB

bg.png

22.5 KB

body.png

1.4 KB

down.png

2.01 KB

left.png

2.07 KB

File added
import pygame
from pygame import locals
pygame.init()
screen=pygame.display.set_mode((660,480))
FPSCLOCK=pygame.time.Clock()
backdround=pygame.image.load("bg.png")
right=pygame.image.load("right.png")
body=pygame.image.load("body.png")
apple=pygame.image.load("apple2.png")
x,y=210,180
weizhi=[(180,180),(150,180),(150,150),(x,y)]
while True:
for event in pygame.event.get():
if event.type==locals.QUIT:
exit()
x+=30
weizhi.append((x,y))
weizhi.pop(0)
#初始位置
screen.blit(backdround,(0,0))
screen.blit(right,(x,y))
for i in range(len(weizhi)-1):
screen.blit(body,weizhi[i])
#screen.blit(body,(180,180))
#screen.blit(body,(150,180))
#screen.blit(body,(150,150))
screen.blit(apple,(360,360))
FPSCLOCK.tick(3)
#控制帧数
pygame.display.update()
\ No newline at end of file
right.png

2.05 KB

up.png

2.05 KB

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