Commit 781e00c6 by BellCodeEditor

save project

parent 7332c175
Showing with 27 additions and 2 deletions
import pygame import pygame
from pygame import locals
#初始化
pygame.init() pygame.init()
#创建一个窗口(640*480)
screen = pygame.display.set_mode((640,480)) screen = pygame.display.set_mode((640,480))
#加载背景图片
background = pygame.image.load("bg.png")
# 加载蛇头图片
snake_head_r = pygame.image.load("right.png")
# 加载苹果图片
apple = pygame.image.load("apple.png")
# 加载蛇身图片
snake_body = pygame.image.load("body.png")
while True:
# 监测事件(玩家操作)
for event in pygame.event.get():
print(event)
if event.type == locals.QUIT:
exit()
# 渲染背景图片
screen.blit(background,(0,0))
# 渲染蛇头图片
screen.blit(snake_head_r,(210,90))
# 渲染苹果图片
screen.blit(apple,(300,450))
# 渲染蛇身图片
screen.blit(snake_body,(180,90))
# 刷新
pygame.display.update()
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