ProjectileProcessor2D

Inherits: Node2D < CanvasItem < Node < Object

Class for the All Projectiles engine.


Description

ProjectileProcessor2D is in charge of managing all requested projectiles from all ProjectileCaller2Ds and ProjectileManager2Ds. It handles projectile instancing, movement, drawing, and disposal.

A successful request_projectile call from any ProjectileCaller2D will create or repurpose a Projectile2D from its inactive id queue. The ProjectileProcessor2D will process all projectiles at runtime; lifetime updates every frame, and movement updates on physic frames. These statements also hold true for both Attack2Ds and TimedModifiers.

Note: ProjectileProcessor2D acts as a singleton i.e. it's created when needed and actively restricts the creation of more instances.

Note: ProjectileProcessor2D is intentionally kept obtuse and unapproachable by design. Please avoid using it directly in any way that is not strictly necessary and use ProjectileCaller2Ds or ProjectileManager2Ds instead.


Properties



Methods



Signals

attack_array_expanded()

Emitted when a new Attack2D is added to the attacks array property.

Note: This signal is not emitted when a new attack is created, only when the attacks array expands its capacity.


attack_inactive_queue_contracted()

Emitted when an element id is removed from the inactive_attacks_queue array property.


attack_inactive_queue_expanded()

Emitted when a new element id is added to the inactive_attacks_queue array property.


modifier_array_expanded()

Emitted when a new TimedModifier is added to the modifiers array property.

Note: This signal is not emitted when a new modifier is created, only when the modifiers array expands its capacity.


modifier_inactive_queue_contracted()

Emitted when an element id is removed from the inactive_modifiers_queue array property.


modifier_inactive_queue_expanded()

Emitted when a new element id is added to the inactive_modifiers_queue array property.


projectile_array_expanded()

Emitted when a new Projectile2D is added to the projectiles array property.

Note: This signal is not emitted when a new projectile is created, only when the projectiles array expands its capacity.


projectile_inactive_queue_contracted()

Emitted when an element id is removed from the inactive_projectiles_queue array property.


projectile_inactive_queue_expanded()

Emitted when a new element id is added to the inactive_projectiles_queue array property.



Property Descriptions

Array[Attack2D] attacks

A list of all working Attack2Ds managed by the ProjectileProcessor2D.


Array[int] inactive_attacks_queue

A list of all available indices from inactive Attack2Ds in the attacks property.


Array[int] inactive_modifiers_queue

A list of all available indices from inactive TimedModifiers in the modifiers property.


Array[int] inactive_projectiles_queue

A list of all available indices from inactive Projectile2Ds in the projectiles property.


Array[TimedModifier] modifiers

A list of all working TimedModifiers managed by the ProjectileProcessor2D.


Array[Projectile2D] projectiles

A list of all working Projectile2Ds managed by the ProjectileProcessor2D.



Method Descriptions

void _add_projectile(projectile: Projectile2D, _packed_info: PackedInfo)

Creates one (1) new projectile from the given indications.


void add_attack(attack: Attack2D)

Registers a new attack from the given object.


void add_modifier(modifier: TimedModifier)

Registers a new modifier from the given object.


void add_projectiles_resource(projectile: Projectile2D, _position: Vector2, destination: Vector2, target: Node2D = null, move_method: Callable = Callable(), start_method: Callable = Callable(), collision_method: Callable = Callable(), expired_method: Callable = Callable())

Creates a new projectile, and all its instances, from the given Projectile2D object.