diff --git a/pepe_runner_dx.lua b/pepe_runner_dx.lua index 0f395b1..3fbfaaf 100644 --- a/pepe_runner_dx.lua +++ b/pepe_runner_dx.lua @@ -170,13 +170,20 @@ function carregar_mapa(num) end end -function pintar_mapa() +-- offset_x permet desplacar tot el mapa horitzontalment al pintar +-- (s'usa al title per a centrar millor el logo, que esta lleugerament +-- esbiaixat a l'esquerra en el 0.map original). +function pintar_mapa(offset_x) + offset_x = offset_x or 0 for x = 0, MAP_W-1 do - for y = 0, MAP_H-1 do - local c = mapa[x][y] - if c.tipo ~= BUIT then - color(c.color, colors.bg) - print(chr(glif[c.tipo]), x, y) + local px = x + offset_x + if px >= 0 and px < MAP_W then + for y = 0, MAP_H-1 do + local c = mapa[x][y] + if c.tipo ~= BUIT then + color(c.color, colors.bg) + print(chr(glif[c.tipo]), px, y) + end end end end @@ -367,7 +374,7 @@ function update_title() end neteja_fons() - pintar_mapa() + pintar_mapa(1) -- desplacem +1 col per a centrar el logo de map 0 -- Missatge parpadejant ("Prem l'espai per a jugar") if flr(cnt() / 30) % 2 == 0 then