Working on a game. Here's my code.
Code thats a problem -
Code:
EnemyList = {1,2,3,4,5,6}
(REST OF CODE)
if Enemy[EnemyList[target]].health <= 0 then
Enemy[EnemyList[target]].state = "dead"
end
if Enemy[EnemyList[Length]].state = "dead" then
screen:print(10, 130, "You killed all the enemies")
end
Example of my table -
Code:
Enemy = {}
Enemy[1] = {name = "Zombie", damage = 3, health = 15, combatx = 300, combaty = 5, image = mzombie, state = "living"}
Enemy[2] = {name = "Zombie", damage = 3, health = 20, combatx = 310, combaty = 15, image = mzombie2, state = "living"}
The error I get is " 'then' expected near '=' "
I probably didn't need to include all that information, but more is better then less. This is probably an easy solution also, but I don't care b/c im tired.