Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Cloning Problems
- CamieR01
- Scratcher
3 posts
Cloning Problems
I got a problem with my clones. Basically when my character shoots a bullet and an enemy spawns at the exact same time, all clones stop spawning. Any way to fix this?
Last edited by CamieR01 (Nov. 25, 2017 11:46:29)
- deck26
- Scratcher
1000+ posts
Cloning Problems
Are you trying to create more than the limit of 301 clones? Share the project if you need help to save us guessing.
- CamieR01
- Scratcher
3 posts
Cloning Problems
Here it is here https://scratch.mit.edu/projects/183448709/#editor Do you not avoid the limit by deleting clones at the end? and it can happen right away.
- deck26
- Scratcher
1000+ posts
Cloning Problems
When a clone is finished with - eg a bullet reaching the edge or hitting something - it should be deleted. Running out of clones shouldn't happen right away unless you're making the common mistake of broadcasting to a sprite and it creates a clone and the next broadcast creates 2 more, the next 4 more and so on. Do that in a loop and you quickly hit the limit.
I suspect one of your problems is lag - too many forever loops. Especially watch for the ones you have where you broadcast message1/2/3 depending on the costume of Avocadus - if the costume doesn't change these extra broadcasts are unnecessary. Much better to detect when the costume changes and only broadcast then. In fact if all they're doing is changing the costume in Vegetal to match all you need is a single loop in Vegetal to pick up when the costume of Avocadus changes.
So I haven't found the source of your problem at the moment but these changes may help.
I suspect one of your problems is lag - too many forever loops. Especially watch for the ones you have where you broadcast message1/2/3 depending on the costume of Avocadus - if the costume doesn't change these extra broadcasts are unnecessary. Much better to detect when the costume changes and only broadcast then. In fact if all they're doing is changing the costume in Vegetal to match all you need is a single loop in Vegetal to pick up when the costume of Avocadus changes.
So I haven't found the source of your problem at the moment but these changes may help.
Last edited by deck26 (Nov. 24, 2017 12:16:20)
- Discussion Forums
- » Help with Scripts
- » Cloning Problems