I am using scratch. I am cloning sprites and I am making a minecraft type game where I use many clones of one block to make the workload easier. I keep the original sprite hidden, and hide clones when I want to destroy them. I am trying to create new clones by moving the original sprite to the location where I want the clone, cloning the sprite, and then hiding the sprite and showing the clone. But, it appears as if the code for placing new sprites squares the number of clones placed and brings all of them to the character. I am new to this community and just began learning scratch. If there is a way to show the scratch code I would be happy to. Thanks.
-
Welcome to StackOverflow! Please do include the code that isn't working. See here for how to format it - https://stackoverflow.com/help/formatting – andorov Nov 17 '15 at 17:23
-
Please include either a text representation of the code, or a screenshot, and perhaps also a link to the project on Scratch. – Scimonster Nov 17 '15 at 20:11
-
Thanks for the help, the link to the game is here. I am having trouble with sprite one. https://scratch.mit.edu/projects/86253391/ – dralston Nov 18 '15 at 16:43
2 Answers
What I think you'll find is that the code is calling for 'the sprite' as in the original and all clones of itself to move to the center, as the code runs for each instance (clone) of the sprite, hence causing it to replicate itself for every existing instance of the sprite.
What you would probably have to do is have an external script within the scene, or another sprite that has no clones, call the sprite in order to clone it, as I am fairly sure that scene behaviours can facilitate cloning of other sprites. From there, I would have it set some sort of global variable to the co-ordinates you want it to spawn at, and add a script for the sprite that makes it move to the co-ordinates specified by those variables when it is created.
Since you linked your project, I'll see if I can create a remix for it that fixes your problem tomorrow if the problem is still there.

- 23
- 4
-
I think I've fixed it for you, but you'll have to check for yourself -> https://scratch.mit.edu/projects/88636132/#player – Dean Kuyser Nov 20 '15 at 21:45
Scratch has a clone limit of around ~ 301.
When you want to delete a clone, I suggest using the 'delete clone' block. If you think the screen needs to display more than 300 clones, you may have to use a method called stamping, where you store every x position on one list, every y position on another list, then render every position using a custom block. how to make it | example of the code
If you could screenshot your code, I could help debug it. I won steal it, so don't worry. And in case you're wondering, I've been been on Scratch for two years.

- 61
- 1
- 3