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

57 lines
1.3 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()
2021-05-09 15:07:38 +02:00
if (self.owner.abstract.data.isAerial == true) then
self.z = 16
end
self.sprHeight = self.owner.abstract.data.hudHeight + 14
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
2021-05-09 15:07:38 +02:00
self.owner:drawOversprite(x - 12, y - ((self.sprHeight - 8) * self.sprite.sy) - self.z)
2020-07-19 21:41:14 +02:00
if (self.isSelected) then
2021-05-09 15:07:38 +02:00
self.assets.images["cursorpeak"]:draw(x - 7, (y - 24 - self.sprHeight) - self.z)
2020-07-19 21:41:14 +02:00
end
2021-05-09 15:07:38 +02:00
self:drawOutput()
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