Collision Detection Not Working?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
TheNiny
Prole
Posts: 13
Joined: Sun Dec 20, 2015 2:45 am

Re: Collision Detection Not Working?

Post 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.
~The Niny
"Sna.ke", a agar.io and snake mix.
User avatar
pgimeno
Party member
Posts: 3656
Joined: Sun Oct 18, 2015 2:58 pm

Re: Collision Detection Not Working?

Post 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.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 4 guests