feat(action3D): add coin actor

This commit is contained in:
Kazhnuz 2019-07-20 17:46:40 +02:00
parent 1a5abfeaac
commit 54167f8a77
2 changed files with 17 additions and 0 deletions

View file

@ -0,0 +1,14 @@
local Base = require "gamecore.modules.world.actors.actor3D"
local Coin = Base:extend()
function Coin:new(world, x, y, z)
Coin.super.new(self, world, "coin", x, y, z + 16, 16, 16, 16, false)
self:setSprite("coin")
end
function Coin:takeCoin(other)
self.obj.GFX(self.world, self.x + 8, self.y + 8, self.z + 8, "sparkle")
self:destroy( )
end
return Coin

View file

@ -4,10 +4,13 @@ local Obj = {}
local cwd = (...):gsub('%.init$', '') .. "."
Obj.Player = require(cwd .. "player")
Obj.Box = require(cwd .. "box")
Obj.Coin = require(cwd .. "coin")
Obj.GFX = require("gamecore.modules.world.actors.gfx3D")
Obj.index = {}
Obj.index["player"] = Obj.Player
Obj.index["box"] = Obj.Box
Obj.index["coin"] = Obj.Coin
Obj.collisions = {}
Obj.collisions["wall"] = require(cwd .. "wall")