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()