24 lines
489 B
Lua
24 lines
489 B
Lua
local Entity = require "scenes.levels.entities.parent"
|
|
|
|
local Loot = Entity:extend()
|
|
|
|
function Loot:new(world, x, y, name)
|
|
Loot.super.new(self, world, "loot", x, y, 16, 16)
|
|
self.type = "loot"
|
|
self:setSprite(name)
|
|
end
|
|
|
|
function Loot:takeLoot()
|
|
self.obj.GFX(self.world, self.x+8, self.y+8, "sparkle", 1)
|
|
self:destroy()
|
|
player:addGold(1)
|
|
player:addScore(10)
|
|
self.scene.assets:playSFX("collectcoin")
|
|
end
|
|
|
|
function Loot:update(dt)
|
|
Loot.super.update(self, dt)
|
|
end
|
|
|
|
return Loot
|