project-witchy/imperium-porcorum.love/scenes/levels/entities/loot/coin.lua

20 lines
552 B
Lua
Raw Normal View History

2019-03-03 12:52:24 +01:00
local Loot = require "scenes.levels.entities.loot.parent"
2019-03-03 13:00:23 +01:00
local Coin = Loot:extend()
2019-03-03 12:52:24 +01:00
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)
2019-03-03 12:52:24 +01:00
end
function Coin:takeLoot()
self.obj.GFX(self.scene, self.x+8, self.y+8, "sparkle", 1)
2019-03-03 12:52:24 +01:00
self:destroy()
self.scene.playermanager.gold = self.scene.playermanager.gold + self.value
self.scene.playermanager.score = self.scene.playermanager.score + 10
self.scene.assets:playSFX("collectcoin")
2019-03-03 12:52:24 +01:00
end
return Coin