sonic-radiance/sonic-radiance.love/scenes/battlesystem/actors/battler.lua

46 lines
975 B
Lua
Raw Permalink Normal View History

local Parent = require("scenes.battlesystem.actors.parent")
local Battler = Parent:extend()
function Battler:new(world, x, y, z)
Battler.super.new(self, world, x, y, z)
self.start = {}
self.start.x = x
self.start.y = y
self.isBattler = true
self.speed = 3
self.isActive = false
self.debugActiveTimer = 0
2020-07-19 21:41:14 +02:00
self.isSelected = false
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)
2019-08-16 23:04:30 +02:00
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:validateAction()
end
return Battler