[WIP] Reestructurant codi

[WIP] Stage 2 ja 'arranca'
This commit is contained in:
2026-05-30 22:20:24 +02:00
parent 714ed083d4
commit ef87fd3c25
9 changed files with 214 additions and 203 deletions
+37 -6
View File
@@ -1,6 +1,3 @@
-- stages = {}
-- stages.actors={}
function stages.stage2_init()
-- stagemgr init
@@ -13,12 +10,26 @@ function stages.stage2_init()
-- 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
surf.free(sf_mapa)
sf_mapa=surf.new(s2_mapa_room_cols*s2_mapa_rooms_per_piso,s2_mapa_room_rows*s2_mapa_pisos)
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()
@@ -33,7 +44,6 @@ function stages.stage2_init()
local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y)
viewp:free_move()
-- remote_view_init()
end
function stages.stage2_update()
@@ -60,6 +70,27 @@ 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"