SCROLLING! I canviat a map

This commit is contained in:
2026-03-19 21:28:15 +01:00
parent f8669133c4
commit 4286eb27fa
4 changed files with 50 additions and 147 deletions

View File

@@ -5,6 +5,35 @@ require "map"
local arcade_config = require("arcade_config")
function load_tilemap( sf_mapa )
local mapa_tw, mapa_th = surf.size(sf_mapa)
local nrooms = mapa_rooms_per_piso*mapa_pisos
local x = 0
local y = 0
local yroom = 0
local xroom = 0
map.surf(sf_mapa)
for ty=0,mapa_th-1 do
if y == mapa_room_rows then
yroom = yroom + mapa_rooms_per_piso
y = 0
end
xroom = yroom
for tx=0,mapa_tw-1 do
local tile=mapa[1+xroom][1+x+y*mapa_room_cols]
if tile<128 then tile= tile + 128 end
map.tile(tx, ty, tile)
x = x + 1
if x == mapa_room_cols then
x = 0
xroom = xroom + 1
end
end
y = y +1
end
end
function mini.init()
tiles=surf.load("tiles.gif")
surf.source(tiles)
@@ -13,16 +42,8 @@ function mini.init()
logo=surf.new(arcade_config.logo_sf.width,arcade_config.logo_sf.height)
back=surf.new(arcade_config.surface.width,arcade_config.surface.height)
-- buffer per a 3x3 habitacions
-- local map_buffer_width = 3*mapa_room_cols*arcade_config.tiles_width
-- local map_buffer_height = 3*mapa_room_rows*arcade_config.tiles_height
-- local map_buffer_width = arcade_config.surface.width+2*arcade_config.tiles_width
local map_buffer_width = arcade_config.surface.width
-- local map_buffer_height = arcade_config.surface.height+2*arcade_config.tiles_height
local map_buffer_height = arcade_config.surface.height
map_buffer=surf.new(map_buffer_width,map_buffer_height)
map_buffer_extra_V=surf.new(arcade_config.tiles_width,map_buffer_height)
map_buffer_extra_H=surf.new(map_buffer_width,arcade_config.tiles_height)
sf_mapa=surf.new(mapa_room_cols*mapa_rooms_per_piso,mapa_room_rows*mapa_pisos)
load_tilemap( sf_mapa )
fade.init()
textsf=surf.new(arcade_config.org_resolucion.width,arcade_config.org_resolucion.height)