Commit 050dcc3b by BellCodeEditor

save project

parent b2670dc3
apple.png

2.05 KB

bg.png

22.5 KB

body.png

1.4 KB

down.png

2.01 KB

left.png

2.07 KB

File added
right.png

2.05 KB

import pygame
from pygame import locals
# 初始化pygame,为使用pygame做准备
pygame.init()
#加载载入图片。
beijin = pygame.image.load("bg.png")#背景。
right = pygame.image.load("right.png")#朝右蛇头
left = pygame.image.load("left.png")#朝左蛇头
sheshen = pygame.image.load("body.png")#蛇身。
apple = pygame.image.load("apple.png")#苹果
# 创建一个窗口
sc = pygame.display.set_mode((800,600))
#一直显示在桌面,除非玩家关闭
while True:
for ev in pygame.event.get():
print(ev)
if ev.type == locals.QUIT:
exit()
#2,在屏幕上渲染图片。
sc.blit(beijin,(0,0))
sc.blit(right,(240,120))
sc.blit(sheshen,(210,120))
sc.blit(sheshen,(180,120))
sc.blit(apple,(210,90))
#刷新屏幕
pygame.display.update()
\ No newline at end of file
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