Discuss Scratch

Carbankle
New Scratcher
1 post

Deleting Specific one of Multiple Clones of the Same Sprite

This is my final project. Work in progress. https://scratch.mit.edu/projects/351504300/editor/

Primary Issue
I cannot figure out how to delete the specific clone that is hit by the laser. Right now, the “Delete Clone” block just deletes ALL the clones of that sprite. As you can see, I have attempted to copy this code but I'm not sure that this is actually going to assist me, although lists seem to be relevant to the solution

Secondary Issue
A requirement of my final project is I have to exemplify “iteration”. I wanted to do this by making ONE long laser out of clones of a MULTITUDE of small lasers that, when cloned, would appear a certain distance in front of the previous clone and check to see if it's touching an alien. I was not able to achieve this, one reason being that I could not do it INSTANTLY. It seemed that even though I had no “Wait” blocks, the “Repeat” block would still have a delay between the end and beginning of a “Repeat”. ANOTHER reason is that I could not figure out how to accurately create a clone of the small laser projectile and have it move to coordinates that are IN FRONT of the PREVIOUSLY CREATED clone, which if working correctly would extend the length of the laser, but would happen instantly so the laser reaches either the border or the alien instantly.
Catalystix
Scratcher
100+ posts

Deleting Specific one of Multiple Clones of the Same Sprite

For the first issue, putting this in the clones' forever loop should work:
if <touching [Laser v] ?> then
delete this clone
end
since the clones of the laser all count as the same as the original.
- I don't quite understand the second issue. it sounds like what you wanted to do in the first. if you want code to run seemingly “instantly,” you can create a custom block and check the box that says “Run without screen refresh” so the whole script under that define block will run before updating the page.

Last edited by Catalystix (Dec. 27, 2019 22:45:31)

gor-dee_test
Scratcher
100+ posts

Deleting Specific one of Multiple Clones of the Same Sprite

Primary Issue
Rather than trying to get the laser to delete the alien when it is touching the alien, get the alien to delete itself when it is touching the laser. If you also want the laser to delete when it hits the alien you will run into a common problem which is this…One sprite will delete before the other, meaning that the second sprite won't detect touching as the other sprite has already gone. To solve this put
wait (0) secs
before you delete which will stop it deleting for one frame,

Powered by DjangoBB