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

local Coin = Loot:extend()

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

function Coin:takeLoot(player)
  self.obj.GFX(self.world, self.x+8, self.y+8, "sparkle", 1)
  self:destroy()
  player:addGold(self.value)
  player:addScore(10)
  self.scene.assets:playSFX("collectcoin")
end

return Coin
