- [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
|
||||||
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()
|
update=function()
|
||||||
if actors.updating then return end
|
if actors.updating then return end
|
||||||
actors.updating=true
|
actors.updating=true
|
||||||
@@ -118,7 +131,6 @@ actors={
|
|||||||
v.path=nil
|
v.path=nil
|
||||||
game.update()
|
game.update()
|
||||||
if in_scene then scene.cont() end
|
if in_scene then scene.cont() end
|
||||||
v.keys=nil
|
|
||||||
if v.name == actors.main.name then
|
if v.name == actors.main.name then
|
||||||
local switch = switches.search(v.x,v.y)
|
local switch = switches.search(v.x,v.y)
|
||||||
if switch then
|
if switch then
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ game={
|
|||||||
restart=function()
|
restart=function()
|
||||||
flags={}
|
flags={}
|
||||||
objects.list={}
|
objects.list={}
|
||||||
actors.main={name="jailer",x=14,y=11,o="l",gfx={x=32,y=0},level="arq"}
|
actors.main={name="jailer",x=9,y=14,o="u",gfx={x=32,y=0},level="repro"}
|
||||||
game.init("arq")
|
game.init("repro")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
init=function(levelname,f,objs)
|
init=function(levelname,f,objs)
|
||||||
@@ -49,11 +49,11 @@ game={
|
|||||||
|
|
||||||
show_menu=function()
|
show_menu=function()
|
||||||
game.pause()
|
game.pause()
|
||||||
brymode.show(game.resume)
|
--brymode.show(game.resume)
|
||||||
--menu.show({ {"GUARDAR PARTIDA", game.save},
|
menu.show({ {"GUARDAR PARTIDA", game.save},
|
||||||
-- {"CARREGAR PARTIDA", game.load},
|
{"CARREGAR PARTIDA", game.load},
|
||||||
-- {"EIXIR", main_init},
|
{"EIXIR", main_init},
|
||||||
-- }, game.resume)
|
}, game.resume)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
save=function()
|
save=function()
|
||||||
|
|||||||
Reference in New Issue
Block a user