diff --git a/data/actors.lua b/data/actors.lua index 70c33a2..7db946c 100644 --- a/data/actors.lua +++ b/data/actors.lua @@ -65,9 +65,9 @@ actors={ elseif step=='a' then v.o='d' elseif step=='o' then - v.o='r' - elseif step=='p' then v.o='l' + elseif step=='p' then + v.o='r' end end end diff --git a/data/game.lua b/data/game.lua index d101964..4d05734 100644 --- a/data/game.lua +++ b/data/game.lua @@ -3,12 +3,19 @@ game={ init=function() mapa.load("test.map") - actors.add({name="usufondo",x=11,y=9,o="r",gfx={x=0,y=0},path={pos=0,route='rrrrura'}}) + actors.add({name="usufondo",x=11,y=9,o="r",gfx={x=0,y=0},path={pos=0,route='rrrruro'}}) actors.add({name="jailer",x=6,y=9,o="r",gfx={x=32,y=0}}) update=game.update end, update=function() + local hero = actors.search("jailer") + if hero then + game.cam.x = hero.x*8 + hero.dx*2 - 80 + if game.cam.x < 0 then game.cam.x=0 end + game.cam.y = hero.y*8 + hero.dy*2 - 72 + if game.cam.y < 0 then game.cam.y=0 end + end camera(game.cam.x, game.cam.y) setsource(tiles) map(0,0,0,0,mapa.w, mapa.h) @@ -16,7 +23,6 @@ game={ actors.draw() camera(0,0) - local hero = actors.search("jailer") if hero and not hero.path and hero.dx+hero.dy==0 then if btn(KEY_DOWN) then hero.path={pos=0,route='d'}