Commit 09e36cb6 by BellCodeEditor

save project

parent ec6f2a3d
Showing with 11 additions and 2 deletions
import pygame
from pygame import locals
from random import randint
# 初始化pygame,为使用pygame做准备
pygame.init()
......@@ -7,6 +8,11 @@ pygame.init()
background = pygame.image.load('bg.png')
right = pygame.image.load('right.png')
food = pygame.image.load('apple.png')
st = pygame.image.load('body.png')
x1 =randint(0,21)*30
y1 =randint(0,15)*30
x2 =randint(0,21)*30
y2 =randint(0,15)*30
# 创建一个窗口
screen = pygame.display.set_mode((640,480))
while True:
......@@ -15,8 +21,11 @@ while True:
exit()
screen.blit(background,(0,0))
screen.blit(right,(300,150))
screen.blit(food,(300,200))
screen.blit(right,(x1,y1))
screen.blit(st,(x1-30,y1))
screen.blit(st,(x1-60,y1))
screen.blit(st,(x1-90,y1))
screen.blit(food,(x2,y2))
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