Spaceship Shooter Coding Help (Collision)

I have a space ship shooter game I’m making here I am wondering if anyone can explain why collision between shot and enemy doesn’t always happen. Thank you.

2 Likes

Hi @soconnor,

There’s a couple of issues with your code:

  1. Events should be outside of loops - event blocks are always listening, ie, forever waiting for an event to happen, even after it’s already happened. Take them out and place them before your forever loop.

  2. Clone events should be placed right after the clone is created - this is so you don’t have an event listening out for an object which doesn’t exist.

Fixing these issues should resolve your problem.

Hope this helps! Let me know if you have any further questions about this. If this solves your problem, please mark this post as the Solution.

Many thanks,
Geoff @ TechLeap

3 Likes

Ok, so I think I understand what you were saying/updated my code all seems to work as intended. Thank you.

2 Likes

Well done @soconnor! By working it out yourself, you’re building your own coding & problem-solving muscles!

1 Like