- [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:
@@ -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
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user