- [FIX] Retocs en habitacions

- [FIX] Quan mor, reapareix en l'habitació que toca
- [FIX] Després de morir, al agafar una clau es tornava tot roig infern (que por)
- [FIX] Si no hi havia objectes amb llum en l'habitació on mories, mai resucitaves
- [FIX] Al resucitar, totes les llums s'encenen desde cero, no nomes la teua
- [FIX] Quan t'havien pegat, no podies disparar durant el cooldown
- [FIX] Menos posibilitats de que la "safe position" estiga en un lloc mortal
This commit is contained in:
2026-03-27 20:37:06 +01:00
parent 49396331a7
commit 51f267284e
6 changed files with 56 additions and 13 deletions

View File

@@ -21,11 +21,14 @@ function sprites.remove(sprite)
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
local room = rooms.current()
--local hero_room = (sprites.hero.pos.x//160)*20 + ((sprites.hero.pos.y//104)*12) * 8
--if room ~= hero_room then return end
if room == sprites.last_safe_room then return end
sprites.last_safe_room = room
sprites.last_safe_pos = {x=sprites.hero.pos.x, y=sprites.hero.pos.y}
--print("safepos: " .. sprites.last_safe_pos.x .. ", " .. sprites.last_safe_pos.y)
end
function sprites.add_from_room(rx,ry)
@@ -63,6 +66,7 @@ function sprites.init()
light_ox = 8,
light_oy = 8,
cooldown = 0,
gun_cooldown = 0,
jump_throttle = 0,
lives = 4,
keys = {},
@@ -124,9 +128,9 @@ function sprites.lights_out()
spr.light = value
if finished then
spr.light = nil
if sprites.hero.state == templates.DEAD then
game.restart()
end
--if sprites.hero.state == templates.DEAD then
-- game.restart()
--end
end
end
)
@@ -137,11 +141,32 @@ function sprites.lights_out()
sprites.hero.light = value
if finished then
sprites.hero.light = nil
game.restart()
end
end
)
end
function sprites.lights_in()
for i,spr in ipairs(sprites.list) do
if spr.light then
tweening.add(0,spr.light,0.5,easing.linear,
function(value,n,finished)
spr.light = value
end
)
end
end
-- tweening.add(sprites.hero.light,0,0.5,easing.linear,
-- function(value,n,finished)
-- sprites.hero.light = value
-- if finished then
-- sprites.hero.light = nil
-- end
-- end
-- )
end
function sprites.draw(ignore_selected)
if app.update ~= editor.update then
surf.target(game.circ_buf)