Ejemplo n.º 1
0
    craftPos.z += 20
    craft = XWingFighter(craftPos)
    bomb = Bomb()
    
    while True:
        x, y, z, a, b = read_microbit_data()
        if a:
            if craft.flying:
                craft.stop()
            else:
                craft.fly(0.15)
        if b:
            bpos = craft.craftShape.position
            bpos.y - 2
            bomb.drop(bpos.x, bpos.y, bpos.z, 0.1)
        if x > 750:
            craft.turn(10)
        if x > 500:
            craft.turn(5)
        if x < -750:
            craft.turn(-10)
        if x < -500:
            craft.turn(-5)
        if x > -500 and x < 500:
            craft.turn(0)
    
finally:
    sleep(1)
    craft.clear()
    s.close()
Ejemplo n.º 2
0
xWing2Fly = xWing2.fly(57, 44, -25, 0.25, True)

#fire the missile at the exhaust port
sleep(12)
mc.postToChat("Use the force Luke")
sleep(1)
missile = XWingMissile()
missileFire = missile.fire(xWing2.position.x, xWing2.position.y,
                           xWing2.position.z - 3, trench.exhaustPortPos.x,
                           trench.exhaustPortPos.y, trench.exhaustPortPos.z,
                           0.1, True)

#wait for the missile and the xwing to stop
missileFire.join()
xWing2Fly.join()
xWing2.clear()
trench.clear()

#move player back above deathstar
mc.player.setTilePos(pos.x, pos.y + 20, pos.z)

#xwing escapes from deathstar
xWing3Pos = pos.clone()
xWing3Pos.z -= 10
xWing3 = XWingFighter(xWing1Pos)
xWing3Fly = xWing3.fly(pos.x, pos.y, pos.z - 50, 0.25, True)
sleep(3)

#destroy the deathstar
deathstar.destroy()
sleep(5)
Ejemplo n.º 3
0
    craftPos.z += 20
    craft = XWingFighter(craftPos)
    bomb = Bomb()

    while True:
        x, y, z, a, b = read_microbit_data()
        if a:
            if craft.flying:
                craft.stop()
            else:
                craft.fly(0.15)
        if b:
            bpos = craft.craftShape.position
            bpos.y - 2
            bomb.drop(bpos.x, bpos.y, bpos.z, 0.1)
        if x > 750:
            craft.turn(10)
        if x > 500:
            craft.turn(5)
        if x < -750:
            craft.turn(-10)
        if x < -500:
            craft.turn(-5)
        if x > -500 and x < 500:
            craft.turn(0)

finally:
    sleep(1)
    craft.clear()
    s.close()
Ejemplo n.º 4
0
xWing2 = XWingFighter(xWing2Pos)
xWing2Fly = xWing2.fly(57, 44, -25, 0.25, True)

#fire the missile at the exhaust port
sleep(12)
mc.postToChat("Use the force Luke")
sleep(1)
missile = XWingMissile()
missileFire = missile.fire(xWing2.position.x, xWing2.position.y, xWing2.position.z - 3,
                           trench.exhaustPortPos.x, trench.exhaustPortPos.y, trench.exhaustPortPos.z,
                           0.1, True)

#wait for the missile and the xwing to stop
missileFire.join()
xWing2Fly.join()
xWing2.clear()
trench.clear()

#move player back above deathstar
mc.player.setTilePos(pos.x, pos.y + 20, pos.z)

#xwing escapes from deathstar
xWing3Pos = pos.clone()
xWing3Pos.z -= 10 
xWing3 = XWingFighter(xWing1Pos)
xWing3Fly = xWing3.fly(pos.x, pos.y, pos.z - 50, 0.25, True)
sleep(3)

#destroy the deathstar
deathstar.destroy()
sleep(5)