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

56 lines
1.3 KiB
Lua
Raw Normal View History

local Battler = require("scenes.battlesystem.actors.battler")
local Ennemy = Battler:extend()
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()
if (self.owner:haveProtecType("aerial")) then
2021-05-15 13:09:35 +02:00
self.z = 10
2021-07-18 14:03:58 +02:00
self.start.z = 10
2021-05-09 15:07:38 +02:00
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, "boom1", self, false)
2020-08-05 11:40:29 +02:00
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