local Entity = require "scenes.levels.entities.parent"

local Loot = Entity:extend()

function Loot:new(level, x, y, name)
  Loot.super.new(self, level, "loot", x, y, 16, 16)
  self.collType = "loot"
  self.sprite = name
end

function Loot:takeLoot()
  self.obj.GFX(self.level, self.x+8, self.y+8, "sparkle", 1)
  self:destroy()
  self.level.playermanager.gold   = self.level.playermanager.gold   + 1
  self.level.playermanager.score  = self.level.playermanager.score  + 10
  self.level.assets:playSFX("collectcoin")
end

function Loot:update(dt)
  Loot.super.update(self, dt)
end

function Loot:draw()
  self.level.assets.sprites[self.sprite]:drawAnimation(self.x, self.y)
end

return Loot
