Commit 1735e416 by BellCodeEditor

save project

parent b2670dc3
apple.png

2.05 KB

from random import randint
a = randint(2,5)
print(a)
\ No newline at end of file
bg.png

22.5 KB

body.png

1.4 KB

down.png

2.01 KB

pygame
660,480
1.screen=pygame.display.set_mode(())
______ | 尺寸
变量名 设置窗口的大小
2.变量 = pygame.image.load(图片名称) 把图片导入到程序
———————————————————————————————————
3. screen.blit(变量,(坐标位置)) 把图片画上去
4. pygame.display .updfe() 刷新画面
5. pygame.event.get() 获取事件
/
o, pygame.init() 初始化
\ No newline at end of file
left.png

2.07 KB

File added
right.png

2.05 KB

import pygame
from pygame import locals
# 初始化pygame,为使用pygame做准备
pygame.init()
# 创建一
screen = pygame.display.set_mode((660,480))
background = pygame.image.load('bg.png')
right = pygame.image.load('right.png')
food = pygame.image.load('apple.png')
body = pygame.image.load('body.png')
while True:
for event in pygame.event.get():
if event . type == locals.QUIT:
exit()
screen.blit(background,(0,0))
screen.blit(food,(0,0))
screen.blit(food,(630,0))
screen.blit(food,(630,450))
screen.blit(food,(0,450))
pygame.display.update()
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