-- Attack: melee strike with configurable power, range, and speed local BaseSkill = require("skills.base") local Skill = {} Skill.__index = Skill setmetatable(Skill, { __index = BaseSkill }) function Skill:new(asset, combatant) self = setmetatable(BaseSkill:new(asset, combatant), Skill) self.duration = 0.3 combatant.skillAnimation = "jump" combatant.invincible = true self.combatant.behavior.disableTimer = self.duration return self end function Skill:update(dt) self.timer = self.timer + dt self.combatant.velX = 250 * self.combatant.facing self.combatant.moveX = 0 if self.timer >= self.duration then self.combatant.skillAnimation = nil self.combatant.invincible = false self.combatant.velX = 100 * self.combatant.facing return true end return false end function Skill:draw() for i = 1, (10 * (self.timer / self.duration)) do local drawX = self.combatant.x - (self.combatant.facing * (i * 3)) + (self.combatant.facing == -1 and self.combatant.width or 0) local drawY = self.combatant.y love.graphics.setColor(1, 1, 1, (1 - (i / 10)) / 2) self.combatant.sprite:drawAnimationFrame(drawX, drawY, { scale = { self.combatant.facing, 1 } }) end love.graphics.setColor(1, 1, 1, 1) end return Skill