Automatically pause when loading from code?

What did you draw?
Post Reply
ccoxford
Posts: 3
Joined: Wed Jan 27, 2021 1:48 pm

Automatically pause when loading from code?

Post by ccoxford »

As the subject says, is there a way to add a line to the code so that when it is loaded, the sim starts paused? Or is there something I can do before I load the code to ensure it will be paused when I load it? Thanks for any help!
User avatar
testtubegames
Site Admin
Posts: 1148
Joined: Mon Nov 19, 2012 7:54 pm

Re: Automatically pause when loading from code?

Post by testtubegames »

There's not a line of code, but (in theory) -- if the sim is paused before you open the save/load panel, it'll remain paused when you load a setup.
ccoxford
Posts: 3
Joined: Wed Jan 27, 2021 1:48 pm

Re: Automatically pause when loading from code?

Post by ccoxford »

Maybe it does that in the Full Version? I'm using the web version, and can't get it to do that. To be clear, the only way to open up the save/load panel is to hit escape, and do it from the main menu?
ccoxford
Posts: 3
Joined: Wed Jan 27, 2021 1:48 pm

Re: Automatically pause when loading from code?

Post by ccoxford »

I'm realizing that this isn't actually the biggest deal. I'm creating an activity for my students to explore gravitation (actually modifying one that we used to do using My Solar System from PhET, which has unfortunately not been converted to HTML5). The code isn't super complex, so I can just have them either edit the code to make changes to the initial conditions, or they can figure out how to reset the objects to the initial conditions themselves and then make changes. But still, having a reliable way to ensure that the simulation starts paused would be the most ideal solution.
User avatar
testtubegames
Site Admin
Posts: 1148
Joined: Mon Nov 19, 2012 7:54 pm

Re: Automatically pause when loading from code?

Post by testtubegames »

Ah, interesting. It looks like the behavior is different depending on which way you access the load panel. If you go out to the main menu, as you describe, it always starts playing automatically.

The way you'd want to do it is use the save (& load) button in the upper-left menu. That will preserve the sim's paused state.
Post Reply