Commit 1b7f2a96 by BellCodeEditor

save project

parent 6cd0b3bc
Showing with 8 additions and 1 deletions
......@@ -3,6 +3,10 @@ from pygame import locals
import random
pygame.init() # 初始化
# 创建一个窗口
screen = pygame.display.set_mode((1000, 600))
FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
......@@ -26,6 +30,7 @@ obstacle = random.choice([bush, stone, cacti])
rect = obstacle.get_rect()
rect.x = 1000
rect.y = 500 - rect.height
road_x = 0
background_x = 0
......@@ -70,9 +75,11 @@ while True:
rect = obstacle.get_rect()
rect.x = 1000
rect.y = 500 - rect.height
rect.x -= 8
road_x -= 8
background_x -= 4
background_x -= 1
if road_x <= -1000:
road_x = 0
if background_x <= -1000:
......
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