Commit 8d0b45b7 by BellCodeEditor

save project

parent b5bf7b0f
Showing with 4 additions and 1 deletions
...@@ -3,6 +3,9 @@ from pygame import locals ...@@ -3,6 +3,9 @@ from pygame import locals
import random import random
pygame.init() # 初始化 pygame.init() # 初始化
class Block(pygame.sprite.Sprite):
def _init_
# 创建一个窗口 # 创建一个窗口
screen = pygame.display.set_mode((1000, 600)) screen = pygame.display.set_mode((1000, 600))
FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数) FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
...@@ -71,7 +74,7 @@ while True: ...@@ -71,7 +74,7 @@ while True:
screen.blit(road, (road_x, 500)) # 路 screen.blit(road, (road_x, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空 screen.blit(wukong, (150, y)) # 悟空
if rect.x <= 0-rect.width: # 障碍物消失 if obstacle.height <= 0-obstacle.rect.width: # 障碍物消失
# 创建障碍物对象 # 创建障碍物对象
obstacle = random.choice([bush,stone,cacti]) obstacle = random.choice([bush,stone,cacti])
rect = obstacle.get_rect() rect = obstacle.get_rect()
......
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