Commit e39292a6 by BellCodeEditor

save project

parent 06cb2914
Showing with 12 additions and 0 deletions
import pygame
from pygame import locals
import random
pygame.init()
pygame.display.set_caption("草字波酷跑")
......@@ -20,6 +21,10 @@ jumpstate = "running"
y = 400
t = 30
FPS = pygame.time.Clock()
obstacle = random.choice([bush,stone,cacti])
rect = obstacle.get_rect()
rect.x=1000
rect.y=500-rect.height
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -51,6 +56,13 @@ while True:
screen.blit(bg,(0,0))
screen.blit(road,(0,500))
screen.blit(caozibo,(150,y))
rect.x-=8
if rect.x<0-rect.width:
obstacle = random.choice([bush,stone,cacti])
rect = obstacle.get_rect()
rect.x=1000
rect.y=500-rect.height
screen.blit(obstacle,(rect.x,rect.y))
pygame.display.update()
FPS.tick(60)
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