From fa4964a8771f870bd33a8e846592f8455b976512 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Thu, 4 Jun 2020 19:37:34 +0200 Subject: [PATCH] feat: prepare badnics support --- .../modules/world/actors/ennemies/motobug.lua | 6 ++++++ .../modules/world/actors/ennemies/parent.lua | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 sonic-bluestreak.love/game/modules/world/actors/ennemies/motobug.lua create mode 100644 sonic-bluestreak.love/game/modules/world/actors/ennemies/parent.lua diff --git a/sonic-bluestreak.love/game/modules/world/actors/ennemies/motobug.lua b/sonic-bluestreak.love/game/modules/world/actors/ennemies/motobug.lua new file mode 100644 index 0000000..618ca36 --- /dev/null +++ b/sonic-bluestreak.love/game/modules/world/actors/ennemies/motobug.lua @@ -0,0 +1,6 @@ +local Parent = require "game.modules.world.actors.ennemies.parent" +local Motobug = Parent:extend() + + + +return Motobug diff --git a/sonic-bluestreak.love/game/modules/world/actors/ennemies/parent.lua b/sonic-bluestreak.love/game/modules/world/actors/ennemies/parent.lua new file mode 100644 index 0000000..11347c0 --- /dev/null +++ b/sonic-bluestreak.love/game/modules/world/actors/ennemies/parent.lua @@ -0,0 +1,18 @@ +local Parent = require "game.modules.world.actors.parent" +local EnnemyParent = Parent:extend() + +function EnnemyParent:new(world, x, y, z, w, h, d) + EnnemyParent.super.new(self, world, "ennemy", x, y, z, w, h, d, true) +end + +function EnnemyParent:getHurt(hp) + if (self.hp <= hp) then + self:die() + else + self.hp = self.hp - hp; + end +end + +function EnnemyParent:die() + self:destroy() +end