[WIP] Lluita contra jefes. Càrrega de fase redefinida
This commit is contained in:
@@ -123,6 +123,7 @@ function render_map( sf_map, sf_tiles, x, y, target )
|
|||||||
view.origin(0,0)
|
view.origin(0,0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function load_stage()
|
function load_stage()
|
||||||
local stage_init = stages["stage"..stage.."_init"]
|
local stage_init = stages["stage"..stage.."_init"]
|
||||||
if stage_init then
|
if stage_init then
|
||||||
@@ -134,6 +135,18 @@ function load_stage()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function load_boss_stage()
|
||||||
|
local stage_boss = stages["stage"..stage.."_boss"]
|
||||||
|
if stage_boss and not scene_running and not stages.loaded_boss then
|
||||||
|
stage_boss()
|
||||||
|
print("Stage "..stage.." Boss loaded")
|
||||||
|
else
|
||||||
|
print("No se ha cargado la fase "..stage)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function viewport_update()
|
function viewport_update()
|
||||||
-- Moure el viewport
|
-- Moure el viewport
|
||||||
local vp_x = viewp.x
|
local vp_x = viewp.x
|
||||||
@@ -204,6 +217,7 @@ end
|
|||||||
|
|
||||||
function update_game()
|
function update_game()
|
||||||
if stage~=stage_loaded then load_stage() end
|
if stage~=stage_loaded then load_stage() end
|
||||||
|
if stages.boss_ready and not stages.boss_loaded then load_boss_stage() end
|
||||||
|
|
||||||
surf.target(0)
|
surf.target(0)
|
||||||
surf.cls(16)
|
surf.cls(16)
|
||||||
|
|||||||
@@ -34,10 +34,13 @@ function gota.new(_hab,_x,_y,_freq,_x_offset, _y_offset)
|
|||||||
update=gota.update_normal,
|
update=gota.update_normal,
|
||||||
draw=gota.draw_normal,
|
draw=gota.draw_normal,
|
||||||
draw_drop= gota.draw_drop,
|
draw_drop= gota.draw_drop,
|
||||||
bb={x=4,y=0,w=8,h=12}}
|
bb={x=4,y=0,w=8,h=12},
|
||||||
|
enabled= true,
|
||||||
|
disable_reason="" }
|
||||||
end
|
end
|
||||||
|
|
||||||
function gota:draw_normal()
|
function gota:draw_normal()
|
||||||
|
if not self.enabled then return end
|
||||||
local x = gota_gif_col*cw
|
local x = gota_gif_col*cw
|
||||||
local y = gota_gif_row*ch
|
local y = gota_gif_row*ch
|
||||||
local scr_x, scr_y = viewp:screen_coords( self.x, self.y )
|
local scr_x, scr_y = viewp:screen_coords( self.x, self.y )
|
||||||
@@ -48,6 +51,7 @@ function gota:draw_normal()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function gota:update_normal()
|
function gota:update_normal()
|
||||||
|
if not self.enabled then return end
|
||||||
self.wait=self.wait+1
|
self.wait=self.wait+1
|
||||||
|
|
||||||
if self.wait==18 then
|
if self.wait==18 then
|
||||||
@@ -104,6 +108,7 @@ function gota:hit()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function gota:draw_falling()
|
function gota:draw_falling()
|
||||||
|
if not self.enabled then return end
|
||||||
local gota_x, gota_y = viewp:screen_coords( self.x, self.y )
|
local gota_x, gota_y = viewp:screen_coords( self.x, self.y )
|
||||||
draw.circf( gota_x+4, gota_y+12, 4, 16)
|
draw.circf( gota_x+4, gota_y+12, 4, 16)
|
||||||
draw.circf( gota_x+5, gota_y+13, 3, 11)
|
draw.circf( gota_x+5, gota_y+13, 3, 11)
|
||||||
@@ -111,12 +116,14 @@ function gota:draw_falling()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function gota:draw_drop( x, y )
|
function gota:draw_drop( x, y )
|
||||||
|
if not self.enabled then return end
|
||||||
splash_x, splash_y = viewp:screen_coords( x, y )
|
splash_x, splash_y = viewp:screen_coords( x, y )
|
||||||
draw.circf( splash_x, splash_y, 2, 16)
|
draw.circf( splash_x, splash_y, 2, 16)
|
||||||
draw.circf( splash_x, splash_y, 1, 11)
|
draw.circf( splash_x, splash_y, 1, 11)
|
||||||
end
|
end
|
||||||
|
|
||||||
function gota:draw_splash()
|
function gota:draw_splash()
|
||||||
|
if not self.enabled then return end
|
||||||
local splash_L1_x = (self.cx-self.dx)
|
local splash_L1_x = (self.cx-self.dx)
|
||||||
local splash_L2_x = (self.cx-(self.dx/2))
|
local splash_L2_x = (self.cx-(self.dx/2))
|
||||||
local splash_R1_x = (self.cx+self.dx)
|
local splash_R1_x = (self.cx+self.dx)
|
||||||
@@ -131,6 +138,7 @@ function gota:draw_splash()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function gota:update_splash()
|
function gota:update_splash()
|
||||||
|
if not self.enabled then return end
|
||||||
self.dx=self.dx-1
|
self.dx=self.dx-1
|
||||||
self.dy=self.dy+0.25
|
self.dy=self.dy+0.25
|
||||||
self.x=self.cx+self.dx
|
self.x=self.cx+self.dx
|
||||||
|
|||||||
10
data/imp.lua
10
data/imp.lua
@@ -21,7 +21,8 @@ imp={hab=75,
|
|||||||
anim={28,29,28,30},
|
anim={28,29,28,30},
|
||||||
bb={x=4,y=0,w=16,h=32},
|
bb={x=4,y=0,w=16,h=32},
|
||||||
scene_intro=false,
|
scene_intro=false,
|
||||||
scene_object=false}
|
scene_object=false,
|
||||||
|
mode="stop"}
|
||||||
|
|
||||||
function imp.reset()
|
function imp.reset()
|
||||||
imp.hit=imp.hit
|
imp.hit=imp.hit
|
||||||
@@ -83,6 +84,13 @@ function imp.hit()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function imp.update()
|
function imp.update()
|
||||||
|
if mode=="chase" then
|
||||||
|
if abad.x<imp.x then
|
||||||
|
imp.x=imp.x-1
|
||||||
|
elseif abad.x>imp.x then
|
||||||
|
imp.x=imp.x+1
|
||||||
|
end
|
||||||
|
end
|
||||||
-- imp.wait=imp.wait+1
|
-- imp.wait=imp.wait+1
|
||||||
--
|
--
|
||||||
-- if imp.wait==6 then
|
-- if imp.wait==6 then
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ avatar_imp_y = 96
|
|||||||
|
|
||||||
avatar_sf=surf.new(avatar_w, avatar_h)
|
avatar_sf=surf.new(avatar_w, avatar_h)
|
||||||
|
|
||||||
|
scene={
|
||||||
|
running = false,
|
||||||
|
stop_music = true
|
||||||
|
}
|
||||||
|
|
||||||
scenes={
|
scenes={
|
||||||
lluita_imp= {
|
lluita_imp= {
|
||||||
{x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"Eh!?","...","Tu qui eres?"},die=20},
|
{x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"Eh!?","...","Tu qui eres?"},die=20},
|
||||||
@@ -162,28 +167,29 @@ scenes={
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function start_scene(scene,offset)
|
function start_scene(_scene, offset, stop_music)
|
||||||
--bkg=newsurf(128,96)
|
--bkg=newsurf(128,96)
|
||||||
--setdest(bkg)
|
--setdest(bkg)
|
||||||
--setsource(0)
|
--setsource(0)
|
||||||
--draw.surf(0,0,128,96,0,0)
|
--draw.surf(0,0,128,96,0,0)
|
||||||
--setsource(tiles)
|
--setsource(tiles)
|
||||||
--setdest(0)
|
--setdest(0)
|
||||||
scenes.current_scene=scene
|
scenes.current_scene=_scene
|
||||||
scenes.dnum=1
|
scenes.dnum=1
|
||||||
scenes.step=0
|
scenes.step=0
|
||||||
scenes.char=1
|
scenes.char=1
|
||||||
scenes.wait=0
|
scenes.wait=0
|
||||||
scenes.offset=28
|
scenes.offset=28
|
||||||
scenes.die=scenes.current_scene[scenes.dnum].die or 0
|
scenes.die=scenes.current_scene[scenes.dnum].die or 0
|
||||||
if scene[1].musica then
|
if _scene[1].musica then
|
||||||
--print(scene[1].musica)
|
--print(scene[1].musica)
|
||||||
music.play(scenes.current_scene[scenes.dnum].musica)
|
music.play(scenes.current_scene[scenes.dnum].musica)
|
||||||
end
|
end
|
||||||
if offset then scenes.offset=offset end
|
if offset then scenes.offset=offset end
|
||||||
-- old_update=game_update
|
-- old_update=game_update
|
||||||
-- game_update=update_scene
|
-- game_update=update_scene
|
||||||
|
scene.running = true
|
||||||
|
if not stop_music then scene.stop_music = false end
|
||||||
flow:executar("scene", true); -- guardar l'estat anterior i executar
|
flow:executar("scene", true); -- guardar l'estat anterior i executar
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -362,7 +368,7 @@ function update_scene()
|
|||||||
scenes.die=scenes.die-1
|
scenes.die=scenes.die-1
|
||||||
if scenes.die==0 then
|
if scenes.die==0 then
|
||||||
if scenes.dnum==#scenes.current_scene then
|
if scenes.dnum==#scenes.current_scene then
|
||||||
music.stop()
|
if scene.stop_music then music.stop() end
|
||||||
-- if batman.endgame then
|
-- if batman.endgame then
|
||||||
-- final_init()
|
-- final_init()
|
||||||
-- fade.fadeoutin()
|
-- fade.fadeoutin()
|
||||||
@@ -401,7 +407,7 @@ function update_scene()
|
|||||||
controller:check("up") or controller:check("left") or
|
controller:check("up") or controller:check("left") or
|
||||||
controller:check("right") or key.press(key.RETURN) then
|
controller:check("right") or key.press(key.RETURN) then
|
||||||
if scenes.dnum==#scenes.current_scene then
|
if scenes.dnum==#scenes.current_scene then
|
||||||
music.stop()
|
if scenes.stop_music then music.stop() end
|
||||||
-- if batman.endgame then
|
-- if batman.endgame then
|
||||||
-- final_init()
|
-- final_init()
|
||||||
-- fade.fadeoutin()
|
-- fade.fadeoutin()
|
||||||
@@ -421,7 +427,8 @@ function update_scene()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function end_scene()
|
function end_scene()
|
||||||
|
scene.running = false
|
||||||
flow:finish()
|
flow:finish()
|
||||||
end
|
end
|
||||||
|
|
||||||
flow:registrar("scene",{update_scene})
|
flow:registrar("scene",{update_scene, end_scene})
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
stages = {}
|
stages = {}
|
||||||
|
|
||||||
|
stages.boss_ready = false
|
||||||
|
stages.boss_loaded = false
|
||||||
|
|
||||||
function stages.stage1_init()
|
function stages.stage1_init()
|
||||||
mapa = stage1_mapa
|
mapa = stage1_mapa
|
||||||
tiletype={void=0,nonpc=1,stair=2,switch=3,half=4,block=5}
|
tiletype={void=0,nonpc=1,stair=2,switch=3,half=4,block=5}
|
||||||
@@ -108,17 +111,27 @@ function stages.stage1_init()
|
|||||||
remote_view_init()
|
remote_view_init()
|
||||||
|
|
||||||
viewp:free_move()
|
viewp:free_move()
|
||||||
|
|
||||||
|
stages.boss_ready = false
|
||||||
|
stages.boss_loaded = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function stages.stage2_init()
|
function stages.stage2_init()
|
||||||
print("stage 2 init")
|
print("stage 2 init")
|
||||||
end
|
end
|
||||||
|
|
||||||
function stage1_boss()
|
function stages.stage1_boss_ready()
|
||||||
load_tilemap( sf_mapa, stage1_boss_mapa )
|
stages.boss_ready = true
|
||||||
-- actors_in_room_backup_and_remove(stage1_boss_mapa.r0.r,stage1_boss_mapa.r1.r)
|
end
|
||||||
set_actors_enabled_by_room(false, "boss", stage1_boss_mapa.r0.r, stage1_boss_mapa.r1.r)
|
|
||||||
viewp:fixed({l=8,r=44,u=0,d=0})
|
function stages.stage1_boss()
|
||||||
|
if not scene.running and not stages.boss_loaded then
|
||||||
|
set_actors_enabled_by_room(false, "boss", stage1_boss_mapa.r0.r, stage1_boss_mapa.r1.r)
|
||||||
|
load_tilemap( sf_mapa, stage1_boss_mapa )
|
||||||
|
-- actors_in_room_backup_and_remove(stage1_boss_mapa.r0.r,stage1_boss_mapa.r1.r)
|
||||||
|
viewp:fixed({l=8,r=44,u=48,d=0})
|
||||||
|
stages.boss_loaded = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
stage1_mapa={
|
stage1_mapa={
|
||||||
@@ -962,43 +975,61 @@ stage1_boss_mapa = {
|
|||||||
map = {
|
map = {
|
||||||
-- 44
|
-- 44
|
||||||
{
|
{
|
||||||
|
256,256,256, 17, 18, 19, 18, 19, 18, 19, 18, 19,
|
||||||
256,256,256, 17,256,256,256,256,256,256,256,256,
|
256,256,256, 17,256,256,256,256,256,256,256,256,
|
||||||
256,256,256, 17,256,256,256,256,256,256,256,256,
|
256,256,256, 17,256,256,256,256,256,256,256,256,
|
||||||
256,256,256, 17,256,256,256,256,256,256,256,256,
|
256,256,256, 17,256, 1,256,256,256,256,256,256,
|
||||||
256,256,256, 17,256,256,256,256,256,256,256,256,
|
256,256,256, 17,256,256, 1,256,256,256,256, 41,
|
||||||
256,256,256, 17,256,256,256,256,256,256,256,256,
|
256,256,256, 17,256, 1,256,256,256,256,256,256,
|
||||||
256,256,256, 17,256,256,256,256,256,256,256,256,
|
|
||||||
},
|
},
|
||||||
-- 45
|
-- 45
|
||||||
{
|
{
|
||||||
|
18, 19, 18, 19, 18, 19, 18, 19, 18, 19, 17,256,
|
||||||
256,256,256,256,256,256,256,256,256,256, 17,256,
|
256,256,256,256,256,256,256,256,256,256, 17,256,
|
||||||
256,256,256,256,256,256,256,256,256,256, 17,256,
|
256,256,256,256,256,256,256,256,256,256, 17,256,
|
||||||
256,256,256,256,256,256,256,256,256,256, 17,256,
|
256,256,256,256,256,256,256,256, 2,256, 17,256,
|
||||||
256,256,256,256,256,256,256,256,256,256, 17,256,
|
256,256, 41,256,256,256,256, 2,256,256, 17,256,
|
||||||
256,256,256,256,256,256,256,256,256,256, 17,256,
|
256,256,256,256,256,256,256,256, 2,256, 17,256,
|
||||||
256,256,256,256,256,256,256,256,256,256, 17,256,
|
|
||||||
},
|
},
|
||||||
-- 54
|
-- 54
|
||||||
{
|
{
|
||||||
256,256,256, 17,256,256,256,256,256,256,256,256,
|
256,256,256, 17,256,256, 1,256,256,256,256, 4,
|
||||||
256,256,256, 17,256,256,256,256,256,256,256,256,
|
256,256,256, 17,256, 1,256,256,256,256,256,256,
|
||||||
256,256,256, 17,256,256,256,256,256,256,256,256,
|
256,256,256, 17,256,256, 1,256,256,256,256,256,
|
||||||
256,256,256, 17,256,256,256,256,256,256,256,256,
|
256,256,256, 17,256, 1,256,256,256,256,256,256,
|
||||||
256,256,256, 17,256,256,256,256,256,256,256,256,
|
256,256,256, 17,256,256, 1,256,256,256,256,256,
|
||||||
20, 21, 20, 21, 54, 55, 54, 55, 54, 55, 54, 56,
|
20, 21, 20, 21, 54, 55, 54, 55, 54, 55, 54, 56,
|
||||||
|
|
||||||
},
|
},
|
||||||
-- 55
|
-- 55
|
||||||
{
|
{
|
||||||
256,256,256,256,256,256,256,256,256,256,17,256,
|
22, 22, 5,256,256,256,256, 2,256,256,17,256,
|
||||||
256,256,256,256,256,256,256,256,256,256,17,256,
|
256,256,256,256,256,256,256,256, 2,256,17,256,
|
||||||
256,256,256,256,256,256,256,256,256,256,17,256,
|
256,256,256,256,256,256,256, 2,256,256,17,256,
|
||||||
256,256,256,256,256,256,256,256,256,256,17,256,
|
256,256,256,256,256,256,256,256, 2,256,17,256,
|
||||||
256,256,256,256,256,256,256,256,256,256,17,256,
|
256,256,256,256,256,256,256, 2,256,256,17,256,
|
||||||
54, 55, 54, 56, 56, 55, 54, 56, 54, 56,55, 54,
|
54, 55, 54, 56, 56, 55, 54, 56, 54, 56,55, 54,
|
||||||
|
|
||||||
}
|
},
|
||||||
|
-- 64
|
||||||
|
{
|
||||||
|
26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27,
|
||||||
|
26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27,
|
||||||
|
26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27,
|
||||||
|
26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27,
|
||||||
|
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||||
|
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||||
|
},
|
||||||
|
-- 65
|
||||||
|
{
|
||||||
|
26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27,
|
||||||
|
26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27,
|
||||||
|
26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27,
|
||||||
|
26, 27, 26, 27, 26, 27, 26, 27, 26, 27, 26, 27,
|
||||||
|
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||||
|
256,256,256,256,256,256,256,256,256,256,256,256,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
r0 = {r=44, x=1, y=1},
|
r0 = {r=44, x=1, y=1},
|
||||||
r1 = {r=55, x=12, y=6}
|
r1 = {r=65, x=12, y=6}
|
||||||
}
|
}
|
||||||
@@ -131,9 +131,9 @@ function triggers:escena_habitacio_batman()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function triggers:escena_lluita_imp()
|
function triggers:escena_lluita_imp()
|
||||||
stage1_boss()
|
start_scene(scenes.lluita_imp, nil, false)
|
||||||
start_scene(scenes.lluita_imp)
|
|
||||||
remove_actor(self)
|
remove_actor(self)
|
||||||
|
stages.stage1_boss_ready()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- function triggers:teleport_a()
|
-- function triggers:teleport_a()
|
||||||
|
|||||||
Reference in New Issue
Block a user