[FIX] Canviada la poció a 'objecte'
This commit is contained in:
@@ -209,8 +209,6 @@ function world_update()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
health_potion.update()
|
|
||||||
|
|
||||||
if stages.boss_loaded then
|
if stages.boss_loaded then
|
||||||
stage_update()
|
stage_update()
|
||||||
else
|
else
|
||||||
@@ -247,7 +245,6 @@ function world_draw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
dialeg.draw()
|
dialeg.draw()
|
||||||
health_potion.draw()
|
|
||||||
|
|
||||||
if stages.boss_loaded then stage_draw_middle() end
|
if stages.boss_loaded then stage_draw_middle() end
|
||||||
|
|
||||||
|
|||||||
@@ -1,81 +1,75 @@
|
|||||||
-- posició en el gif (tiles de 32)
|
|
||||||
health_potion_gif_x = 192
|
health_potion_gif_x = 192
|
||||||
health_potion_gif_y = 128
|
health_potion_gif_y = 128
|
||||||
|
|
||||||
health_potion={
|
health_potion={}
|
||||||
|
|
||||||
|
function health_potion.new(_hab, _x, _y, _y_speed, _max_height, _heal)
|
||||||
|
_raising = false
|
||||||
|
if _max_height>0 then _raising=true end
|
||||||
|
return {
|
||||||
name="health_potion",
|
name="health_potion",
|
||||||
hab=1,
|
hab = _hab,
|
||||||
x=1,y=1,
|
x = _x, y = _y,
|
||||||
|
w = 16, h = 16,
|
||||||
vx=0, vy=0,
|
vx=0, vy=0,
|
||||||
w=16,h=16,
|
y_speed = _y_speed,
|
||||||
y_speed=1,
|
max_height = _max_height,
|
||||||
max_height=16,
|
heal = _heal,
|
||||||
heal = 2,
|
raising = _raising,
|
||||||
raising=false,
|
enabled=true,
|
||||||
enabled=false,
|
|
||||||
wait = 0,
|
wait = 0,
|
||||||
bb={x=4,y=0,w=9,h=16}
|
bb={x=4,y=0,w=9,h=16},
|
||||||
}
|
update=health_potion.update,
|
||||||
|
draw=health_potion.draw,
|
||||||
function health_potion.init(hab, x, y, y_speed, max_height, heal)
|
}
|
||||||
health_potion.hab = hab
|
|
||||||
health_potion.x = x
|
|
||||||
health_potion.y = y
|
|
||||||
health_potion.y_speed = y_speed
|
|
||||||
health_potion.max_height = max_height
|
|
||||||
health_potion.heal = heal
|
|
||||||
if max_height>0 then health_potion.raising=true end
|
|
||||||
|
|
||||||
--local world_x, world_y = coords.room_to_world(health_potion.hab,health_potion.x,health_potion.y)
|
|
||||||
--health_potion.x=world_x
|
|
||||||
--health_potion.y=world_y
|
|
||||||
|
|
||||||
health_potion.update=health_potion.update
|
|
||||||
health_potion.draw=health_potion.draw
|
|
||||||
health_potion.enabled=true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function health_potion.draw()
|
function health_potion:draw()
|
||||||
if not health_potion.enabled then return end
|
if not self.enabled then return end
|
||||||
local x = health_potion_gif_x
|
local x = health_potion_gif_x
|
||||||
local y = health_potion_gif_y
|
local y = health_potion_gif_y
|
||||||
local scr_x, scr_y = viewp:screen_coords( health_potion.x, health_potion.y )
|
local scr_x, scr_y = viewp:screen_coords( self.x, self.y )
|
||||||
draw.surf(x,y,health_potion.w,health_potion.h,scr_x,scr_y,health_potion.w,health_potion.h)
|
if self.heal==1 then
|
||||||
|
pal.subpal(3,11)
|
||||||
|
elseif self.heal==2 then
|
||||||
|
pal.subpal(3,8)
|
||||||
|
end
|
||||||
|
draw.surf(x,y,self.w,self.h,scr_x,scr_y,self.w,self.h)
|
||||||
|
pal.subpal(3)
|
||||||
-- draw.rect(scr_x+health_potion.bb.x,scr_y+health_potion.bb.y,health_potion.bb.w,health_potion.bb.h,3)
|
-- draw.rect(scr_x+health_potion.bb.x,scr_y+health_potion.bb.y,health_potion.bb.w,health_potion.bb.h,3)
|
||||||
end
|
end
|
||||||
|
|
||||||
function health_potion.update()
|
function health_potion:update()
|
||||||
if not health_potion.enabled then return end
|
if not self.enabled then return end
|
||||||
if health_potion.raising and health_potion.y_speed>0 then
|
if self.raising and self.y_speed>0 then
|
||||||
health_potion.y_speed = -health_potion.y_speed
|
self.y_speed = -self.y_speed
|
||||||
elseif not health_potion.raising and health_potion.y_speed<0 then
|
elseif not self.raising and self.y_speed<0 then
|
||||||
health_potion.y_speed = -health_potion.y_speed
|
self.y_speed = -self.y_speed
|
||||||
end
|
end
|
||||||
|
|
||||||
local x2_check = health_potion.x+health_potion.bb.x+health_potion.bb.w
|
local x2_check = self.x+self.bb.x+self.bb.w
|
||||||
local x1_check = health_potion.x+health_potion.bb.x
|
local x1_check = self.x+self.bb.x
|
||||||
local y_check = health_potion.y+health_potion.bb.h+health_potion.y_speed
|
local y_check = self.y+self.bb.h+self.y_speed
|
||||||
|
|
||||||
if true then
|
if true then
|
||||||
health_potion.wait=0
|
self.wait=0
|
||||||
health_potion.max_height = health_potion.max_height+health_potion.y_speed
|
self.max_height = self.max_height+self.y_speed
|
||||||
health_potion.y = health_potion.y+health_potion.y_speed
|
self.y = self.y+self.y_speed
|
||||||
if health_potion.max_height==0 then health_potion.raising=false end
|
if self.max_height==0 then self.raising=false end
|
||||||
end
|
end
|
||||||
health_potion.wait=health_potion.wait+1
|
self.wait=self.wait+1
|
||||||
|
|
||||||
local tile1_hit_type= arc_check_tile(x1_check, y_check )
|
local tile1_hit_type= arc_check_tile(x1_check, y_check )
|
||||||
local tile2_hit_type= arc_check_tile(x2_check, y_check)
|
local tile2_hit_type= arc_check_tile(x2_check, y_check)
|
||||||
local block_tile = tile1_hit_type == tiletype.block or tile2_hit_type == tiletype.block
|
local block_tile = tile1_hit_type == tiletype.block or tile2_hit_type == tiletype.block
|
||||||
|
|
||||||
if block_tile then health_potion.y_speed=0 end
|
if block_tile then self.y_speed=0 end
|
||||||
health_potion.hab = coords.world_to_tile(health_potion.x, health_potion.y)
|
self.hab = coords.world_to_tile(self.x, self.y)
|
||||||
if health_potion.hab==abad.hab then
|
if self.hab==abad.hab then
|
||||||
if collision(abad,health_potion) then
|
if collision(abad,self) then
|
||||||
-- abad.objects.health_potion=true
|
abad_heal(self.heal)
|
||||||
-- remove_actor(health_potion)
|
self.enabled = false
|
||||||
abad_heal(health_potion.heal)
|
remove_actor(self)
|
||||||
health_potion.enabled = false
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -88,7 +88,7 @@ function mini.init()
|
|||||||
logo_config(font_sf)
|
logo_config(font_sf)
|
||||||
surf.target(0)
|
surf.target(0)
|
||||||
surf.cls(16)
|
surf.cls(16)
|
||||||
flow:executar("logo")
|
flow:executar("game")
|
||||||
end
|
end
|
||||||
|
|
||||||
function mini.update()
|
function mini.update()
|
||||||
|
|||||||
@@ -91,6 +91,9 @@ function stages.stage1_init()
|
|||||||
table.insert( actors, zombie.new(73, 7, 3,false) )
|
table.insert( actors, zombie.new(73, 7, 3,false) )
|
||||||
table.insert( actors, zombie.new(75, 3, 3,true) )
|
table.insert( actors, zombie.new(75, 3, 3,true) )
|
||||||
|
|
||||||
|
local hp_x, hp_y = coords.room_to_world(11, 7, 4)
|
||||||
|
table.insert( actors, health_potion.new(11, hp_x, hp_y, 0, 0, 1) )
|
||||||
|
|
||||||
-- TRIGGERS
|
-- TRIGGERS
|
||||||
-- if not menu then table.insert(actors,trigger.new(10,57,32,triggers.escena_abad_inici)) end
|
-- if not menu then table.insert(actors,trigger.new(10,57,32,triggers.escena_abad_inici)) end
|
||||||
table.insert( actors, trigger.new(10,7,3,triggers.escena_abad_inici,"inici","TR01") )
|
table.insert( actors, trigger.new(10,7,3,triggers.escena_abad_inici,"inici","TR01") )
|
||||||
|
|||||||
@@ -104,10 +104,16 @@ function trigger_ev:premiere_healer_update()
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
premiere.health_wait = premiere.health_wait - 1
|
premiere.health_wait = premiere.health_wait - 1
|
||||||
health_potion.init(premiere.hab,
|
table.insert( actors, health_potion.new(
|
||||||
|
premiere.hab,
|
||||||
premiere.x+premiere.bb.x+premiere.bb.w,
|
premiere.x+premiere.bb.x+premiere.bb.w,
|
||||||
premiere.y+premiere.bb.y+premiere.bb.h/3,
|
premiere.y+premiere.bb.y+premiere.bb.h/3,
|
||||||
1, 24, 2)
|
1, 24, 3)
|
||||||
|
)
|
||||||
|
-- health_potion.init(premiere.hab,
|
||||||
|
-- premiere.x+premiere.bb.x+premiere.bb.w,
|
||||||
|
-- premiere.y+premiere.bb.y+premiere.bb.h/3,
|
||||||
|
-- 1, 24, 2)
|
||||||
elseif hab >= 56 then
|
elseif hab >= 56 then
|
||||||
-- Restaurar a Premiere
|
-- Restaurar a Premiere
|
||||||
premiere.hab = premiere.from_hab
|
premiere.hab = premiere.from_hab
|
||||||
|
|||||||
Reference in New Issue
Block a user