Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Cloning
- thisisagoodway
-
34 posts
Cloning
So I have the code I just want to make clones, I've already tried and failed, can anyone help? (my projects is a test and just for refrence when ever I need so code for bouncing balls) heres what I have so far: https://scratch.mit.edu/projects/1127346758/
- brun7
-
90 posts
Cloning
Have you tried putting the main bouncing code under a “when I start as a clone” block, and then using a “create clone” block to make the clones?
- deck26
-
1000+ posts
Cloning
Seriously, you ask why no one is helping 5 minutes after you've asked for help? Remember anyone helping here is doing so on a voluntary basis. You need to be more patient. This is the same perosn, how come no one is helping me?
- deck26
-
1000+ posts
Cloning
If you've tried something and failed it can be better to leave that code in place - you may have made a simple mistake and you'll feel better if you find you were close to getting it right.
I'd start by hiding the sprite and only showing clones which save duplicating code. That just means the movement code is in a ‘when I start as a clone’ script rather than your green flag script. Start by creating one clone and get that working with your existing script. Should be simple enough - move the forever loop to a clone script and create a clone but remember to show the clone if you're hiding the sprite.
To have more than one clone you need to ensure ‘velocity’ variable is local (this sprite only) so each clone can control its own value.
You should then be able to have multiple balls behaving independently and bouncing off the ground. Bouncing off each other is a lot of extra work.
Try this and update your original post if necessary.
I'd start by hiding the sprite and only showing clones which save duplicating code. That just means the movement code is in a ‘when I start as a clone’ script rather than your green flag script. Start by creating one clone and get that working with your existing script. Should be simple enough - move the forever loop to a clone script and create a clone but remember to show the clone if you're hiding the sprite.
To have more than one clone you need to ensure ‘velocity’ variable is local (this sprite only) so each clone can control its own value.
You should then be able to have multiple balls behaving independently and bouncing off the ground. Bouncing off each other is a lot of extra work.
Try this and update your original post if necessary.
- thisisagoodway
-
34 posts
Cloning
Yes, and it works but I want to create as many clones as I need, but lets say I want to make 5 they all don't bounce correctly Have you tried putting the main bouncing code under a “when I start as a clone” block, and then using a “create clone” block to make the clones?
Last edited by thisisagoodway (March 4, 2025 20:40:31)
- thisisagoodway
-
34 posts
Cloning
Sorry… My badSeriously, you ask why no one is helping 5 minutes after you've asked for help? Remember anyone helping here is doing so on a voluntary basis. You need to be more patient. This is the same perosn, how come no one is helping me?

- Discussion Forums
- » Help with Scripts
-
» Cloning