diff --git a/data/fireball.lua b/data/fireball.lua index 45b9370..851c13b 100644 --- a/data/fireball.lua +++ b/data/fireball.lua @@ -6,11 +6,18 @@ fireball={ wait=0, flip=false, step_length=3, - bb={x=0,y=0,w=4,h=4} + power=1, + size=1, + bb={x=0,y=0,w=4,h=4}, + x1=0, + y1=0, + step_length_x=1, + step_length_y=1, } -function fireball.init(_hab,_x,_y,_flip, _off_x, _off_y) +function fireball.init(_hab,_x,_y,_flip, _off_x, _off_y, _power) local world_x, world_y = coords.room_to_world(_hab,_x,_y) + _power = _power or 1 if fireball.hab ~= -1 then return end _off_x = _off_x or 0 _off_y = _off_y or 0 @@ -18,19 +25,63 @@ function fireball.init(_hab,_x,_y,_flip, _off_x, _off_y) fireball.x= world_x+_off_x fireball.y= world_y+_off_y fireball.flip=_flip + fireball.power=_power + fireball.size=1 + fireball.w = 6 + fireball.h = 6 + fireball.bb = {x=0,y=0,w=4,h=4} end function fireball.draw() if fireball.hab == -1 then return end local scr_x, scr_y = viewp:screen_coords( fireball.x, fireball.y ) - draw.circf(scr_x,scr_y,8,16) - draw.circf(scr_x,scr_y,6,3) - draw.circf(scr_x,scr_y,2,8) + draw.circf(scr_x,scr_y,8*fireball.size,16) + draw.circf(scr_x,scr_y,6*fireball.size,3) + draw.circf(scr_x,scr_y,2*fireball.size,8) end function fireball.update() + if fireball.power==2 and fireball.power>fireball.size then + fireball.wait = fireball.wait + 1 + fireball.x1=abad.x+abad.bb.x+(abad.bb.w//2) + fireball.y1=abad.y + if abad.x>cxr2)*self.h, self.w, self.h, scr_x, scr_y, self.w, self.h, self.flip) - pal.subpal(5) - - draw.rect(scr_x+self.bb.x,scr_y+self.bb.y,self.bb.w,self.bb.h,3) - - if #self.hot_points>0 then - for _, p in pairs(self.hot_points) do - if self.target==p then - p:draw(true) - else - p:draw() + if self.update==self.state_super then + for col=13,15 do + local newc = self.super_pal[col] + if self.super_wait%6 == 0 then + newc = newc+1 + if newc>15 then newc=13 end end + pal.subpal(col,newc) + self.super_pal[col]=newc end + draw.surf(96, 32, self.w, self.h, + scr_x, scr_y-self.h*(self.zoom-1), + self.w*self.zoom, self.h*self.zoom, + self.flip) + for col=13,15 do pal.subpal(col) end + --draw.surf(96, 32, self.w, self.h, scr_x, scr_y, self.w, self.h, self.flip) + else + draw.surf((self.frame&7)*self.w, (self.frame>>cxr2)*self.h, self.w, self.h, scr_x, scr_y, self.w, self.h, self.flip) + pal.subpal(5) end + -- draw.rect(scr_x+self.bb.x,scr_y+self.bb.y,self.bb.w,self.bb.h,3) + + --if #self.hot_points>0 then + -- for _, p in pairs(self.hot_points) do + -- if self.target==p then + -- p:draw(true) + -- else + -- p:draw() + -- end + -- end + --end + -- print("DRAW path= "..#self.path) - if #self.path>0 then - for i=1,#self.path do - local world_x, world_y = coords.room_to_world(self.path[i][1], self.path[i][2], self.path[i][3]) - local scr_x, scr_y = viewp:screen_coords( world_x, world_y ) - draw.rect(scr_x, scr_y, 16, 16, 14) - end - end + -- if #self.path>0 then + -- for i=1,#self.path do + -- local world_x, world_y = coords.room_to_world(self.path[i][1], self.path[i][2], self.path[i][3]) + -- local scr_x, scr_y = viewp:screen_coords( world_x, world_y ) + -- draw.rect(scr_x, scr_y, 16, 16, 14) + -- end + -- end end function imp:hit() @@ -513,16 +541,24 @@ if DEBUG_FN_NAME then print("state_normal") end end function imp:super_ready() - self.target = self.hot_points["altar"] - if self.x100 then + if self.super_wait%4==0 then self.zoom=self.zoom+0.1 end + elseif not self.super_fired and self.zoom>=1.75 and self.super_wait>100 then + local x_ini = self.x+self.bb.x+self.bb.w+4 + local hab, tx, ty, off_x, off_y = coords.world_to_tile(x_ini,self.y+(self.h/2)) + fireball.init(hab, tx, ty, false, off_x, off_y, 2) + self.super_fired = true + elseif self.zoom>1 and self.super_wait<=100 then + if self.super_wait%4==0 then self.zoom=self.zoom-0.1 end + end + if self.super_wait == 0 then + self.update=imp.super_end + end end function imp:super_end() print("super_end()") + self.zoom = 1 + self.super_wait = 200 + -- self.super_cooldown=2000 self.super_cooldown=200 self:reset_fight_mode_cooldown() self.invencible = false + self.super_fired = false self:free_movement() self.update=imp.state_normal end @@ -1027,13 +1074,13 @@ function imp:next_action() if action=="stay" then if self.movement_type=="free" then - msg_print(10,20,"FREE",true) + -- msg_print(10,20,"FREE",true) action = self:free_next_action() elseif self.movement_type=="pattern" then - msg_print(10,20,"PATTERN "..self.action_event,true) + -- msg_print(10,20,"PATTERN "..self.action_event,true) action=self:pattern_next_action() elseif self.movement_type=="super" then - msg_print(10,20,"SUPER "..self.action_event,true) + -- msg_print(10,20,"SUPER "..self.action_event,true) end end diff --git a/data/tiles.gif b/data/tiles.gif index d5d8c3c..8c1585d 100644 Binary files a/data/tiles.gif and b/data/tiles.gif differ