From 5f465b2a74c8976c8749ff9b05b40cbd4956c705 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Fri, 27 Mar 2026 14:02:41 +0100 Subject: [PATCH] - [NEW] El marcador s'amaga quan mors - [NEW] Al morir i apagar-se tot, les llums s'encenen de cero a normal de nou al reviure --- data/modules/score.lua | 10 +++++++--- data/modules/sprites.lua | 3 +++ data/stages/game.lua | 10 ++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/data/modules/score.lua b/data/modules/score.lua index 7f3721d..b8409c9 100644 --- a/data/modules/score.lua +++ b/data/modules/score.lua @@ -6,8 +6,9 @@ score = { font = nil } local me = score -function me.init() - me.points = 0 +function me.init(reinit) + if not reinit then me.points = 0 end + me.ypos = 3 me.surf = surf.load("gfx/sprites.gif") me.font = font.load("gfx/score_font.fnt") end @@ -45,13 +46,16 @@ local function draw_key(sx,sy,dx,dy) end function me.draw() + if sprites.hero.state == templates.DEAD then + if me.ypos > -100 then me.ypos=me.ypos-1 end + end view.origin(0,0) surf.target(0) view.clip() draw_text() - local y = 3 + local y = score.ypos if sprites.hero.keys["verda"] then draw_key(16,48,140,y) y=y+8 end if sprites.hero.keys["groga"] then draw_key(16,56,140,y) y=y+8 end if sprites.hero.keys["roja"] then draw_key(32,48,140,y) y=y+8 end diff --git a/data/modules/sprites.lua b/data/modules/sprites.lua index acda3f7..f658341 100644 --- a/data/modules/sprites.lua +++ b/data/modules/sprites.lua @@ -124,6 +124,9 @@ function sprites.lights_out() spr.light = value if finished then spr.light = nil + if sprites.hero.state == templates.DEAD then + game.restart() + end end end ) diff --git a/data/stages/game.lua b/data/stages/game.lua index a0d35fb..62a5131 100644 --- a/data/stages/game.lua +++ b/data/stages/game.lua @@ -36,6 +36,16 @@ game = { --shader.enable(); end, + restart = function() + rooms.reload() + 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) + score.init(true) + end, + update = function() game.water_counter = game.water_counter + 0.05