ef87fd3c25
[WIP] Stage 2 ja 'arranca'
135 lines
3.3 KiB
Lua
135 lines
3.3 KiB
Lua
stage1_boss ={
|
|
time = 0,
|
|
out_x = 0,
|
|
out_y = 0,
|
|
out_speed = 8,
|
|
}
|
|
|
|
function stages.stage1_boss_ready()
|
|
print("READY")
|
|
stages.boss_ready = true
|
|
stages.boss_finished = false
|
|
end
|
|
|
|
function stages.stage1_boss_update()
|
|
-- print("stage1_update")
|
|
fireball.update()
|
|
-- if (abad.energia<=abad.max_energia/2) then
|
|
-- -- Requeriment: tindre mitja clau
|
|
-- premiere.healer_init()
|
|
-- end
|
|
end
|
|
|
|
function stages.stage1_boss_draw_back()
|
|
-- print("stage1_draw_back")
|
|
end
|
|
|
|
function stages.stage1_boss_draw_middle()
|
|
-- print("stage1_draw_middle")
|
|
end
|
|
|
|
function stages.stage1_boss_draw_front()
|
|
-- print("stage1_draw_front")
|
|
fireball.draw()
|
|
boss_meter:draw()
|
|
end
|
|
|
|
function stages.stage1_boss_bg_music()
|
|
-- music_player:play(audio_song_premiere)
|
|
end
|
|
|
|
function stages.stage1_boss_viewport_update()
|
|
-- Moure el viewport
|
|
stages.stage1_viewport_update()
|
|
end
|
|
|
|
|
|
function stages.stage1_boss_finished()
|
|
stages.boss_ready = true
|
|
stages.boss_finished = true
|
|
end
|
|
|
|
-- INTRO FUNCTIONS
|
|
function stages.stage1_boss_intro_init()
|
|
trigger_event.new("Premiere Boss 1",
|
|
trigger_ev.premiere_boss1_trigger,
|
|
trigger_ev.premiere_healer_init,
|
|
premiere.healer_update)
|
|
load_tilemap( sf_mapa, stage1_boss_mapa )
|
|
set_actors_enabled_by_room(false, "boss", stage1_boss_mapa.r0.r, stage1_boss_mapa.r1.r)
|
|
viewp:fixed({l=24,r=28,u=0,d=0}, viewp.x, viewp.y-48)
|
|
boss.enabled=true
|
|
boss.reason=""
|
|
boss:fight()
|
|
-- load_boss_stage()
|
|
stages.load_boss_stage()
|
|
states:next()
|
|
end
|
|
|
|
function stages.stage1_boss_intro_update()
|
|
if stage1_boss.time==0 then
|
|
-- start_scene(scenes.lluita_imp, nil, false)
|
|
stages.stage1_boss_ready()
|
|
end
|
|
|
|
-- Acabar
|
|
if stage1_boss.time>=1 then
|
|
states:next()
|
|
end
|
|
|
|
stage1_boss.time = stage1_boss.time + 1
|
|
end
|
|
|
|
function stages.stage1_boss_intro_end()
|
|
stage1_boss.out_x = 0
|
|
stage1_boss.out_y = 0
|
|
stage1_boss.out_speed = 12
|
|
states:finish()
|
|
end
|
|
|
|
-- OUTRO FUNCTION
|
|
function stages.stage1_boss_outro_update()
|
|
stage1_boss.time = stage1_boss.time + 1
|
|
-- black out
|
|
if stage1_boss.time%stage1_boss.out_speed==0 then
|
|
if stage1_boss.out_x==8 then
|
|
stage1_boss.out_x = 0
|
|
stage1_boss.out_y = stage1_boss.out_y+1
|
|
end
|
|
|
|
draw.rectf(stage1_boss.out_x*32,stage1_boss.out_y*32,32,32,16)
|
|
stage1_boss.out_x = stage1_boss.out_x +1
|
|
if stage1_boss.out_speed>1 then stage1_boss.out_speed = stage1_boss.out_speed -1 end
|
|
end
|
|
|
|
if stage1_boss.out_y>=6 then
|
|
states:next()
|
|
end
|
|
end
|
|
|
|
function stages.stage1_boss_outro_end()
|
|
local abad_x, abad_y = coords.room_to_world ( 54, 9, 3 )
|
|
abad:move(abad_x, abad_y)
|
|
abad_make_safe( true )
|
|
stages.stage1_boss_finished()
|
|
remove_actor(boss)
|
|
stages.unload_boss_stage()
|
|
music.stop()
|
|
mapa_restore_backup()
|
|
set_actors_enabled_by_room(true, "boss", stage1_boss_mapa.r0.r, stage1_boss_mapa.r1.r)
|
|
viewp:free_move()
|
|
states:finish()
|
|
end
|
|
|
|
|
|
-- STATES REGISTRY
|
|
states:registrar("stage1_boss_intro",{
|
|
stages.stage1_boss_intro_init,
|
|
stages.stage1_boss_intro_update,
|
|
stages.stage1_boss_intro_end
|
|
})
|
|
|
|
states:registrar("stage1_boss_outro",{
|
|
stages.stage1_boss_outro_update,
|
|
stages.stage1_boss_outro_end
|
|
}) |