The problema consist of table index nil,
Code: Select all
monsterlist[turnCounter].path = CalcPath(CalcMoves(collisionmap, monsterlist[turnCounter].cx, monsterlist[turnCounter].cy, monsterlist[turnCounter].target.x, monsterlist[turnCounter].target.y))
steplist = monsterlist[turnCounter].path
The problem is, when i draw the point of the path using direct the monsterlist.path everything work well (code bellow)
Code: Select all
if monsterlist[turnCounter].path ~= nil then
love.graphics.print(monsterlist[turnCounter].path[2].x..','..monsterlist[turnCounter].path[2].y,(monsterlist[turnCounter].cx*32),(monsterlist[turnCounter].cy*32))
end
Code: Select all
if monsterlist[turnCounter].state == 'chacing' then
monsterlist[turnCounter].dx = monsterlist[turnCounter].path[2].x
monsterlist[turnCounter].dy = monsterlist[turnCounter].path[2].y
end
i need some help here, i cant understand why i can draw correct the points of the way ... and get nil when i try give the new position to player ... since i can see cleary the way made by the points when run the program.
ty for any help