-
Notifications
You must be signed in to change notification settings - Fork 4
Traject Task
JSLLW edited this page Aug 29, 2023
·
3 revisions
This task implements the movement of the projectiles. This class takes a destination param of Vector2 type which the projectiles would be heading toward.
This method starts the movement of the projectile.
public void start() {
super.start();
movementTask = new MovementTask(destination);
movementTask.create(owner);
movementTask.start();
this.owner.getEntity().getEvents().trigger("trajectStart");
}
This method updates the movement of the projectile.
public void update() {
movementTask.setTarget(destination);
movementTask.update();
if (movementTask.getStatus() != Status.ACTIVE) {
movementTask.start();
}
}