Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to completely reset all sprites
- PFTryhard
-
13 posts
How to completely reset all sprites
In my game I use a reset button instead of the flag button, and whats supposed to happen is that when you die “Player” broadcasts “Stop All”, and then you have the option to replay. Because of the way I made my obstacles, they clones themselves, so when you press replay, instead of creating say, 1 clone per sec they make 2, etc. Stop all doesn't work, so is there a way to completely reset everything (there is some stuff I want to keep between deaths so not a HARD reset). Here's the game https://scratch.mit.edu/projects/367346575/
- nyankatpro
-
500+ posts
How to completely reset all sprites
What I'd do is replace every “when flag clicked” block with a “when broadcast received” block, and use the broadcast in your restart code.
- Paigeri
-
500+ posts
How to completely reset all sprites
https://scratch.mit.edu/projects/367346575/I 100% agree with In my game I use a reset button instead of the flag button, and whats supposed to happen is that when you die “Player” broadcasts “Stop All”, and then you have the option to replay. Because of the way I made my obstacles, they clones themselves, so when you press replay, instead of creating say, 1 clone per sec they make 2, etc. Stop all doesn't work, so is there a way to completely reset everything (there is some stuff I want to keep between deaths so not a HARD reset). Here's the game @nyankatpro - I think this is the easiest and most effective way to do this.
- GemStoneExtra
-
17 posts
How to completely reset all sprites
try this: make a new variable, name it whatever you want. i will use ‘clonedel’ as an example.
first, you will go to your player sprite. before every ‘broadcast stop’, change ‘clonedel’ to 1:
then, do these in any sprite:
now go to each sprite that gets cloned and put this in:
that should fix it! good luck!
first, you will go to your player sprite. before every ‘broadcast stop’, change ‘clonedel’ to 1:
then, do these in any sprite:
now go to each sprite that gets cloned and put this in:
that should fix it! good luck!
- PFTryhard
-
13 posts
How to completely reset all sprites
I tried that, doesn't work for some reason. What I'm thinking is happening is that when I die and go to the score screen the obstacles keep generating clones of themselves who then generate more clones? Idk, but yeah, I already tried the whole broadcast thing. It's probably a problem with the obstacles code if you care to go in and look for it. Thx What I'd do is replace every “when flag clicked” block with a “when broadcast received” block, and use the broadcast in your restart code.
- PFTryhard
-
13 posts
How to completely reset all sprites
I tried that, doesn't work for some reason. What I'm thinking is happening is that when I die and go to the score screen the obstacles keep generating clones of themselves who then generate more clones? Idk, but yeah, I already tried the whole broadcast thing. It's probably a problem with the obstacles code if you care to go in and look for it. Thx What I'd do is replace every “when flag clicked” block with a “when broadcast received” block, and use the broadcast in your restart code.
- nyankatpro
-
500+ posts
How to completely reset all sprites
if you have a problem with scripts continuing to run, just use a broadcast that sends out “stop other scripts in sprite” commands to every sprite.
- imfh
-
1000+ posts
How to completely reset all sprites
You should run delete this clone after stop other scripts in sprite. Otherwise, it is possible that an undeleted clone will receive the Replay broadcast and start creating extra clones.
- Discussion Forums
- » Help with Scripts
-
» How to completely reset all sprites