- [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

@@ -95,11 +95,11 @@ function ia.update_hero()
--draw.rect(tx1<<3,ty<<3,8,8,8)
--draw.rect(tx2<<3,ty<<3,8,8,28)
if map.tile(tx1,ty) == 0 and map.tile(tx2,ty) == 0 then
if ty+1<rooms.pos.y then
game.change_room(0,-1)
else
--if ty+1<rooms.pos.y then
-- game.change_room(0,-1)
--else
if sprites.hero.jumping > 1 then sprites.hero.pos.y = sprites.hero.pos.y - 1 end
end
--end
else
sprites.hero.jumping = 0
sprites.hero.jump_throttle = 10
@@ -165,6 +165,7 @@ function ia.update_hero()
end
sprites.hero.pos.y = (ty<<3)-1
anim = "hero_stand"
sprites.save_safe_pos()
-- SI ESTÀ SOBRE UNES ESCALERES I POLSA AVALL...
if (map.tile(txm,ty+2) < 16 and map.tile(txm,ty+2) > 0) then
if key.down(key.DOWN) or pad.down(pad.DOWN) then
@@ -261,3 +262,15 @@ function ia.hero_give_key(color)
tweening.add(1,0,0.25,easing.linear,function(value,n,finished)palfade.fade_white(value)end)
return true
end
function ia.hero_reset()
sprites.hero.state = templates.ALIVE
sprites.hero.lives = 4
sprites.hero.surf = surf.load("gfx/morcus.gif")
sprites.hero.animation = "hero_stand"
sprites.hero.current_frame = 1
sprites.hero.current_wait = 1
sprites.hero.flipped = false
sprites.hero.light = 100
sprites.hero.pos = {x=sprites.last_safe_pos.x,y=sprites.last_safe_pos.y}
end