basic.show_string("game start")
time=1000
r=100
x=0
o=game.create_sprite(2, 4)
choose=randint(0,3)
choose1=game.create_sprite(choose,0)
choose2=game.create_sprite(choose+1,0)
choose3=game.create_sprite(choose+3,0)
def on_forever():
x= input.acceleration(Dimension.X)
if x>0:
o.change(LedSpriteProperty.X, 1)
basic.pause(100)
if x<0:
o.change(LedSpriteProperty.X, -1)
basic.pause(100)
basic.forever(on_forever)
while True:
game.set_score(0)
choose1.change(LedSpriteProperty.Y, 1)
choose2.change(LedSpriteProperty.Y, 1)
choose3.change(LedSpriteProperty.Y, 1)
basic.pause(time-r)
if choose1.is_touching(o)or choose2.is_touching(o)or choose3.is_touching(o):
game.game_over()
if choose1.get(LedSpriteProperty.Y)==4:
game.add_score(x+5)
choose=randint(0,3)
choose1.set(LedSpriteProperty.Y, 0)
choose2.set(LedSpriteProperty.Y, 0)
choose3.set(LedSpriteProperty.Y, 0)
choose1.set(LedSpriteProperty.X, choose)
choose2.set(LedSpriteProperty.X, choose+1)
choose3.set(LedSpriteProperty.X, choose+2)
basic.pause(time-r)
r=r+100
```
|