local Entity = require "scenes.levels.entities.parent"
local NumberGFX = Entity:extend()

function NumberGFX:new(level, x, y, number, color)
  NumberGFX.super.new(self, level, "number", x - 8, y - 24, 16, 16)
  self.number = number or 0
  self.color  = color or {1, 1, 1}
  self.life   = 1.5
  self.count  = 0
end

function NumberGFX:update(dt)
  self.count = self.count + dt
  if self.count > self.life then
    self:destroy()
  end

  self.y = self.y - 32 * dt
end

function NumberGFX:draw()
  love.graphics.setColor(self.color)
  self.level.assets.fonts["medium"]:set()
  love.graphics.printf(self.number, self.x+8-40, self.y+8, 80, "center")
  utils.graphics.resetColor()
end

return NumberGFX
