return 0 else: return Ftotal else: return 0 def StartRocket(): global RocketStarted global StartTime if not RocketStarted: RocketStarted = True StartTime = rocket.shiptime def GetMass(): global RocketStarted if RocketStarted: return Me + Mp * (Tburn - BurnTime) / Tburn else: return Me + Mp start = InputButton((10, 400), "START", StartRocket, positioning="physical", size=15) rocket = Rocket(earth, thrust=GetThrust, mass=GetMass, heading=radians(90)) earth.run(rocket)
global PayloadLaunched if Stage1Started: return "STAGE 1 FIRING" elif Stage2Started: return "STAGE 2 FIRING" elif PayloadLaunched: return "PAYLOAD DELIVERED" else: return "WAITING FOR LAUNCH" # Create a button for starting the simulation # Physical positioning at 10,400 pixels, calls the StartRocket function start = InputButton((10, 400), "START", StartRocket, positioning="physical", size=15) stage2start = InputButton((10, 450), "BEGIN STAGE 2", Start2Stage, positioning="physical", size=15) # Create a label for showing the current rocket status status = Label((10, 420), GetStatus, positioning="physical", size=15) # Add a slider for conrolling the timezoom tz = Slider((10, 360), 0, 3, 0, positioning="physical")