package BoomerangProjectile import Projectile import Escaper import Assets import Interpolation public class Boomerang extends Projectile vec2 initialPos vec2 middleone vec2 middletwo vec2 target Escaper caster construct(Escaper caster, vec2 target) super(caster.getPos(), 32, caster.owner, caster.actor.getFacingAngle(), Abilities.sentinelMissile) initialPos = caster.getPos().toVec2() this.caster = caster this.target = target middleone = initialPos.polarOffset(initialPos.angleTo(target) + (40).asAngleDegrees(), initialPos.distanceTo(target) / 1.8) middletwo = initialPos.polarOffset(initialPos.angleTo(target) + (-40).asAngleDegrees(), initialPos.distanceTo(target) / 1.8) setTimed(0) override function update() if time > 2 terminate() else if time >= 1 setPos(target.bezier3(middletwo, caster.getPos().toVec2(), time-1.).toVec3()) time = time.lerp(2.3, 0.040) else time = time.lerp(1.2, 0.035) setPos(initialPos.bezier3(middleone, target, time).toVec3())