Page 1 of 1

Making enemy's Die

Posted: Tue May 28, 2013 6:23 pm
by roggie12
SkyWalker.zip
It's still really early in development. I'm adding in camera movement soon
(63.3 KiB) Downloaded 137 times
I've been having trouble with making enemy's and making them Die. To make enemy's I do:

Code: Select all

enemy={}
enemy.x =0
enemy.y =600
enemy.speed=3
enemy.health =20
enemy.damage =2
enemy.pic = love.graphics.newImage("textures/enemy.png")
But i don't know how to make it so that the player can hit the enemy and the enemy dies(Keeping in mind that i'm trying to make a game where there's unlimited enemies but i can figure out how to do that my self). I haven't required the enemy yet cuz i'm not done with the code.

Re: Making enemy's Die

Posted: Tue May 28, 2013 7:07 pm
by Davidobot
roggie12 wrote:
SkyWalker.zip
I've been having trouble with making enemy's and making them Die. To make enemy's I do:

Code: Select all

enemy={}
enemy.x =0
enemy.y =600
enemy.speed=3
enemy.health =20
enemy.damage =2
enemy.pic = love.graphics.newImage("textures/enemy.png")
But i don't know how to make it so that the player can hit the enemy and the enemy dies(Keeping in mind that i'm trying to make a game where there's unlimited enemies but i can figure out how to do that my self). I haven't required the enemy yet cuz i'm not done with the code.
When you add enemies add them to a table, that will make it easier to draw, move and remove since it is just a matter of called table.remove to remove them.

Re: Making enemy's Die

Posted: Tue May 28, 2013 7:13 pm
by roggie12
Davidobot wrote:
roggie12 wrote:
SkyWalker.zip
I've been having trouble with making enemy's and making them Die. To make enemy's I do:

Code: Select all

enemy={}
enemy.x =0
enemy.y =600
enemy.speed=3
enemy.health =20
enemy.damage =2
enemy.pic = love.graphics.newImage("textures/enemy.png")
But i don't know how to make it so that the player can hit the enemy and the enemy dies(Keeping in mind that i'm trying to make a game where there's unlimited enemies but i can figure out how to do that my self). I haven't required the enemy yet cuz i'm not done with the code.
When you add enemies add them to a table, that will make it easier to draw, move and remove since it is just a matter of called table.remove to remove them.
Thanx for the advice

Re: Making enemy's Die

Posted: Tue May 28, 2013 7:25 pm
by Eamonn
To make enemies die, remove them from the table! Problem solved! Add them into an index of the table, so you'd have enemy[1], then check to see if the player collided with the enemy, then remove them from the table! :D

Re: Making enemy's Die

Posted: Sun Jun 09, 2013 3:33 pm
by roggie12
Eamonn wrote:To make enemies die, remove them from the table! Problem solved! Add them into an index of the table, so you'd have enemy[1], then check to see if the player collided with the enemy, then remove them from the table! :D
Thanx