Files
cacaus-arcade/data/invisible.lua
JailGamer d45c2fe011 - El foc ja fa mal
- El abad ja no es invencible si entra en col·lisió infinita
2026-04-02 22:14:21 +02:00

47 lines
1.0 KiB
Lua

invisible={}
function invisible.new(_hab,_x,_y)
local world_x, world_y = coords.room_to_world(_hab,_x,_y)
return {hab=_hab,
x=world_x,
y=world_y,
w=16,
h=16,
wait=0,
hit=invisible.hit,
update=invisible.update,
draw=invisible.draw,
bb={x=0,y=0,w=16,h=16}}
end
function invisible:draw()
-- Es invisible, res que drawar
-- local scr_x, scr_y = viewp:screen_coords( self.x, self.y )
-- draw.rectf(scr_x, scr_y, 16, 8, 2)
end
function invisible:update()
--self.wait=self.wait+1
--
--if self.wait==6 then
-- self.wait=0
--
-- if self.hab==abad.hab then
-- if aabb(abad,self) then
-- abad_hurt(1)
-- end
-- end
--
--end
if viewp:inside(self.x, self.y, self.w, self.h) then
if collision(abad,self) then
print("check collision")
abad_hurt(1)
end
end
end
function invisible:hit()
end