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 » Wed Jan 27, 2021 1:51 pm

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: 1081
Joined: Mon Nov 19, 2012 7:54 pm

Re: Automatically pause when loading from code?

Post by testtubegames » Wed Jan 27, 2021 3:39 pm

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 » Wed Jan 27, 2021 5:06 pm

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 » Wed Jan 27, 2021 6:37 pm

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: 1081
Joined: Mon Nov 19, 2012 7:54 pm

Re: Automatically pause when loading from code?

Post by testtubegames » Fri Jan 29, 2021 4:11 pm

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