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")
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")
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.roggie12 wrote:I've been having trouble with making enemy's and making them Die. To make enemy's I do: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.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")
Thanx for the adviceDavidobot wrote: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.roggie12 wrote:I've been having trouble with making enemy's and making them Die. To make enemy's I do: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.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")
ThanxEamonn 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!
Users browsing this forum: Google [Bot] and 4 guests