Skip to content

Multi‐target Projectiles

JSLLW edited this page Aug 28, 2023 · 3 revisions

To create multiple projectiles. Simply use the spawnMultiProjectile method in the ForestGameArea class. Below is a brief description of each of the params and an example of how to use the function.

position (Vector2) The position of the Entity that's shooting the projectile.

target (Entity) The enemy entities of the "shooter".

direction (int) The direction the projectile should head towards.

space (int) The space between the projectiles' destination.

speed (Vector2) The speed of the projectiles.

quantity (int) The number of projectiles to spawn.

// Example:
spawnMultiProjectile(new Vector2(0, 10), ghostking, towardsMobs, 20, new Vector2(2f, 2f), 7);

This function, spawnMultiProjectile, is dependent on the TrajectTask class, ProjectileFactory class and the spawnProjectile function that's located in the ForestGameArea class.

Clone this wiki locally