Files
jailsadventure2/data/game.lua
JailDoctor 9d4152350b - Els bocadillos poden estar dalt o baix del actor
- Text apareix lletra a lletra
- Salt de linea acceptat
2023-01-30 20:02:20 +01:00

42 lines
1.2 KiB
Lua

game={
cam={x=0,y=0},
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='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)
setsource(sprites)
actors.draw()
camera(0,0)
balloon.show("HOLA\nQUE TAL?", "usufondo",true)
if hero and not hero.path and hero.dx+hero.dy==0 then
if btn(KEY_DOWN) then
hero.path={pos=0,route='d'}
elseif btn(KEY_UP) then
hero.path={pos=0,route='u'}
elseif btn(KEY_LEFT) then
hero.path={pos=0,route='l'}
elseif btn(KEY_RIGHT) then
hero.path={pos=0,route='r'}
end
end
if beat() then actors.update() end
end
}