feat(action3D): add coin actor
This commit is contained in:
parent
1a5abfeaac
commit
54167f8a77
2 changed files with 17 additions and 0 deletions
14
examples/gameplay/action3D/actors/coin.lua
Normal file
14
examples/gameplay/action3D/actors/coin.lua
Normal 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
|
|
@ -4,10 +4,13 @@ local Obj = {}
|
||||||
local cwd = (...):gsub('%.init$', '') .. "."
|
local cwd = (...):gsub('%.init$', '') .. "."
|
||||||
Obj.Player = require(cwd .. "player")
|
Obj.Player = require(cwd .. "player")
|
||||||
Obj.Box = require(cwd .. "box")
|
Obj.Box = require(cwd .. "box")
|
||||||
|
Obj.Coin = require(cwd .. "coin")
|
||||||
|
Obj.GFX = require("gamecore.modules.world.actors.gfx3D")
|
||||||
|
|
||||||
Obj.index = {}
|
Obj.index = {}
|
||||||
Obj.index["player"] = Obj.Player
|
Obj.index["player"] = Obj.Player
|
||||||
Obj.index["box"] = Obj.Box
|
Obj.index["box"] = Obj.Box
|
||||||
|
Obj.index["coin"] = Obj.Coin
|
||||||
|
|
||||||
Obj.collisions = {}
|
Obj.collisions = {}
|
||||||
Obj.collisions["wall"] = require(cwd .. "wall")
|
Obj.collisions["wall"] = require(cwd .. "wall")
|
||||||
|
|
Loading…
Reference in a new issue