- [NEW] Afegida funció per a que un actor vaja a una posició concreta
This commit is contained in:
@@ -105,6 +105,19 @@ actors={
|
||||
end
|
||||
end,
|
||||
|
||||
moveto=function(name,dx,dy)
|
||||
local actor = actors.search(name)
|
||||
if actor.x==dx and actor.y==dy then
|
||||
actor.path=nil
|
||||
return
|
||||
end
|
||||
actor.path={pos=0,route=""}
|
||||
if (actor.x<dx) then for i=1,dx-actor.x do actor.path.route=actor.path.route.."r" end end
|
||||
if (actor.x>dx) then for i=1,actor.x-dx do actor.path.route=actor.path.route.."l" end end
|
||||
if (actor.y<dy) then for i=1,dy-actor.y do actor.path.route=actor.path.route.."d" end end
|
||||
if (actor.y>dy) then for i=1,actor.y-dy do actor.path.route=actor.path.route.."u" end end
|
||||
end,
|
||||
|
||||
update=function()
|
||||
if actors.updating then return end
|
||||
actors.updating=true
|
||||
@@ -118,7 +131,6 @@ actors={
|
||||
v.path=nil
|
||||
game.update()
|
||||
if in_scene then scene.cont() end
|
||||
v.keys=nil
|
||||
if v.name == actors.main.name then
|
||||
local switch = switches.search(v.x,v.y)
|
||||
if switch then
|
||||
|
||||
Reference in New Issue
Block a user