I have a student that is wanting to have when one sprite touches another the other sprite disappears. I have tried using the if then block and forever with a hide but nothing seems to work. They are about ready to just scrap it but I think they could make this an excellent project. Here is a link of screen shots of their code, they may have gotten rid of some of the things that haven’t worked. The witch is suppose to touch the jems FYI.
The document is private.
Maybe either post the script pics HERE, or just share the uncompleted project file (doesn’t have to be uploaded to the servers, just a attachment from a SHARED Google Drive file here).
One easiest way can often be for the gem to detect if it is touching the witch and make it hide itself
i.e
I think they have tried that already
sorry the link should be able to be seen. if you click on it if not I will try to change it during my planning time.
Also this student has multiple clones of the original gem so they are trying to collect each of them and make each one disappear
I must be missing something… why not
? It’s hard to know without seeing the code (share the project!), but if the things you’ve tried aren’t working I’d guess it’s because the code is in the wrong sprite’s scripting area.
That is what I’ve experienced quite a few times with new coders
I don’t see anything about touching in the Google doc.
sorry I will try to have that student send their project to me (they just sent the screen shots) but that may be a day or so as they are no longer in my class. I again did tried to do If touching with the hide block but nothing happened. There was an if then else but that was a reporter block so didn’t think that could work.
Oh dear, I hope not because they were discouraged by this bug! Bugs have to be understood as learning opportunities rather than as failures.
Just confirming - did you use a hat block?. This will start the script running after some event - otherwise, it is “orphaned” and will only run if clicked on.
In fact, come to think on it, I think this may be where the problem is. If you (and/or your student) were doing this:
The script will only be activated if the green flag is pressed. When a clone is generated, it keeps the sprite’s scripts but not the state of whether they are running. Essentially, this means that the hiding script will only run in the sprite not its clones until the green flag is clicked (which incidentally deletes all clones anyways). Instead, you probably want to do this:
WHEN I START AS A CLONE will start the script, surprise surprise, when the clone generates. Warning - this won’t run in the parent sprite, so if you want the parent sprite to do it too you’ll have to have the WHEN FLAG CLICKED version as well. Finally, if the jem (clone) will never be shown again (you don’t want it anymore), you can clean things up a bit by deleting the clone altogether:
I hope this helps!
how about teleporting the sprite away when touching the main sprite
just a suggestion




