x, y, z = int(data_s[0]), int(data_s[1]), int(data_s[2]) a = True if data_s[3] == "True" else False b = True if data_s[4] == "True" else False #debug #print(x, y, z) #print(a, b) return x, y, z, a, b mc = Minecraft.create() try: playerPos = mc.player.getTilePos() craftPos = playerPos.clone() craftPos.y += 10 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)
xWing1Pos.x -= 50 xWing1Pos.z += 50 xWing1 = XWingFighterDiagonal(xWing1Pos) xWing1.fly(pos.x - 10, pos.y, pos.z + 10, 0.25) xWing1.clear() #fly x wing down the treach trenchPos = Vec3(50, 40, -50) trench = Trench(trenchPos, 14, 8, 100) #put the player in the trench mc.player.setTilePos(57, 41, 49) sleep(2) xWing2Pos = Vec3(57, 44, 45) 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()
a = True if data_s[3] == "True" else False b = True if data_s[4] == "True" else False #debug #print(x, y, z) #print(a, b) return x, y, z, a, b mc = Minecraft.create() try: playerPos = mc.player.getTilePos() craftPos = playerPos.clone() craftPos.y += 10 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)
xWing1Pos.x -= 50 xWing1Pos.z += 50 xWing1 = XWingFighterDiagonal(xWing1Pos) xWing1.fly(pos.x - 10, pos.y, pos.z + 10, 0.25) xWing1.clear() #fly x wing down the treach trenchPos = Vec3(50,40,-50) trench = Trench(trenchPos, 14, 8, 100) #put the player in the trench mc.player.setTilePos(57, 41, 49) sleep(2) xWing2Pos = Vec3(57, 44, 45) 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()