From cbf265fe4da35f12ef6878acd20c936d30939181 Mon Sep 17 00:00:00 2001 From: JailGamer Date: Tue, 7 Apr 2026 22:32:59 +0200 Subject: [PATCH] [WIP] Continue treballant en el jefe --- data/game.lua | 2 +- data/imp.lua | 139 +++++++++++++++++++++++++++++++------------------- 2 files changed, 87 insertions(+), 54 deletions(-) diff --git a/data/game.lua b/data/game.lua index ad07a16..e2fca9d 100644 --- a/data/game.lua +++ b/data/game.lua @@ -19,7 +19,7 @@ require "imp" require "stage1" require "remote_view" -local DEBUG = true +local DEBUG = false local tile_w = arcade_config.tiles_width local tile_h = arcade_config.tiles_height diff --git a/data/imp.lua b/data/imp.lua index 6d2d9bf..d69fed5 100644 --- a/data/imp.lua +++ b/data/imp.lua @@ -76,7 +76,7 @@ function imp.new(_hab, _x, _y) fight=imp.fight, draw=imp.draw, hit=imp.hit, - direccio=imp.direccio, + -- direccio=imp.direccio, do_jump=imp.do_jump, jump=imp.jump, state_jumping=imp.state_jumping, @@ -112,36 +112,8 @@ function imp:hit() print("HIT!") end -function imp:direccio( actor ) -msg_print(0,0,"direccio",true) - local check_side = "L" - -- definir el punts per a comprobar en el mapa - if self.fight_modes[self.mode]=="away" then - if actor.x>self.x then - -- caminar cap "enrere", check costat esq - check_side = "L" - else - -- caminar cap "endavant", check costat dret - check_side = "R" - end - elseif self.fight_modes[self.mode]=="chase" then - if actor.x>self.x then - -- caminar cap "endavant", check costat dret - check_side = "R" - else - -- caminar cap "enrere", check costat esq - check_side = "L" - end - end - - local step = 1 - if check_side=="L" then step = -step end - - return step -end - function imp:do_jump ( jumpfwd ) -msg_print(0,0,"do_jump",true) +-- msg_print(0,0,"do_jump",true) -- Inicialització de fer el salt jumpfwd = jumpfwd or false self.jump_height = 0 @@ -151,7 +123,7 @@ msg_print(0,0,"do_jump",true) end function imp:state_jumping() - msg_print(0,0,"state_jumping",true) + -- msg_print(0,0,"state_jumping",true) self:reduce_cooldown() -- ?? self.wait=self.wait+1 @@ -169,10 +141,14 @@ function imp:state_jumping() -- cap endavant? if self.jumpfwd then self:advance() end + + self:set_fight_mode() + self.think() + self:controller_input() end function imp:jump() -msg_print(0,0,"jump",true) +-- msg_print(0,0,"jump",true) local vspace = self.vmove_space -- Els dos punts de dalt del personatge local x1_check = self.x+self.bb.x @@ -218,7 +194,7 @@ msg_print(0,0,"jump",true) end function imp:state_walking() -msg_print(0,0,"state_walking",true) +-- msg_print(0,0,"state_walking",true) self:reduce_cooldown() -- Limitar la velocitat de moviment @@ -245,11 +221,14 @@ msg_print(0,0,"state_walking",true) end self:advance() - self:move() + + self:set_fight_mode() + self.think() + self:controller_input() end function imp:state_falling() -msg_print(0,0,"state_falling",true) +-- msg_print(0,0,"state_falling",true) self:reduce_cooldown() self.frame=30 @@ -268,10 +247,14 @@ msg_print(0,0,"state_falling",true) -- Caiguent cap endavant? if self.jumpfwd then self:advance() end + + self:set_fight_mode() + self.think() + self:controller_input() end function imp:land () -msg_print(0,0,"land",true) +-- msg_print(0,0,"land",true) -- Els dos punts de baix de l'abad local x1_check = self.x+self.bb.x local x2_check = self.x+self.bb.x+self.bb.w @@ -297,7 +280,7 @@ msg_print(0,0,"land",true) end function imp:advance() -msg_print(0,0,"advance",true) +-- msg_print(0,0,"advance",true) local step_length=self.step_length; --lo que avança l'abad cada pas local limit=tiletype.block @@ -327,7 +310,7 @@ end -- Controlador principal del personatge function imp:state_normal() -msg_print(0,0,"state_normal",true) +-- msg_print(0,0,"state_normal",true) self:reduce_cooldown() self.frame=28 @@ -335,7 +318,9 @@ msg_print(0,0,"state_normal",true) self.step=0 self.jumpfwd=false self.jump_height = 0 - self:move() + self:set_fight_mode() + self.think() + self:controller_input() end function imp:chase() @@ -366,13 +351,17 @@ function imp:do_flip(actor) if actor.xself.x then +-- -- caminar cap "enrere", check costat esq +-- check_side = "L" +-- else +-- -- caminar cap "endavant", check costat dret +-- check_side = "R" +-- end +-- elseif self.fight_modes[self.mode]=="chase" then +-- if actor.x>self.x then +-- -- caminar cap "endavant", check costat dret +-- check_side = "R" +-- else +-- -- caminar cap "enrere", check costat esq +-- check_side = "L" +-- end +-- end +-- +-- local step = 1 +-- if check_side=="L" then step = -step end +-- +-- return step +-- end \ No newline at end of file