Skip to main content

Projectiles

Functions

fireProjectiles

fireProjectiles(npc, position, velocity, projectilesMode?, projectileParams?): readonly EntityProjectile[]

Helper function to make an NPC fire one or more projectiles. Returns the fired projectile(s).

Use this function instead of the EntityNPC.FireProjectiles method if you need to modify or access the EntityProjectile objects after they are fired, since this function returns the objects in an array.

Parameters

NameTypeDefault valueDescription
npcundefined | EntityNPCundefinedThe NPC to fire the projectile(s) from. You can also pass undefined if you do not want the projectile(s) to come from anything in particular.
positionVectorundefinedThe staring position of the projectile(s).
velocityVectorundefinedThe starting velocity of the projectile(s).
projectilesModeProjectilesModeProjectilesMode.ONE_PROJECTILEOptional. The mode of the projectile(s). Default is ProjectilesMode.ONE_PROJECTILE.
projectileParamsProjectileParamsundefinedOptional. The parameters of the projectile(s). Default is ProjectileParams().

Returns

readonly EntityProjectile[]

The fired projectile(s).

Defined in

packages/isaacscript-common/src/functions/projectiles.ts:26


fireProjectilesInCircle

fireProjectilesInCircle(npc, position, speed, numProjectiles): readonly EntityProjectile[]

Helper function to spawn projectiles in a circle around a position. Under the hood, this leverages ProjectileMode.N_PROJECTILES_IN_CIRCLE.

Parameters

NameTypeDescription
npcundefined | EntityNPCThe NPC to fire the projectile(s) from. You can also pass undefined if you do not want the projectile(s) to come from anything in particular.
positionVectorThe staring position of the projectile(s).
speedfloatThe speed of the projectile(s).
numProjectilesintThe amount of projectiles to spawn.

Returns

readonly EntityProjectile[]

The fired projectile(s).

Defined in

packages/isaacscript-common/src/functions/projectiles.ts:65