Commit 74386c38 by BellCodeEditor

save project

parent 5375ebca
Showing with 15 additions and 3 deletions
...@@ -22,11 +22,16 @@ randomNum=random.choice([stone,cacti,apple]) ...@@ -22,11 +22,16 @@ randomNum=random.choice([stone,cacti,apple])
randomRect=randomNum.get_rect() randomRect=randomNum.get_rect()
randomRect.x=1000 randomRect.x=1000
randomRect.y=500-randomRect.height randomRect.y=500-randomRect.height
rect_x=0
rect_y=0
index = 0 index = 0
y=400 y=400
status="runing" status="runing"
t=30 t=30
road_x=0
bg_x=0
while True: while True:
wukong=modelist[index] wukong=modelist[index]
...@@ -34,6 +39,14 @@ while True: ...@@ -34,6 +39,14 @@ while True:
index+=2 index+=2
if index>=5: if index>=5:
index=0 index=0
road_x-=8
if road_x<=1000:
road_x=0
bg_x-=2
if bg_x<=1000:
bg_x=0
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
...@@ -61,8 +74,8 @@ while True: ...@@ -61,8 +74,8 @@ while True:
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (bg_x, 0))
screen.blit(road, (0, 500)) screen.blit(road, (road_x, 500))
screen.blit(wukong, (150, y)) screen.blit(wukong, (150, y))
if randomRect.x<0-randomRect.width: if randomRect.x<0-randomRect.width:
randomNum=random.choice([stone,cacti,apple]) randomNum=random.choice([stone,cacti,apple])
......
...@@ -14,4 +14,3 @@ turtle.pendown() ...@@ -14,4 +14,3 @@ turtle.pendown()
turtle.circle(100) turtle.circle(100)
turtle.done()import pygame
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