diff --git a/data/game.lua b/data/game.lua index 7015485..ad07a16 100644 --- a/data/game.lua +++ b/data/game.lua @@ -198,7 +198,19 @@ end function world_draw() -- Pintar la finestra del mon render_map(sf_mapa, tiles, viewp.x, viewp.y) - + + if #stages.boss_hot_points>0 then + for _, p in pairs(stages.boss_hot_points) do + p:draw() + end + -- local world_x, world_y = coords.room_to_world(45,2,1) + -- local scr_x, scr_y = viewp:screen_coords( world_x, world_y ) + -- draw.line(scr_x, scr_y, scr_x, scr_y+25, 12) + -- draw.line(scr_x, scr_y+25, scr_x+15, scr_y+25, 12) + -- draw.line(scr_x+15, scr_y+25, scr_x+15, scr_y+35, 12) + -- draw.line(scr_x+15, scr_y+35, scr_x+45, scr_y+35, 12) + end + -- pintar warps for key,warp in pairs(warp.warp_list) do if viewp:inside(warp.x, warp.y, warp.w, warp.h) then diff --git a/data/imp.lua b/data/imp.lua index 69a17f9..6d2d9bf 100644 --- a/data/imp.lua +++ b/data/imp.lua @@ -50,7 +50,7 @@ function imp.new(_hab, _x, _y) step=0, hurting=0, jumpfwd=false, - step_length=0.6, + step_length=0.7, vmove_space=1, max_jump_height=24, jump_height=0, @@ -223,14 +223,8 @@ msg_print(0,0,"state_walking",true) -- Limitar la velocitat de moviment self.wait=self.wait+1 - - -- representació del moviment - -- if self.wait==6 then - -- self.wait=0 - -- self.step=(self.step+1)%2 - -- self.frame=self.anim[self.step+1] - -- end + -- representació del moviment -- Selecció de frame if self.wait==6 then self.wait=0 @@ -258,8 +252,6 @@ function imp:state_falling() msg_print(0,0,"state_falling",true) self:reduce_cooldown() - -- print("state_falling") - self.frame=30 self.wait=self.wait+1 @@ -380,8 +372,6 @@ msg_print(0,0,"move",true) self.action = self:movement(abad) - -- print(action) - if self.action == "right" or self.action == "left" then self.update=imp.state_walking -- abad.flip=false diff --git a/data/main.lua b/data/main.lua index 857af47..641ec4e 100644 --- a/data/main.lua +++ b/data/main.lua @@ -16,6 +16,7 @@ require "title" require "game" require "opcions" require "opcions_input" +require "point" --require "fps" --require "menu" diff --git a/data/point.lua b/data/point.lua new file mode 100644 index 0000000..636b52e --- /dev/null +++ b/data/point.lua @@ -0,0 +1,26 @@ +point={} + +function point.new(_hab,_x,_y,_x_offset,_y_offset,_id) + local world_x, world_y = coords.room_to_world(_hab,_x,_y) + _x_offset = _x_offset or 0 + _y_offset = _y_offset or 0 + return {name="point", + id=_id, + hab=_hab, + x=world_x+_x_offset, + y=world_y+_y_offset, + w=8, + h=8, + draw=point.draw, + } +end + +function point:draw() + local scr_x, scr_y = viewp:screen_coords( self.x, self.y ) + -- debug rect + draw.rect(scr_x,scr_y,self.w,self.h,3) +end + +function point:update() + -- do nothing +end \ No newline at end of file diff --git a/data/stage1.lua b/data/stage1.lua index 2c023be..2cd1a38 100644 --- a/data/stage1.lua +++ b/data/stage1.lua @@ -2,6 +2,7 @@ stages = {} stages.boss_ready = false stages.boss_loaded = false +stages.boss_hot_points = {} boss = nil function stages.stage1_init() @@ -130,11 +131,18 @@ function stages.stage1_boss() set_actors_enabled_by_room(false, "boss", stage1_boss_mapa.r0.r, stage1_boss_mapa.r1.r) load_tilemap( sf_mapa, stage1_boss_mapa ) -- actors_in_room_backup_and_remove(stage1_boss_mapa.r0.r,stage1_boss_mapa.r1.r) - viewp:fixed({l=8,r=44,u=48,d=0}) + -- viewp:fixed({l=8,r=44,u=48,d=0}, viewp.x, viewp.y-48) + -- viewp:fixed({l=8,r=44,u=0,d=0}) stages.boss_loaded = true boss.reason="" boss.enabled=true boss:fight() + table.insert(stages.boss_hot_points, point.new(54,5,4,12,8,"P1")) + table.insert(stages.boss_hot_points, point.new(44,5,3,12,8,"P2")) + table.insert(stages.boss_hot_points, point.new(55,7,4,12,8,"P3")) + table.insert(stages.boss_hot_points, point.new(45,7,3,12,8,"P4")) + table.insert(stages.boss_hot_points, point.new(44,12,5,12,8,"P5")) + table.insert(stages.boss_hot_points, point.new(54,12,4,12,8,"P6")) end end @@ -983,23 +991,23 @@ stage1_boss_mapa = { 256,256,256, 17,256,256,256,256,256,256,256,256, 256,256,256, 17,256,256,256,256,256,256,256,256, 256,256,256, 17,256, 1,256,256,256,256,256,256, - 256,256,256, 17,256,256, 1,256,256,256,256, 41, + 256,256,256, 17,112,256, 1,256,256,256,256,112, 256,256,256, 17,256, 1,256,256,256,256,256,256, }, -- 45 { 18, 19, 18, 19, 18, 19, 18, 19, 18, 19, 17,256, - 256,256,256,256,256,256,256,256,256,256, 17,256, - 256,256,256,256,256,256,256,256,256,256, 17,256, - 256,256,256,256,256,256,256,256, 2,256, 17,256, - 256,256, 41,256,256,256,256, 2,256,256, 17,256, + 69,256,256, 68,256, 67,256,256,256,256, 17,256, + 256, 69, 64, 66,256,256,256,256,256,256, 17,256, + 256, 69, 69, 69,256, 65,256,256, 2,256, 17,256, + 256,256,112,256, 69, 69,256, 2,256,112, 17,256, 256,256,256,256,256,256,256,256, 2,256, 17,256, }, -- 54 { - 256,256,256, 17,256,256, 1,256,256,256,256, 4, + 256,256,256, 17,112,256, 1,256,256,256,256, 4, 256,256,256, 17,256, 1,256,256,256,256,256,256, - 256,256,256, 17,256,256, 1,256,256,256,256,256, + 256,256,256, 17,112,256, 1,256,256, 1,256,256, 256,256,256, 17,256, 1,256,256,256,256,256,256, 256,256,256, 17,256,256, 1,256,256,256,256,256, 20, 21, 20, 21, 54, 55, 54, 55, 54, 55, 54, 56, @@ -1007,9 +1015,9 @@ stage1_boss_mapa = { }, -- 55 { - 22, 22, 5,256,256,256,256, 2,256,256,17,256, + 22, 22, 5,256,256,256,256, 2,256,112,17,256, 256,256,256,256,256,256,256,256, 2,256,17,256, - 256,256,256,256,256,256,256, 2,256,256,17,256, + 256,256,256,256, 2,256,256, 2,256,112,17,256, 256,256,256,256,256,256,256,256, 2,256,17,256, 256,256,256,256,256,256,256, 2,256,256,17,256, 54, 55, 54, 56, 56, 55, 54, 56, 54, 56,55, 54, diff --git a/data/trigger.lua b/data/trigger.lua index 18616ec..7919a32 100644 --- a/data/trigger.lua +++ b/data/trigger.lua @@ -131,6 +131,7 @@ function triggers:escena_habitacio_batman() end function triggers:escena_lluita_imp() + viewp:fixed({l=8,r=44,u=0,d=0}, viewp.x, viewp.y-48) start_scene(scenes.lluita_imp, nil, false) remove_actor(self) stages.stage1_boss_ready() diff --git a/data/viewport.lua b/data/viewport.lua index 09d1816..71e2dca 100644 --- a/data/viewport.lua +++ b/data/viewport.lua @@ -24,9 +24,11 @@ function viewport.new(_width, _height) } end -function viewport:fixed(range) +function viewport:fixed(range, _x, _y) self.range = range - self.fixed_coord = {x=self.x, y=self.y} + _x = _x or self.x + _y = _y or self.y + self.fixed_coord = {x=_x, y=_y} end function viewport:free_move()