-- the "call out" object
Callout = {}
Callout.__index = Callout

-- create the object
function Callout.create(image, offset_x, offset_y, size, time)
  local c = {}            -- new object
  c.visible = false       -- callout not visible
  c.x = 0
  c.y = 0
  c.xoffset = offset_x
  c.yoffset = offset_y
  c.size = size or 80
  c.timer = time or 60
  c.count = nil
  c.img = image
  return setmetatable(c, Callout) -- make Callout handle lookup
end

-- show callout effect
function Callout:show(show_x,show_y)
  if not self.visible then
    self.count = self.timer
    self.x = show_x + self.xoffset
    self.y = show_y + self.yoffset
    self.visible = true
  end
end

-- update shutoff timer
function Callout:countdown()
  if self.visible then
    self.count = self.count - 1
    if self.count <= 0 then
      self.visible = false
    end
  end
end

function Callout:getCount()
  return self.count
end
