Page 2 of 2
Re: Collision Detection Not Working?
Posted: Tue Dec 22, 2015 6:07 pm
by TheNiny
Ok, I'm starting to understand all of this. But the thing is, the way that my game is going to work later on I don't need more than one enemy on the screen at a time. all I need is for the enemy to disappear (Or get deleted, rather) when I hit him.
Re: Collision Detection Not Working?
Posted: Tue Dec 22, 2015 9:21 pm
by pgimeno
Then go with what I said here:
pgimeno wrote:If you only have one, then you can have a status flag that indicates if there's an enemy or not, and not draw it or check collisions if there isn't.
You can make that e.g. enemy.present = true (or false)
Then wrap the collision check loop in: if enemy.present then ... end
Same for enemy.draw.