Commit 4314e114 by BellCodeEditor

save project

parent bde16f3c
Showing with 34 additions and 2 deletions
import pygame import pygame
from pygame import locals
# 初始化pygame,为使用pygame做准备 # 初始化pygame,为使用pygame做准备
pygame.init() pygame.init()
# 创建一个窗口 # 创建一个窗口
Screen = pygame.display.set_mode((600,480)) Screen = pygame.display.set_mode((660,480))
\ No newline at end of file #载入背景图片
bg = pygame.image.load("bg.png")
#载入蛇头图片
right = pygame.image.load("right.png")
#载入身体图片
body = pygame.image.load("body.png")
#载入苹果图片
apple = pygame.image.load("apple.png")
#无限循环让窗口一直保留
while True:
#遍历侦测的游戏事件
for event in pygame.event.get():
#如果按下了窗口的退出按键
if event.type == locals.QUIT:
#退出程序
exit()
#加载背景图片
Screen.blit(bg,(0,0))
#加载蛇头
Screen.blit(right,(180,120))
#加载身体
Screen.blit(body,(150,120))
Screen.blit(body,(120,120))
Screen.blit(body,(120,90))
#加载苹果
Screen.blit(apple,(450,360))
#实时刷新画面
pygame.display.update()
\ No newline at end of file
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