local Parent = require("scenes.battlesystem.actors.parent") local Battler = Parent:extend() local MIDDLE_ARENA = 6 function Battler:new(world, x, y, z, owner) Battler.super.new(self, world, x, y, z) self.direction = utils.math.sign(MIDDLE_ARENA - x) self.start = {} self.start.x = x self.start.y = y self.start.direction = self.direction self.isBattler = true self.speed = 3 self.isActive = false self.debugActiveTimer = 0 self.isSelected = false self.owner = owner end function Battler:destroy() Battler.super.destroy(self) end function Battler:setActive() core.debug:print("cbs/actor","actor " .. self.id .. " is active") self.isActive = true self.debugActiveTimer = 0 end function Battler:update(dt) Battler.super.update(self, dt) if (self.isActive) then self.debugActiveTimer = self.debugActiveTimer + dt if self.debugActiveTimer >= 0.5 then core.debug:print("cbs/battler", "counter ended, switching active battler") self.isActive = false self.world:switchActiveBattler() 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:initSprite() if (self.assets.sprites[self.owner.name] == nil) then self.assets:addSprite(self.owner.name, self:getSpritePath()) end self.assets.sprites[self.owner.name]:setCustomSpeed(16) self:setSprite(self.owner.name, 32, 48, true) self:cloneSprite() self:changeAnimation("idle") end function Battler:validateAction() end return Battler