Files
cacaus-arcade/data/point.lua

33 lines
858 B
Lua

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=16,
h=16,
draw=point.draw,
bb={x=4,y=0,w=8,h=16},
}
end
function point:draw(fill)
local scr_x, scr_y = viewp:screen_coords( self.x, self.y )
-- debug rect
if not fill then
draw.rect(scr_x,scr_y,self.w,self.h,3)
-- draw.rect(scr_x+self.bb.x,scr_y,self.bb.w,self.h,2)
else
draw.rectf(scr_x,scr_y,self.w,self.h,3)
-- draw.rectf(scr_x+self.bb.x,scr_y,self.bb.w,self.h,2)
end
end
function point:update()
-- do nothing
end