Commit 4cb6e268 by BellCodeEditor

save project

parent 4f219b0f
Showing with 14 additions and 10 deletions
......@@ -23,8 +23,11 @@ jumpS = "run"
y = 400
yy = 30
roadx = 0
sjx = 600
sj = random.choice([stone,cacti,apple])
rect =sj.get_rect()
rect.x=1000
rect.y=500-rect.height
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -49,23 +52,23 @@ while True:
jumpS = "run"
yy = 30
# 将背景图画上去
if sjx == 600:
if rect.x == 1000:
sj = random.choice([stone,cacti,apple])
rect =sj.get_rect()
sjx = 1000+rect.width
sjy = 500-rect.height
rect.x = 1000
rect.y = 500-rect.height
screen.blit(background, (0, 0))
screen.blit(road, (roadx, 500))
screen.blit(hero[index], (150, y))
screen.blit(sj, (sjx, sjy))
sjx -= 5
if sjx < 0-rect.width:
sjx = 600
screen.blit(sj, (rect.x, rect.y))
rect.x -= 8
if rect.x < 0-rect.width:
rect.x = 1000
# 刷新画面
pygame.display.update()
FPS.tick(40)
FPS.tick(60)
if jumpS == "run":
index=(index+1)%5
roadx -= 5
roadx -= 8
if roadx == -1000:
roadx = 0
\ 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