Commit c4e1a109 by BellCodeEditor

save project

parent f9954b57
Showing with 9 additions and 0 deletions
import pygame import pygame
from pygame import locals from pygame import locals
import random
pygame.init() pygame.init()
pygame.display.set_caption('悟空酷跑') pygame.display.set_caption('悟空酷跑')
...@@ -22,6 +23,10 @@ index = 0 ...@@ -22,6 +23,10 @@ index = 0
jumpstate = 'running' jumpstate = 'running'
y = 400 y = 400
t = 25 t = 25
obstacle = random.choice([bush,stone,cacti,bush,stone,cacti])
rect = obstacle.get_rect()
rect.x = 1000
rect.y = 500-rect.height
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -52,6 +57,9 @@ while True: ...@@ -52,6 +57,9 @@ while True:
y = 400 y = 400
screen.blit(bg,(0,0)) screen.blit(bg,(0,0))
screen.blit(wukong,(150,y)) screen.blit(wukong,(150,y))
screen.blit(obstacle,(rect.x,rect.y))
screen.blit(road,(0,500)) screen.blit(road,(0,500))
pygame.display.update() pygame.display.update()
rect.x -= 8
fps.tick(60) 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