Reputation: 31
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.
Upvotes: 3
Views: 2268
Reputation: 71
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.
Upvotes: 1
Reputation: 23
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.
Upvotes: 1