fix: some clean-up to help the choregraphy viewer

This commit is contained in:
Kazhnuz 2020-08-03 17:38:30 +02:00
parent 2509708067
commit f867cba68d
4 changed files with 13 additions and 8 deletions

View file

@ -1,7 +1,7 @@
local Parent = require("scenes.battlesystem.actors.parent") local Parent = require("scenes.battlesystem.actors.parent")
local Battler = Parent:extend() local Battler = Parent:extend()
function Battler:new(world, x, y, z) function Battler:new(world, x, y, z, owner)
Battler.super.new(self, world, x, y, z) Battler.super.new(self, world, x, y, z)
self.start = {} self.start = {}
@ -14,6 +14,7 @@ function Battler:new(world, x, y, z)
self.debugActiveTimer = 0 self.debugActiveTimer = 0
self.isSelected = false self.isSelected = false
self.owner = owner
end end
function Battler:destroy() function Battler:destroy()
@ -38,6 +39,13 @@ function Battler:update(dt)
end end
end end
function Battler:draw()
local x, y = self.world.map:gridToPixel(self.x, self.y, true)
love.graphics.setColor(1, 0, 0, 1)
love.graphics.rectangle("fill", x - 8, y - 32, 16, 32)
love.graphics.setColor(1, 1, 1, 1)
end
function Battler:validateAction() function Battler:validateAction()
end end

View file

@ -4,18 +4,15 @@ local Ennemy = Battler:extend()
local gui = require "game.modules.gui" local gui = require "game.modules.gui"
function Ennemy:new(world, x, y, owner) function Ennemy:new(world, x, y, owner)
Ennemy.super.new(self, world, x, y, 0) Ennemy.super.new(self, world, x, y, 0, owner)
self.isEnnemy = true self.isEnnemy = true
self.owner = owner
self.actionPerTurn = 2 self.actionPerTurn = 2
end end
function Ennemy:draw() function Ennemy:draw()
Ennemy.super.draw(self)
local x, y = self.world.map:gridToPixel(self.x, self.y, true) local x, y = self.world.map:gridToPixel(self.x, self.y, true)
love.graphics.setColor(1, 0, 0, 1)
love.graphics.rectangle("fill", x - 8, y - 32, 16, 32)
love.graphics.setColor(1, 1, 1, 1)
self.owner:drawHUD(x - 14, y - 38) self.owner:drawHUD(x - 14, y - 38)

View file

@ -11,9 +11,8 @@ local ZGRAVITY = 0.2
-- Initialize the hero -- Initialize the hero
function Hero:new(world, x, y, owner, charnumber) function Hero:new(world, x, y, owner, charnumber)
Hero.super.new(self, world, x, y, 0) Hero.super.new(self, world, x, y, 0, owner)
self.isHero = true self.isHero = true
self.owner = owner
self:initMovementSystem() self:initMovementSystem()

View file

@ -4,6 +4,7 @@ local baseURI = "scenes.battlesystem.actors."
entities.Hero = require(baseURI .. "hero") entities.Hero = require(baseURI .. "hero")
entities.Ennemy = require(baseURI .. "ennemy") entities.Ennemy = require(baseURI .. "ennemy")
entities.Battler = require(baseURI .. "battler")
entities.GFX = require(baseURI .. "gfx") entities.GFX = require(baseURI .. "gfx")
return entities return entities