From 074277187c9ef823e7b622f0ac414d9e18ba18bc Mon Sep 17 00:00:00 2001 From: JailGamer Date: Sun, 17 May 2026 20:52:00 +0200 Subject: [PATCH] [FIX] Viewport tremolant al tornar del jefe... per un =... --- data/imp3.lua | 2 +- data/main.lua | 2 +- data/stage1.lua | 2 +- data/stage1_boss.lua | 2 +- data/viewport.lua | 82 +++++++++++++++++++++++++++----------------- 5 files changed, 54 insertions(+), 36 deletions(-) diff --git a/data/imp3.lua b/data/imp3.lua index 8d3811d..c3e3633 100644 --- a/data/imp3.lua +++ b/data/imp3.lua @@ -41,7 +41,7 @@ function imp.new(_hab,_x,_y) pattern= pattern.new(), analisis = {}, -- memoria per a guardar el resultat de l'analisis step_length=1, - energia=21, + energia=1, max_energia=21, jump_height=0, max_jump_height=24, diff --git a/data/main.lua b/data/main.lua index 4ad6d8e..5e099f6 100644 --- a/data/main.lua +++ b/data/main.lua @@ -89,7 +89,7 @@ function mini.init() logo_config(font_sf) surf.target(0) surf.cls(16) - states:executar("logo") + states:executar("game") end function mini.update() diff --git a/data/stage1.lua b/data/stage1.lua index cfbe207..89f5360 100644 --- a/data/stage1.lua +++ b/data/stage1.lua @@ -180,7 +180,7 @@ function stages.stage1_init() tiles_layer2.new(78,6,2,128,208,16,16, tiles_layer2.update_aranya, tiles_layer2.draw_aranya) local abad_x, abad_y = coords.room_to_world ( 10, 4, 3 ) - -- local abad_x, abad_y = coords.room_to_world ( 54, 8, 3 ) + local abad_x, abad_y = coords.room_to_world ( 54, 8, 3 ) -- table.insert( actors, trigger.new(8,4,3,triggers.escena_stage1_ending,"stage1 ending","TR09") ) -- local abad_x, abad_y = coords.room_to_world ( 8, 9, 3 ) diff --git a/data/stage1_boss.lua b/data/stage1_boss.lua index c625feb..d26c7cb 100644 --- a/data/stage1_boss.lua +++ b/data/stage1_boss.lua @@ -83,7 +83,7 @@ end function stages.stage1_boss_intro_update() if stage1_boss.time==0 then - start_scene(scenes.lluita_imp, nil, false) + -- start_scene(scenes.lluita_imp, nil, false) stages.stage1_boss_ready() end diff --git a/data/viewport.lua b/data/viewport.lua index 62a0dfc..9fdff52 100644 --- a/data/viewport.lua +++ b/data/viewport.lua @@ -20,7 +20,8 @@ function viewport.new(_width, _height) range = nil, -- rang de moviment quan està fixat {r= , l=, u=, d= } fixed_coord = nil, -- coordenades fixades smooth_adjust = nil, - adjust_speed = 2 + adjust_speed = 2, + fixed_to_free_position = viewport.fixed_to_free_position } end @@ -66,6 +67,52 @@ function viewport:coord2room () return coords.world_to_room(self.x, self.y) end +function viewport:fixed_to_free_position(nx, ny) + local speed_x = self.adjust_speed + local speed_y = self.adjust_speed + local sm_x = self.smooth_adjust.x + local sm_y = self.smooth_adjust.y + +-- print("FIXED TO FREE") +-- print(" nx,ny= "..nx.." , "..ny) +-- if sm_x~=nil then print(" sm_x= "..sm_x) else print(" sm_x= nil") end +-- if sm_y~=nil then print(" sm_y= "..sm_y) else print(" sm_y= nil") end +-- print(" sp_x,sp_y= "..speed_x.." , "..speed_y) +-- print("") + + -- Ajustar eix X + self.x = nx + if sm_x~=nil then + if math.abs(nx-sm_x)<=speed_x then + sm_x = nil + else + if nx Ajustar suau - local speed_x = self.adjust_speed - local speed_y = self.adjust_speed - local sm_x = self.smooth_adjust.x - local sm_y = self.smooth_adjust.y - self.x = nx - if sm_x~=nil then - if math.abs(nx-sm_x)