- [NEW] guardem una safe_pos al entrar en cada habitació

- [FIX] Al morir, o tornar al editor, se reseteja l'heroi
- [FIX] Ja no canvia d'habitació al asomar el cabet per dalt al botar
- [NEW] Més habitacions (21%)
This commit is contained in:
2026-03-23 18:46:27 +01:00
parent 130c5d62e1
commit a98a46a3d2
7 changed files with 27 additions and 18 deletions

View File

@@ -5,6 +5,9 @@ sprites = {
hero = nil,
list = {},
pause_ia = false,
--initial_pos = { x=28, y=4*13*8+79 }
last_safe_room = 0 + 4 * 8,
last_safe_pos = { x=28, y=4*13*8+79 }
}
function sprites.remove(sprite)
@@ -17,15 +20,12 @@ function sprites.remove(sprite)
end
end
function sprites.remove_out_of_room()
--print("Current room: "..rooms.current())
--for i,v in ipairs(sprites.list) do
-- if v.room ~= rooms.current() then
-- table.remove(sprites.list, i)
-- local room = v.room or 0
-- print("Sprite at room "..room.." removed: "..v.type)
-- end
--end
function sprites.save_safe_pos()
local room = (rooms.pos.x//20) + (rooms.pos.y//12) * 8
if room ~= sprites.last_safe_room then
sprites.last_safe_room = room
sprites.last_safe_pos = {x=sprites.hero.pos.x, y=sprites.hero.pos.y}
end
end
function sprites.add_from_room(rx,ry)