- [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:
Binary file not shown.
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
@@ -28,6 +28,11 @@ function ia.update_hero()
|
||||
local move_anim = "hero_walk"
|
||||
|
||||
-- Si estem en cooldown desde l'ultim dispar, decrementem el contador
|
||||
-- Si estem en cooldown desde l'ultim dispar, decrementem el contador
|
||||
if sprites.hero.gun_cooldown > 0 then
|
||||
sprites.hero.gun_cooldown = sprites.hero.gun_cooldown - 1
|
||||
end
|
||||
|
||||
if sprites.hero.cooldown > 0 then
|
||||
sprites.hero.cooldown = sprites.hero.cooldown - 1
|
||||
end
|
||||
@@ -167,7 +172,7 @@ function ia.update_hero()
|
||||
sprites.hero.pos.y = (ty<<3)-1
|
||||
end
|
||||
anim = "hero_stand"
|
||||
sprites.save_safe_pos()
|
||||
if sprites.hero.state == templates.ALIVE then sprites.save_safe_pos() end
|
||||
-- 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
|
||||
@@ -184,9 +189,9 @@ function ia.update_hero()
|
||||
sprites.hero.jumping = 17
|
||||
|
||||
-- SI POLSA DISPAR...
|
||||
elseif (sprites.hero.cooldown==0) and (key.down(key.Z) or pad.down(pad.B)) then
|
||||
elseif (sprites.hero.gun_cooldown==0) and (key.down(key.Z) or pad.down(pad.B)) then
|
||||
sprites.hero.shooting = true
|
||||
sprites.hero.cooldown = 20
|
||||
sprites.hero.gun_cooldown = 20
|
||||
local bullet = templates.create("bullet", {pos={x=sprites.hero.pos.x, y=sprites.hero.pos.y+7}, flipped=sprites.hero.flipped})
|
||||
table.insert(sprites.list, bullet)
|
||||
anim = "hero_shoot"
|
||||
@@ -244,6 +249,7 @@ function ia.hero_hit(live)
|
||||
|
||||
if sprites.hero.lives == 0 then
|
||||
sprites.hero.state = templates.DEAD
|
||||
sprites.hero.invisible = nil
|
||||
sprites.hero.surf = surf.load("gfx/mummy.gif")
|
||||
sprites.set_animation(sprites.hero, "mummy_dying")
|
||||
sprites.hero.jumping = 0
|
||||
@@ -276,4 +282,6 @@ function ia.hero_reset()
|
||||
sprites.hero.flipped = false
|
||||
sprites.hero.light = 100
|
||||
sprites.hero.pos = {x=sprites.last_safe_pos.x,y=sprites.last_safe_pos.y}
|
||||
rooms.go_to_room(sprites.last_safe_room)
|
||||
palfade.init()
|
||||
end
|
||||
@@ -143,3 +143,8 @@ function rooms.toggle_visibility(layer)
|
||||
rooms.visibility = rooms.visibility | layer
|
||||
end
|
||||
end
|
||||
|
||||
function rooms.go_to_room(room)
|
||||
rooms.pos.x = (room % 8) * 20
|
||||
rooms.pos.y = (room // 8) * 13
|
||||
end
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -37,12 +37,13 @@ game = {
|
||||
end,
|
||||
|
||||
restart = function()
|
||||
rooms.reload()
|
||||
--rooms.reload()
|
||||
ia.hero_reset()
|
||||
sprites.add_from_room(rooms.pos.x, rooms.pos.y)
|
||||
pal.set(palfade.original)
|
||||
ia.hero_reset()
|
||||
sprites.hero.light = 0
|
||||
tweening.add(0,100,1,easing.linear,function(value,n,finished)sprites.hero.light = value end)
|
||||
sprites.lights_in()
|
||||
score.init(true)
|
||||
end,
|
||||
|
||||
@@ -72,6 +73,10 @@ game = {
|
||||
|
||||
score.draw()
|
||||
|
||||
view.origin(0,0)
|
||||
draw.text("safe: "..sprites.last_safe_room,1,96,28)
|
||||
--draw.text(sprites.hero.pos.x ..","..sprites.hero.pos.y,14,89,28)
|
||||
|
||||
if key.press(key.ESCAPE) or key.press(key.F9) then
|
||||
rooms.reload()
|
||||
sprites.add_from_room(rooms.pos.x, rooms.pos.y)
|
||||
|
||||
Reference in New Issue
Block a user