This site requires JavaScript, please enable it in your browser!
Greenfoot back
Firelion
Firelion wrote ...

2017/12/13

How to check if the game is stopped?

Firelion Firelion

2017/12/13

#
My goal is to get
sound.stop();
to run when the game is stopped, but I have no idea how to do so. Help?
danpost danpost

2017/12/13

#
You can probably make use of the 'stopped' method of the World class. It is called on the currently active world automatically when the scenario goes from a running state to a stopped state.
DanPost_FAN69 DanPost_FAN69

2017/12/14

#
Throw your pc out of the window if greenfoot stops working yeah than the game stopped working.
Firelion Firelion

2017/12/14

#
DanPost_FAN69 wrote...
Throw your pc out of the window if greenfoot stops working yeah than the game stopped working.
Thank's ma dood, works greeeeeet
Firelion Firelion

2017/12/14

#
danpost wrote...
You can probably make use of the 'stopped' method of the World class. It is called on the currently active world automatically when the scenario goes from a running state to a stopped state.
The stopped method in the world class returns void, so I can't use it in an if statement, but I don't know of any other way to call a method under a certain condition. Any ideas?
Super_Hippo Super_Hippo

2017/12/14

#
The method is automatically called whenever the execution paused. So you can write the 'stop sound' into the method.
Firelion Firelion

2017/12/15

#
This works, thanks!
You need to login to post a reply.