Commit e4bd2762 by BellCodeEditor

save project

parent f778f76f
Showing with 13 additions and 1 deletions
import pygame
from pygame import locals
import random
pygame.init() # 初始化
# 创建一个窗口
......@@ -17,7 +18,11 @@ hero = [pygame.image.load('hero1.png'),pygame.image.load('hero2.png'),
index = 0
jumpState = "runing"
y = 400
t = 30
t = 30
obstacle= random.choice([bush,stone,cacti])
rect=obstacle.get_rect()
rect.x=1000
rest.y = 500 - rest.height
while True:
for event in pygame.event.get():
......@@ -55,6 +60,12 @@ while True:
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
screen.blit(wukong, (150, y))
if rest.x <= 0-rest.width:
obstacle= random.choice([bush,stone,cacti])
rect=obstacle.get_rect()
rest.x = 1000
rest.y = 500 - rest.height
rest.x -= 8
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ 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