- [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
|
||||
|
||||
@@ -20,8 +20,8 @@ game={
|
||||
restart=function()
|
||||
flags={}
|
||||
objects.list={}
|
||||
actors.main={name="jailer",x=14,y=11,o="l",gfx={x=32,y=0},level="arq"}
|
||||
game.init("arq")
|
||||
actors.main={name="jailer",x=9,y=14,o="u",gfx={x=32,y=0},level="repro"}
|
||||
game.init("repro")
|
||||
end,
|
||||
|
||||
init=function(levelname,f,objs)
|
||||
@@ -49,11 +49,11 @@ game={
|
||||
|
||||
show_menu=function()
|
||||
game.pause()
|
||||
brymode.show(game.resume)
|
||||
--menu.show({ {"GUARDAR PARTIDA", game.save},
|
||||
-- {"CARREGAR PARTIDA", game.load},
|
||||
-- {"EIXIR", main_init},
|
||||
-- }, game.resume)
|
||||
--brymode.show(game.resume)
|
||||
menu.show({ {"GUARDAR PARTIDA", game.save},
|
||||
{"CARREGAR PARTIDA", game.load},
|
||||
{"EIXIR", main_init},
|
||||
}, game.resume)
|
||||
end,
|
||||
|
||||
save=function()
|
||||
|
||||
Reference in New Issue
Block a user