Commit 884d704e by BellCodeEditor

save project

parent f440d94a
Showing with 9 additions and 2 deletions
import pygame
from pygame import locals
import random
pygame.init() # 初始化
# 创建一个窗口
screen = pygame.display.set_mode((1000, 600))
FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
# 载入图片
pygame.display.set_caption('tm的老符是sb(也是sz,还是个wc人) sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb')#展示窗口标题
pygame.display.set_caption('tm的老符是sb(也是sz,还是个wc人) sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb sb')#展示窗口标题
background = pygame.image.load('bg.png') # 背景
road = pygame.image.load('road.png') # 路
stone = pygame.image.load('stone.png') # 石头
......@@ -21,6 +21,9 @@ index_1 = 0
y = 400
jumState = "runing"
t=30
result= random.choice([stone,cacti,apple])
rect=result.get_rect()
print(rect)
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -47,9 +50,13 @@ while True:
index_1+=1
if index_1 ==5:
index_1 = 0
if rect.x-rect.width > 0 :
rect.x -= 8
# 将背景图画上去
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
screen.blit(wukong, (150, y))
# 刷新画面
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