sonic-radiance/sonic-radiance.love/scenes/battlesystem/actors/ennemy.lua
2020-08-22 23:53:13 +02:00

53 lines
1.2 KiB
Lua

local Battler = require("scenes.battlesystem.actors.battler")
local Ennemy = Battler:extend()
local gui = require "game.modules.gui"
function Ennemy:new(world, x, y, owner)
Ennemy.super.new(self, world, x, y, 0, owner)
self.isEnnemy = true
self.actionPerTurn = 2
self:initSprite()
end
function Ennemy:setCheapEffect(cheapEffect)
if (cheapEffect) then
self.sprite.sx = 2
self.sprite.sy = 2
end
end
function Ennemy:draw()
self:drawSprite(0, -self.z)
local x, y = self.world.map:gridToPixel(self.x, self.y, true)
self.owner:drawHUD(x - 12, y - self.owner.abstract.data.hudHeight - self.z)
if (self.isSelected) then
local height = 32
self.assets.images["cursorpeak"]:draw(x - 7, y - 24 - 32)
end
self:drawDamageNumber()
end
function Ennemy:die()
self.assets.sfx["badnicsBoom"]:play()
self.world.obj.GFX(self.world, self.x, self.y, self.z, "boomGFX", self, false)
self:destroy()
end
function Ennemy:getStats()
return self.data.stats
end
-- ASSETS FUNCTIONS
-- Load and play assets needed by the character
function Ennemy:getSpritePath()
return "datas/gamedata/ennemies/" .. self.owner.category .. "/" .. self.owner.name .. "/sprites"
end
return Ennemy