Code: Select all
Enemies = { }
Enemies.Enemy = { }
Code: Select all
cE = #Enemies.Enemy + 1
Enemies.Enemy[cE] = { }
Enemies.Enemy[cE].X = posx
Enemies.Enemy[cE].Y = posy
Enemies.Enemy[cE].type = tt
Enemies.Enemy[cE].actX = posx
Enemies.Enemy[cE].actY = posy
Enemies.Enemy[cE].HP = 5
Enemies.Enemy[cE].Alive = true
Enemies.Enemy[cE].attacking = false
Enemies.Enemy[cE].current_State = "r"
Enemies.Enemy[cE].damaged = "s"
Enemies.Enemy[cE].direction = playerQuad.down
entities_map[posy/50][posx/50] = 20
print(time.."s :Enemy spawned @ "..posx..", "..posy.." #"..#Enemies.Enemy+1)
Code: Select all
for b=1, #Enemies.Enemy do
if bx == Enemies.Enemy[b].X and by == Enemies.Enemy[b].Y and Enemies.Enemy[b].Alive == true then
if Enemies.Enemy[b].HP <= 0 then
table.remove(Enemies.Enemy, b)
end
end
end