Commit a2d0b0f7 by BellCodeEditor

save project

parent 48a98944
Showing with 19 additions and 19 deletions
import pygame
import pygame
# 初始化pygame,为使用pygame做准备
# 初始化pygame,为使用pygame做准备
pygame.init()
#载入图片
......@@ -9,22 +9,22 @@ food=pygame.image.load("apple.png")
body=pygame.image.load("body.png")
right=pygame.image.load("right.png")
# 创建一个窗口
# 创建一个窗口
screen=pygame.display.set_mode((660,480))
while True:
for event in pygame.event.get():
if event.type==locals.QUIT:
while True:
    for event in pygame.event.get():
        if event.type==locals.QUIT:
            #接收到退出事件后退出程序
            exit()
#渲染背景
screen.blit(background,(0,0))
#渲染背景
screen.blit(right,(360,240))
#渲染苹果(食物)
screen.blit(food,(360,240))
screen.blit(food,(330,240))
screen.blit(food,(300,240))
#渲染贪吃蛇
screen.blit(body,(180,60))
#刷新窗口
pygame.display.update()
\ No newline at end of file
    #渲染背景
    screen.blit(background,(0,0))
    #渲染背景
    screen.blit(right,(360,240))
    #渲染苹果(食物)
    screen.blit(food,(360,240))
    screen.blit(food,(330,240))
    screen.blit(food,(300,240))
    #渲染贪吃蛇
    screen.blit(body,(180,60))
    #刷新窗口
    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