- WIP: Interacció amb els actors

- Levels
- Crec que no fa falta el segon layer
This commit is contained in:
2023-02-02 19:54:46 +01:00
parent 6fc103d355
commit 52c117dffb
6 changed files with 87 additions and 53 deletions

View File

@@ -60,6 +60,20 @@ actors={
return false
end,
interact=function(x,y,o)
for i,actor in ipairs(actors.list) do
if o=='d' then
if actor.x==x and actor.y==y+1 then if actor.action then actor.action() end end
elseif o=='u' then
if actor.x==x and actor.y==y-1 then if actor.action then actor.action() end end
elseif o=='l' then
if actor.y==y and actor.x==x-2 then if actor.action then actor.action() end end
elseif o=='r' then
if actor.y==y and actor.x==x+2 then if actor.action then actor.action() end end
end
end
end,
update=function()
if actors.updating then return end
actors.updating=true