[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
+20 -2
View File
@@ -15,7 +15,7 @@ function stages.stage1_init()
mapa_room_rows = s01_mapa_room_rows
mapa_rooms_per_piso = s01_mapa_rooms_per_piso
mapa_pisos = s01_mapa_pisos
mapa_empty_tile = s01_mapa_empty_tile
mapa_empty_tile = s01_mapa_empty_tile
tiletype={void=0,nonpc=1,stair=2,switch=3,half=4,block=5}
mapa.wait=0
@@ -204,11 +204,12 @@ function stages.stage1_init()
-- abad init
local abad_x, abad_y = coords.room_to_world ( 10, 4, 3 )
-- local abad_x, abad_y = coords.room_to_world ( 54, 8, 3 )
local abad_x, abad_y = coords.room_to_world ( 54, 8, 3 )
-- local abad_x, abad_y = coords.room_to_world ( 8, 9, 3 )
abad:move(abad_x, abad_y)
abad_make_safe( true )
-- viewport init
local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y)
viewp:free_move()
end
@@ -245,6 +246,23 @@ function stages.stage1_bg_music()
music_player:play(audio_song_premiere)
end
function stages.stage1_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
function stages.stage1_toBatcave()
local switches_enabled = 0