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

54 lines
1.2 KiB
Lua
Raw Normal View History

local Battler = require("scenes.battlesystem.actors.battler")
local Ennemy = Battler:extend()
2019-08-14 22:47:10 +02:00
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
2020-08-04 22:19:11 +02:00
self:initSprite()
end
2020-08-07 13:15:04 +02:00
function Ennemy:setCheapEffect(cheapEffect)
if (cheapEffect) then
self.sprite.sx = 2
self.sprite.sy = 2
end
end
function Ennemy:draw()
2020-08-04 22:19:11 +02:00
self:drawSprite(0, -self.z)
local x, y = self.world.map:gridToPixel(self.x, self.y, true)
2019-08-14 22:47:10 +02:00
self.owner:drawHUD(x - 12, y - self.owner.abstract.data.hudHeight - self.z)
2020-07-19 21:41:14 +02:00
if (self.isSelected) then
local height = 32
self.assets.images["cursorpeak"]:draw(x - 7, y - 24 - 32)
end
2020-08-22 23:53:13 +02:00
self:drawDamageNumber()
end
2020-08-05 11:40:29 +02:00
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
2020-08-04 22:19:11 +02:00
-- 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