feat(actors): add a floor collision
This commit is contained in:
parent
a401bf1b27
commit
e6e29cf443
3 changed files with 20 additions and 1 deletions
|
@ -37,7 +37,11 @@ function Box3D:new(owner, w, h, d, isVisible)
|
||||||
self.shadowSources = {}
|
self.shadowSources = {}
|
||||||
self.needRedraw = false
|
self.needRedraw = false
|
||||||
|
|
||||||
self.isVisible = isVisible or true
|
if (isVisible == nil) then
|
||||||
|
self.isVisible = true
|
||||||
|
else
|
||||||
|
self.isVisible = isVisible
|
||||||
|
end
|
||||||
|
|
||||||
if (self.isVisible) then
|
if (self.isVisible) then
|
||||||
self:setTexture()
|
self:setTexture()
|
||||||
|
|
14
sonic-radiance.love/game/modules/world/actors/floor.lua
Normal file
14
sonic-radiance.love/game/modules/world/actors/floor.lua
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
local Base = require "core.modules.world.actors.actor3D"
|
||||||
|
local Floor = Base:extend()
|
||||||
|
|
||||||
|
function Floor:new(world, x, y, z, w, h, d)
|
||||||
|
Floor.super.new(self, world, "wall", x, y, z, w, h, d, true)
|
||||||
|
self:setDebugColor(0,0,0)
|
||||||
|
self.boxes.Base(self, w, h, d, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Floor:update(dt)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return Floor
|
|
@ -10,5 +10,6 @@ Obj.index["player"] = Obj.Player
|
||||||
Obj.collisions = {}
|
Obj.collisions = {}
|
||||||
Obj.collisions["wall"] = require(cwd .. "wall")
|
Obj.collisions["wall"] = require(cwd .. "wall")
|
||||||
Obj.collisions["invisible"] = require(cwd .. "invisible")
|
Obj.collisions["invisible"] = require(cwd .. "invisible")
|
||||||
|
Obj.collisions["floor"] = require(cwd .. "floor")
|
||||||
|
|
||||||
return Obj
|
return Obj
|
||||||
|
|
Loading…
Reference in a new issue