Help with Bad Guys!

I’ve pasted my game above. The problem I’m having is that I’ve coded the bad guys (Bumpers) to die when I jump on top of them. It works with all of them except for my first bad guy. The first bad guy just dies regardless of where I over lap with him.

Please help!

Thanks!

hi!

The issue was in your overlaps code! In your check to see if the y is less than the enemy, your variable was looking at the last Bumper you created, instead of the Bumper that you were overlapping with! To fix it, I dragged out the ‘otherSprite’ variable from the overlaps event

Here are the before and after of the changes I made:


It was working from happenstance - the other bumpers all had the same y value :smiley: so it didn’t matter that it was only checking the last created one!

Hope this helps! here’s the fixed code:

– vivian

1 Like