101 lines
2.4 KiB
Lua
101 lines
2.4 KiB
Lua
|
|
function stages.stage2_init()
|
|
-- stagemgr init
|
|
stages.actors={}
|
|
stages.boss_loaded = false
|
|
stages.boss_ready = false
|
|
stages.boss_finished = false
|
|
boss = nil
|
|
actors={}
|
|
|
|
-- mapa init
|
|
mapa = stage2_mapa
|
|
|
|
mapa_room_cols = s02_mapa_room_cols
|
|
mapa_room_rows = s02_mapa_room_rows
|
|
mapa_rooms_per_piso = s02_mapa_rooms_per_piso
|
|
mapa_pisos = s02_mapa_pisos
|
|
mapa_empty_tile = s02_mapa_empty_tile
|
|
|
|
tiletype={void=0,nonpc=1,stair=2,switch=3,half=4,block=5}
|
|
mapa.wait=0
|
|
mapa.step=0
|
|
mapa_surface_init()
|
|
load_tilemap( sf_mapa )
|
|
|
|
coords.set_config({
|
|
tiles_width = arcade_config.tiles_width,
|
|
tiles_height = arcade_config.tiles_height,
|
|
room_cols = mapa_room_cols,
|
|
room_rows = mapa_room_rows,
|
|
rooms_per_floor = mapa_rooms_per_piso,
|
|
})
|
|
|
|
-- actors init
|
|
batvio.init()
|
|
table.insert(actors,batvio)
|
|
|
|
-- abad init
|
|
abad.vehicle = "copter"
|
|
local abad_x, abad_y = coords.room_to_world ( 1, 4, 3 )
|
|
abad:move(abad_x, abad_y)
|
|
abad_make_safe( true )
|
|
table.insert(actors,copter)
|
|
|
|
copter.init(abad)
|
|
|
|
-- viewport init
|
|
local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y)
|
|
viewp:free_move()
|
|
end
|
|
|
|
function stages.stage2_update()
|
|
for key,actor in pairs(stages.actors) do
|
|
if viewp:inside(actor.x, actor.y, actor.w, actor.h) and actor~=abad then
|
|
actor:update()
|
|
end
|
|
end
|
|
end
|
|
|
|
function stages.stage2_draw_back()
|
|
for key,actor in pairs(stages.actors) do
|
|
if viewp:inside(actor.x, actor.y, actor.w, actor.h) and actor~=abad then
|
|
actor:draw()
|
|
end
|
|
end
|
|
end
|
|
|
|
function stages.stage2_draw_middle()
|
|
|
|
end
|
|
|
|
function stages.stage2_draw_front()
|
|
|
|
end
|
|
|
|
function stages.stage2_bg_music()
|
|
music_player:play(audio_song_premiere)
|
|
end
|
|
|
|
function stages.stage2_viewport_update()
|
|
-- Moure el viewport
|
|
local vp_x = viewp.x
|
|
local vp_y = viewp.y
|
|
|
|
local vp_center_offset_x = (viewp.width // 2)
|
|
local vp_center_offset_y = (viewp.height // 2)
|
|
|
|
vp_x = abad.x+(abad.w/2) - vp_center_offset_x
|
|
if vp_x < 0 then vp_x = 0 end
|
|
|
|
vp_y = abad.y - vp_center_offset_y
|
|
if vp_y < 0 then vp_y = 0 end
|
|
|
|
viewp:position(vp_x, vp_y)
|
|
end
|
|
|
|
require "stage2_world_map"
|
|
require "stage2_boss_map"
|
|
require "stage2_boss"
|
|
require "stage2_ending"
|