Code: Select all
for i,v in ipairs(enemies) do
love.graphics.rectangle("fill", v.x, v.y, v.width, v.height)
end
I do not understand how to iterate a list/table/array that would look for a single value to be present then act based upon that. Example
Code: Select all
enemies = {}
enemy = {
x = 0,
y = 0,
table.insert (enemies, enemy)
}
enemy2 = {
x = 32,
y = 0,
table.insert (enemies, enemy2)
}
for i,v in ipairs(enemies) do
if v.x == enemy.x + 32 then
enemy.y = enemy.y + 32
end
Perhaps I'm trying to use this all wrong, but in mind I want to be able to look in the Enemies table, and if an enemy is @ 32 , then perform another action ONCE. Not for each enemy..
If this makes any sense.