[WIP] Treballant en el jefe. Per fi torna a ser jugable! Ara a pels detalls

This commit is contained in:
2026-04-18 18:45:58 +02:00
parent 8f65666a06
commit dab08a0f17
18 changed files with 144 additions and 2577 deletions

View File

@@ -33,6 +33,7 @@ end
function viewport:free_move()
self.range = nil
if self.fixed_coord~=nil then print ("FIXED COORD= "..self.fixed_coord.x..", "..self.fixed_coord.y) end
self.smooth_adjust = self.fixed_coord
self.fixed_coord = nil
end
@@ -75,33 +76,35 @@ function viewport:position(x, y)
self.y = ny
else
-- viewport lliure després de fixar-lo -> 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 self.smooth_adjust.x~=nil then
if nx<self.smooth_adjust.x-self.adjust_speed then
self.x=self.smooth_adjust.x-self.adjust_speed
self.smooth_adjust.x=self.smooth_adjust.x-self.adjust_speed
elseif nx>self.smooth_adjust.x+self.adjust_speed then
self.x=self.smooth_adjust.x+self.adjust_speed
self.smooth_adjust.x=self.smooth_adjust.x+self.adjust_speed
elseif math.abs(nx-self.smooth_adjust.x)<self.adjust_speed then
self.smooth_adjust.x = nil
if sm_x~=nil then
if math.abs(nx-sm_x)<speed_x then
sm_x = nil
else
if nx<sm_x-speed_x then speed_x = -speed_x end
self.x=sm_x+speed_x
sm_x =sm_x+speed_x
end
self.smooth_adjust.x = sm_x
end
self.y = ny
if self.smooth_adjust.y~=nil then
if ny<self.smooth_adjust.y-self.adjust_speed then
self.y=self.smooth_adjust.y-self.adjust_speed
self.smooth_adjust.y=self.smooth_adjust.y-self.adjust_speed
elseif ny>self.smooth_adjust.y+self.adjust_speed then
self.y=self.smooth_adjust.y+self.adjust_speed
self.smooth_adjust.y=self.smooth_adjust.y-self.adjust_speed
elseif math.abs(ny-self.smooth_adjust.y)<self.adjust_speed then
self.smooth_adjust.y = nil
if sm_y~=nil then
if math.abs(ny-sm_y)<speed_y then
sm_y = nil
else
if ny<sm_y-speed_y then speed_y = -speed_y end
self.y=sm_y+speed_y
sm_y =sm_y+speed_y
end
self.smooth_adjust.y = sm_y
end
if self.smooth_adjust.x == nil and self.smooth_adjust.y == nil then
if sm_x == nil and sm_y == nil then
self.smooth_adjust = nil
end
end