Discuss Scratch

Azmarai
Scratcher
1 post

How make moving clone and moving sprite disappear when they touch

Hi, all. I've been tinkering with this project since early on in the pandemic. It all went well until I tried to make lady liberty shoot rockets at the coronavirus sprites to destroy them for extra points. I've tried different variations of the code to detect when the rocket clone touched the virus, but nothing seems to register. I'm guessing that there's a problem with the rockets being clones or perhaps the virus code's negative y movement making it seem like they never touch. Ideally, both the rocket (“patriot” clones) and the virus (“COVID19” and other copies) sprites will disappear upon collision, a coin sound will play and points will go up by 10. Please help, because I can't get any part of that to work right now. Here's a link to my project and any help is much appreciated!

https://scratch.mit.edu/projects/408283618

Last edited by Azmarai (June 10, 2021 08:17:30)

EpicGhoul993
Scratcher
1000+ posts

How make moving clone and moving sprite disappear when they touch

For the rocket clone, you would like to have this block:
when I start as a clone
Under this, do whatever movement you like. Now, you would need to detect when it touches any virus sprite:
when I start as a clone ::#888 hat
repeat until <<touching [virus v] ?> or <touching [edge v] ?>>
your stuff ::#888
end
if <touching [edge v] ?> then
delete this clone
else
your stuff ::#888 //now it touches the virus.
wait (0) secs
delete this clone
end
But upon checking the project, I noticed you used too many virus sprites. They can all be shorten by using clones again. The checking part will stay the same.

For the new virus clones, they pretty much get the same script except they check for touching rockets or edges.


Powered by DjangoBB