I have it set so that when the player health gets below 1, then the background changes to Game Over and the Stop All command occurs.
But you can still keep clicking and changing the variables even AFTER the StopAll command has occurred. When I go to presentation mode, even before I click the green flag, I can click the sprites to change the variables. How is that happening?
Offline
If you are using the block <when[ ]clicked> , then that script will not stop because it only starts when you click the sprite, and isn't affected by the stop all script.
Offline
If it is activated by hat blocks, it overwrites stop all. Hat blocks, essentially replace clicking the green flag. Just like stop all, doesn't stop clicking the green flag, the same is for other hat blocks. The hat blocks are:
<when green flag clicked>
<when[ ]key pressed>
<when[ ]clicked>
<when I receive[
Offline
OK. I guess I thought StopAll shut down ALL scripts until the Green Flag was clicked again, just like the StopSign. But those HAT blocks can still receive/send commands no matter what? Interesting. Now I have to figure out how to invalidate the hat blocks when the game ends... Challenge accepted (LOL).
Thanks!
Last edited by infinitum3d (2010-06-03 17:15:39)
Offline
infinitum3d wrote:
OK. I guess I thought StopAll shut down ALL scripts until the Green Flag was clicked again, just like the StopSign. But those HAT blocks can still receive/send commands no matter what? Interesting. Now I have to figure out how to invalidate the hat blocks when the game ends... Challenge accepted (LOL).
Thanks!
You could make a variable which is set to 0 when the green flag is clicked, and set to 1 right before you stop all of the scripts. In the "when ... pressed" hat blocks, you can make it so that they only activate once if the variable is 0.
Of course, that doesn't solve the problem of when the user themselves clicks the Stop Sign. Maybe instead of hat blocks, you could use a "forever...if <mouse down> and <touching mouse-pointer>" block?
Offline
http://scratch.mit.edu/projects/infinitum3d/1097289
I added a variable (GameOn), so instead of running StopAll, it now sets the variable to false, which prevents the HAT block from working. Easier than I thought it would be.
EDIT: OOPS, I see coolstuff had the same idea LOL.
Thanks!
Last edited by infinitum3d (2010-06-03 17:44:48)
Offline
infinitum3d wrote:
http://scratch.mit.edu/projects/infinitum3d/1097289
I added a variable (GameOn), so instead of running StopAll, it now sets the variable to false, which prevents the HAT block from working. Easier than I thought it would be.
EDIT: OOPS, I see coolstuff had the same idea LOL.
Thanks!
Happy to help.
That works almost perfectly, except when the user stops the script themselves.
Offline
That works almost perfectly, except when the user stops the script themselves.
Yeah. I'm still not sure how to get around that. There is no "when stopSign clicked" command to set the variable to 0.
Offline
I just realized something.....shouldn't this topic go in troubleshooting?
Offline
I guess it could. It's not really a Scratch error, but I guess it could be considered a glitch...
Offline