- WIP: Interacció amb els actors
- Levels - Crec que no fa falta el segon layer
This commit is contained in:
@@ -60,6 +60,20 @@ actors={
|
|||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
interact=function(x,y,o)
|
||||||
|
for i,actor in ipairs(actors.list) do
|
||||||
|
if o=='d' then
|
||||||
|
if actor.x==x and actor.y==y+1 then if actor.action then actor.action() end end
|
||||||
|
elseif o=='u' then
|
||||||
|
if actor.x==x and actor.y==y-1 then if actor.action then actor.action() end end
|
||||||
|
elseif o=='l' then
|
||||||
|
if actor.y==y and actor.x==x-2 then if actor.action then actor.action() end end
|
||||||
|
elseif o=='r' then
|
||||||
|
if actor.y==y and actor.x==x+2 then if actor.action then actor.action() end end
|
||||||
|
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
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ config=ja2
|
|||||||
width=160
|
width=160
|
||||||
height=144
|
height=144
|
||||||
zoom=5
|
zoom=5
|
||||||
files=fade.lua,objects.lua,wait.lua,switches.lua,scene.lua,balloon.lua,actors.lua,game.lua,mapa.lua,editor.lua,textbox.lua,menu.lua,main.lua
|
files=fade.lua,objects.lua,wait.lua,switches.lua,scene.lua,balloon.lua,actors.lua,game.lua,mapa.lua,editor.lua,textbox.lua,menu.lua,m_jail1.lua,main.lua
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
|
levels={}
|
||||||
game={
|
game={
|
||||||
cam={x=0,y=0},
|
cam={x=0,y=0},
|
||||||
|
|
||||||
restart=function()
|
restart=function()
|
||||||
flags={}
|
flags={}
|
||||||
objects.list={}
|
objects.list={}
|
||||||
actors.main={name="jailer",x=6,y=9,o="r",gfx={x=32,y=0},level="jail"}
|
actors.main={name="jailer",x=6,y=9,o="r",gfx={x=32,y=0},level="jail1"}
|
||||||
game.init("jail")
|
game.init("jail1")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
init=function(levelname,f,objs)
|
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})
|
actors.add({name=actors.main.name,x=actors.main.x,y=actors.main.y,o=actors.main.o,gfx=actors.main.gfx})
|
||||||
end
|
end
|
||||||
|
|
||||||
mapa.load(game.level..".map")
|
levels[game.level].load()
|
||||||
|
|
||||||
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
|
|
||||||
})
|
|
||||||
|
|
||||||
if game.paused then
|
if game.paused then
|
||||||
game.resume()
|
game.resume()
|
||||||
@@ -154,6 +130,8 @@ game={
|
|||||||
hero.path={pos=0,route='l',keys=true}
|
hero.path={pos=0,route='l',keys=true}
|
||||||
elseif btn(KEY_RIGHT) then
|
elseif btn(KEY_RIGHT) then
|
||||||
hero.path={pos=0,route='r',keys=true}
|
hero.path={pos=0,route='r',keys=true}
|
||||||
|
elseif btnp(KEY_SPACE) then
|
||||||
|
actors.interact(hero.x,hero.y,hero.o)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if btnp(KEY_ESCAPE) then
|
if btnp(KEY_ESCAPE) then
|
||||||
|
|||||||
@@ -1,39 +1,21 @@
|
|||||||
20
|
20
|
||||||
18
|
18
|
||||||
2
|
1
|
||||||
17,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,27,17,
|
17,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,27,17,
|
||||||
17,16,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,18,17,
|
17,16,23,24,23,24,23,24,23,24,23,24,23,24,23,24,23,24,18,17,
|
||||||
17,16,39,40,39,40,39,40,39,40,39,40,39,40,39,40,39,40,18,17,
|
17,16,39,40,39,40,39,40,39,40,39,40,39,40,39,40,39,40,18,17,
|
||||||
17,16,55,56,55,56,55,56,55,56,55,56,55,56,55,56,55,56,18,17,
|
17,16,55,56,55,56,55,56,55,56,55,56,55,56,55,56,55,56,18,17,
|
||||||
17,16,10,11,12,13,5,2,10,11,12,13,5,2,10,11,12,13,18,17,
|
17,16,5,2,5,2,5,2,5,2,5,2,5,2,5,2,5,2,18,17,
|
||||||
17,16,87,88,89,90,5,2,87,88,89,90,5,2,87,88,89,90,18,17,
|
17,16,87,88,89,90,5,2,87,88,89,90,5,2,87,88,89,90,18,17,
|
||||||
17,16,10,11,12,13,5,2,10,11,12,13,5,2,10,11,12,13,18,17,
|
17,16,5,2,5,2,5,2,5,2,5,2,5,2,5,2,5,2,18,17,
|
||||||
17,16,87,88,89,90,5,2,87,88,89,90,5,2,64,65,66,65,18,17,
|
17,16,87,88,89,90,5,2,87,88,89,90,5,2,64,65,66,65,18,17,
|
||||||
17,16,10,11,12,13,5,2,10,11,12,13,5,2,80,81,82,81,18,17,
|
17,16,5,2,5,2,5,2,5,2,5,2,5,2,80,81,82,81,18,17,
|
||||||
17,16,87,88,89,90,5,2,87,88,89,90,5,2,96,97,97,98,18,17,
|
17,16,87,88,89,90,5,2,87,88,89,90,5,2,96,97,97,98,18,17,
|
||||||
17,16,10,11,12,13,5,2,10,11,12,13,5,2,5,2,5,3,18,17,
|
17,16,5,2,5,2,5,2,5,2,5,2,5,2,5,2,5,3,18,17,
|
||||||
17,16,87,88,89,90,5,2,87,88,89,90,5,2,5,2,5,2,18,17,
|
17,16,87,88,89,90,5,2,87,88,89,90,5,2,5,2,5,2,18,17,
|
||||||
17,16,10,11,12,13,5,2,10,11,12,13,5,2,5,2,5,2,18,17,
|
17,16,5,2,5,2,5,2,5,2,5,2,5,2,5,2,5,2,18,17,
|
||||||
17,16,87,88,89,90,5,2,87,88,89,90,5,2,5,2,5,2,18,17,
|
17,16,87,88,89,90,5,2,87,88,89,90,5,2,5,2,5,2,18,17,
|
||||||
17,16,5,2,5,2,5,2,5,2,5,2,5,2,14,15,12,13,18,17,
|
17,16,5,2,5,2,5,2,5,2,5,2,5,2,14,15,12,13,18,17,
|
||||||
17,32,33,33,33,48,5,2,49,33,33,48,5,2,49,33,33,33,34,17,
|
17,32,33,33,33,48,5,2,49,33,33,48,5,2,49,33,33,33,34,17,
|
||||||
17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
|
17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
|
||||||
17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
|
17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,71,72,71,72,0,0,71,72,71,72,0,0,71,72,71,72,0,0,
|
|
||||||
0,0,67,68,69,70,0,0,67,68,69,70,0,0,67,68,69,70,0,0,
|
|
||||||
0,0,71,72,71,72,0,0,71,72,71,72,0,0,71,72,71,72,0,0,
|
|
||||||
0,0,67,68,69,70,0,0,67,68,69,70,0,0,67,68,69,70,0,0,
|
|
||||||
0,0,71,72,71,72,0,0,71,72,71,72,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,67,68,69,70,0,0,67,68,69,70,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,71,72,71,72,0,0,71,72,71,72,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,67,68,69,70,0,0,67,68,69,70,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,71,72,71,72,0,0,71,72,71,72,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,67,68,69,70,0,0,67,68,69,70,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,71,72,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,83,84,69,70,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
|
||||||
|
|||||||
60
data/m_jail1.lua
Normal file
60
data/m_jail1.lua
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
levels["jail1"]={
|
||||||
|
load=function()
|
||||||
|
mapa.load("jail.map")
|
||||||
|
|
||||||
|
actors.add({name="estudiant",x=12,y=8,o="d",gfx={x=64,y=0}})
|
||||||
|
actors.add({name="comp_1_1",x=2,y=5,o="d",gfx={x=96,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
actors.add({name="comp_2_1",x=4,y=5,o="d",gfx={x=112,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
actors.add({name="comp_1_2",x=2,y=7,o="d",gfx={x=96,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
actors.add({name="comp_2_2",x=4,y=7,o="d",gfx={x=112,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
actors.add({name="comp_1_3",x=2,y=9,o="d",gfx={x=96,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
actors.add({name="comp_2_3",x=4,y=9,o="d",gfx={x=112,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
actors.add({name="comp_1_4",x=2,y=11,o="d",gfx={x=96,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
actors.add({name="comp_2_4",x=4,y=11,o="d",gfx={x=112,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
actors.add({name="comp_1_5",x=2,y=13,o="d",gfx={x=96,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
actors.add({name="comp_2_5",x=4,y=13,o="d",gfx={x=112,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
|
||||||
|
actors.add({name="comp_3_1",x=8,y=5,o="d",gfx={x=96,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
actors.add({name="comp_4_1",x=10,y=5,o="d",gfx={x=112,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
actors.add({name="comp_3_2",x=8,y=7,o="d",gfx={x=96,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
actors.add({name="comp_4_2",x=10,y=7,o="d",gfx={x=112,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
actors.add({name="comp_3_3",x=8,y=9,o="d",gfx={x=96,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
actors.add({name="comp_4_3",x=10,y=9,o="d",gfx={x=112,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
actors.add({name="comp_3_4",x=8,y=11,o="d",gfx={x=96,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
actors.add({name="comp_4_4",x=10,y=11,o="d",gfx={x=112,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
actors.add({name="comp_3_5",x=8,y=13,o="d",gfx={x=96,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
actors.add({name="comp_4_5",x=10,y=13,o="d",gfx={x=112,y=0},action=levels.jail1.comp_updating_action})
|
||||||
|
|
||||||
|
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
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
|
||||||
|
comp_updating_action=function()
|
||||||
|
local hero = actors.search(actors.main.name)
|
||||||
|
if hero.o~="d" then return end
|
||||||
|
scene.start({
|
||||||
|
function() balloon.show("NO VAN ELS COMPS\nESTAN TOTS ACTUALITZANT",2,"jailer",true,{x=1,w=15,h=2}) end
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
|
||||||
|
}
|
||||||
BIN
data/sprites.gif
BIN
data/sprites.gif
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.5 KiB |
Reference in New Issue
Block a user