Projectile Bug

Please help. The projectile and laser sprites are meant to destroy each other on overlap, however, this event randomly works. Most of the time it doesn’t work. If it does, then a different laser gets destroyed to the one that overlapped.

It looks like you just pasted a link to the editor itself – if you want to share your code, you can click the ‘share’ button on the top right side of the screen:


I have a strong suspicion that the issue is something like this; you have projectiles and an overlap something like this:


but that only ever refers to the last two projectiles that were created – not the ones involved in the overlap. Instead, it should be something like this:

where ‘sprite’ and ‘otherSprite’ are dragged out of the slots in the event itself – this makes it refer to the sprites that are involved in the overlap, and not any others that happen to exist.


Sorry, I thought I shared the share link.
I’m very grateful for your advice. It was 100% accurate and fixed the issue.
Is this called referring to the correct parameters in a procedure? It makes sense now.
Thanks again!

Yup, you’re right – in this case, you were referring to global variables instead of parameters in the function (/procedure), so they were pointing at the wrong sprites :slight_smile:

1 Like