47 lines
1.0 KiB
Lua
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=1,w=16,h=15}}
|
|
end
|
|
|
|
function invisible:draw()
|
|
-- Es invisible, res que drawar
|
|
-- local scr_x, scr_y = viewp:screen_coords( self.x+self.bb.x, self.y+self.bb.y )
|
|
-- draw.rect(scr_x, scr_y, 16, 16, 3)
|
|
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
|