[WIP] Cacauaes començant a funcionar

This commit is contained in:
2026-03-29 19:15:17 +02:00
parent 7f4f29ecc2
commit fa74a841e7
4 changed files with 118 additions and 86 deletions

View File

@@ -1,17 +1,21 @@
debug = require "debug"
arcade_config = require("arcade_config")
coords = require "coords"
require "fps"
require "fade"
require "audio"
require "mapa"
require "map"
require "mapa"
require "logo"
require "intro"
require "game"
require "switches"
-- require "scenes"
coords.set_config({
tiles_width = arcade_config.tiles_width,
tiles_height = arcade_config.tiles_height,
@@ -178,3 +182,64 @@ function arc_textB(str, x, y, col, colB)
draw.surf(0,0,sw,sh,x,y,dw,dh)
surf.source(curr_surf_src)
end
-- DEBUG
-- Imprime cualquier valor, incluyendo tablas anidadas
function dump(value, indent)
indent = indent or ""
if type(value) ~= "table" then
return tostring(value)
end
local parts = {"{"}
for k, v in pairs(value) do
local key = (type(k) == "string") and k or "["..tostring(k).."]"
table.insert(parts,
string.format("%s %s = %s,",
indent, key, dump(v, indent.." ")))
end
table.insert(parts, indent.."}")
return table.concat(parts, "\n")
end
function msg_print(x, y, msg, direct_print )
local scr_x, scr_y
direct_print = direct_print or false
if direct_print then
scr_x = x
scr_y = y
else
scr_x, scr_y = viewp:screen_coords(x, y)
end
draw.rectf(scr_x,scr_y,45,7,16)
draw.text(msg,scr_x+1,scr_y+1,2)
end
function view_coord(x, y, w, h, color)
local scr_x, scr_y = viewp:screen_coords(x, y)
draw.rect(scr_x, scr_y, w, h, color)
end
function debug.write_tile(x, y, yplus, print_type, align )
local scr_x, scr_y = viewp:screen_coords(x, y)
local hab, xx, yy = coords.world_to_tile(x, y)
yplus = yplus or 0
print_type = print_type or false
align = align or "R"
local txt_offset = -7
if align=="R" then txt_offset = -14
elseif align=="L" then txt_offset = 0
end
draw.rectf(scr_x+txt_offset,scr_y+yplus,14,7,16)
-- local msg = mapa_get_tile(hab,xx,yy)
local msg = arc_get_tile(x,y)
if print_type then
msg = msg.." "..arc_check_tile(x, y)
end
draw.text(msg,scr_x+txt_offset+1,scr_y+1+yplus,2)
end