local Loot = require "scenes.levels.entities.loot.parent"

local Coin = Loot:extend()

function Coin:new(level, x, y, anim, value)
  self.value = value or 1
  local anim  = anim or "coin"
  Coin.super.new(self, level, x, y, anim)
end

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

return Coin
