[WIP] Treballant en el jefe. La que s'està liant...

This commit is contained in:
2026-04-15 23:31:19 +02:00
parent 0c9c31dca2
commit 1b812127e2
9 changed files with 834 additions and 48 deletions

View File

@@ -42,12 +42,12 @@ if DEBUG_FN_NAME then print("jump") end
local x1_check = self.x+self.bb.x
local x2_check = self.x+self.bb.x+self.bb.w
local y_check = self.y-vspace; -- posicio de dalt
-- Comprovar on està pegant
local tile1_hit_type= arc_check_tile(x1_check, y_check )
local tile2_hit_type= arc_check_tile(x2_check, y_check)
local not_block_tile = tile1_hit_type ~= tiletype.block and tile2_hit_type ~= tiletype.block
-- Fer l'acció que correspon
if not_block_tile then
-- Ascendir
@@ -76,7 +76,7 @@ if DEBUG_FN_NAME then print("jump") end
end
end
end
-- Registrar el desplaçament
self.jump_height = self.jump_height+1
end
@@ -88,10 +88,10 @@ if not DEBUG_FN_NAME then print("state_walking") end
-- Limitar la velocitat de moviment
self.wait=self.wait+1
-- Funció de selecció de frame
self.next_frame = imp.walking_next_frame
-- Comprovar dos punts de contacte del personatge en el piso a vore si cau
local x1_check = self.x+self.bb.x
local x2_check = x1_check+self.bb.w
@@ -100,11 +100,11 @@ if not DEBUG_FN_NAME then print("state_walking") end
local tile2 = arc_check_tile(x2_check,y_check)
if tile1==tiletype.void and tile2==tiletype.void then
-- si no hi ha piso, caure
-- self.moure=imp.state_falling
self:_moure(imp.state_falling, "state_falling (states)")
self.moure=imp.state_falling
self:_moure(imp.state_falling, "state_falling (states-walking)")
return
end
self:advance()
end
@@ -114,19 +114,19 @@ if DEBUG_FN_NAME then print("state_falling") end
self.frame=30
self.wait=self.wait+1
-- Si toca terra canviar el mode
if self:land() then
-- self.moure=imp.state_normal
self:_moure(imp.state_normal,"state_normal (states)")
return
end
end
print("FALLING!")
-- Seguir caiguent
self.y=self.y+1
self.jump_height = self.jump_height-1
self.falling=self.falling+1
-- Caiguent cap endavant?
if self.jumpfwd then self:advance() end
end
@@ -138,24 +138,24 @@ if DEBUG_FN_NAME then print("land") end
local x1_check = self.x+self.bb.x
local x2_check = self.x+self.bb.x+self.bb.w
local y_check = self.y+self.bb.h
-- Comprovar on està aterrant
local tile1_hit= arc_check_tile(x1_check, y_check )
local tile2_hit= arc_check_tile(x2_check, y_check)
local floor_tile = tile1_hit>=tiletype.half or tile2_hit>=tiletype.half
-- Encara que siga un tile de piso s'ha de comprovar que
-- Encara que siga un tile de piso s'ha de comprovar que
-- la y es un múltiple de l'alt dels tiles
local over_tile = (y_check & 0xF) == 0
local over_tile = (y_check & 0xF) == 0
local can_land = floor_tile and over_tile
if can_land then
self.jump_in_half_block_used = false
self.jump_height = 0
self.action_event = "land"
end
return can_land
end
@@ -164,25 +164,25 @@ if DEBUG_FN_NAME then print("advance") end
-- msg_print(10,20,"advance",true)
local step_length=self.step_length; --lo que avança el imp cada pas
local limit=tiletype.block
if self.moure~=imp.state_walking then limit=tiletype.half end
local x_check = self.x+self.bb.x+self.bb.w+step_length
-- if self.flip then
-- step_length = -step_length
-- if self.flip then
-- step_length = -step_length
-- x_check = self.x+self.bb.x+step_length
-- end
-- self.action=="right"
-- if self.action=="left" then
-- print("ADVANCE => "..self.movement)
if self.movement==self.actions.left then
step_length = -step_length
if self.movement==self.actions.left then
step_length = -step_length
x_check = self.x+self.bb.x+step_length
end
local y_check = self.y+self.bb.h-4
if arc_check_tile(x_check, y_check)<limit then
self.x=self.x+step_length
end