Commit 7832ed81 by BellCodeEditor

save project

parent aef61162
Showing with 16 additions and 0 deletions
import pygame
import random
from pygame import locals
pygame.init() # 初始化
......@@ -21,6 +22,12 @@ hero = [pygame.image.load('hero1.png'),
m = 0
j="runing"
y=400
w=random.choice([stone,cacti,apple])
rect=w.get_rect()
rect.x=1000
rect.y=500-rect.height
t=30
while True:
......@@ -57,5 +64,13 @@ while True:
screen.blit(road, (0, 500))
screen.blit(hero1, (150, y))
# 刷新画面
if rect.x<=0-rect.width:
w=random.choice([stone,cacti,apple])
rect=w.get_rect()
rect.x=1000
rect.y=500-rect.height
rect.x-=5
screen.blit(w,(rect.x,rect.y))
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