- WIP: Interacció amb els actors

- Levels
- Crec que no fa falta el segon layer
This commit is contained in:
2023-02-02 19:54:46 +01:00
parent 6fc103d355
commit 52c117dffb
6 changed files with 87 additions and 53 deletions

View File

@@ -1,11 +1,12 @@
levels={}
game={
cam={x=0,y=0},
restart=function()
flags={}
objects.list={}
actors.main={name="jailer",x=6,y=9,o="r",gfx={x=32,y=0},level="jail"}
game.init("jail")
actors.main={name="jailer",x=6,y=9,o="r",gfx={x=32,y=0},level="jail1"}
game.init("jail1")
end,
init=function(levelname,f,objs)
@@ -19,32 +20,7 @@ game={
actors.add({name=actors.main.name,x=actors.main.x,y=actors.main.y,o=actors.main.o,gfx=actors.main.gfx})
end
mapa.load(game.level..".map")
actors.add({name="estudiant",x=12,y=8,o="d",gfx={x=64,y=0}})
switches.add({x=8,y=8,w=1,h=3,action=
function()
if not flags.usu1 then
flags.usu1=1
scene.start({
function() actors.add({name="usufondo",x=16,y=8,o="d",gfx={x=0,y=0}}) scene.cont() end,
function() wait.start(1) end,
function() actors.search("usufondo").path={pos=0,route='dlllll'} end,
function() balloon.show("HOY NO HAY JAIL!\nTU MISMO!!",10,"usufondo",false,{x=7,w=10,h=2}) end,
function() objects.collect("diskito_usufondo") end,
function() actors.search("usufondo").path={pos=0,route='rrrrru'} end,
function() wait.start(0.5) end,
function() actors.remove("usufondo") scene.cont() end,
function() wait.start(1) end,
function() balloon.show("IMBÈSIL...",2,"jailer",true,{x=5,w=7,h=1}) end
})
return true
else
return false
end
end
})
levels[game.level].load()
if game.paused then
game.resume()
@@ -154,6 +130,8 @@ game={
hero.path={pos=0,route='l',keys=true}
elseif btn(KEY_RIGHT) then
hero.path={pos=0,route='r',keys=true}
elseif btnp(KEY_SPACE) then
actors.interact(hero.x,hero.y,hero.o)
end
end
if btnp(KEY_ESCAPE) then