From 40daa66eeb3d42616d52f84233831a27b8692643 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Wed, 1 May 2019 17:20:31 +0200 Subject: [PATCH] examples/moveplayer: add walls --- examples/gameplay/moveplayer/actors/init.lua | 3 ++- examples/gameplay/moveplayer/actors/wall.lua | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 examples/gameplay/moveplayer/actors/wall.lua diff --git a/examples/gameplay/moveplayer/actors/init.lua b/examples/gameplay/moveplayer/actors/init.lua index 3770609..9d67a55 100644 --- a/examples/gameplay/moveplayer/actors/init.lua +++ b/examples/gameplay/moveplayer/actors/init.lua @@ -5,8 +5,9 @@ local cwd = (...):gsub('%.init$', '') .. "." Obj.Player = require(cwd .. "player") Obj.index = {} -Obj.index["player"] = Obj.Explosion +Obj.index["player"] = Obj.Player Obj.collisions = {} +Obj.collisions["wall"] = require(cwd .. "wall") return Obj diff --git a/examples/gameplay/moveplayer/actors/wall.lua b/examples/gameplay/moveplayer/actors/wall.lua new file mode 100644 index 0000000..2981cb4 --- /dev/null +++ b/examples/gameplay/moveplayer/actors/wall.lua @@ -0,0 +1,14 @@ +local Base = require "gamecore.modules.world.actors.actor2D" +local Wall = Base:extend() + +function Wall:new(world, x, y, w, h) + Wall.super.new(self, world, "wall", x, y, w, h, true) + self:setDebugColor(0,0,0) +end + +function Wall:draw() + self:drawHitbox() + utils.graphics.resetColor( ) +end + +return Wall