InstancedProjectile2D

Inherits: Projectile2D

Specialized Projectile2D implementation instanced PackedScenes as projectiles.


Description

InstancedProjectile2D are instanced copies of your given Scenes. These contain all their original components and scripts, but follow the rules of normal projectiles.

InstancedProjectile2D are more performance intensive than AreaProjectile2D but not significantly, you would have to generate thousands to see a clear difference.


Properties



Methods



Property Descriptions

Area2D area

Mandatory projectile scene area collision component.


static Node current_scene

Shared root node of the currently loaded main scene used for projectile instancing.


Node2D instance

In-world projectile scene.



Method Descriptions

void area_monitor_callback(area_rid: RID, collider: Node2D, area_shape_index: int, self_shape_index: int)

Handles area-to-area collision events. Requires monitoring to be set to true.

self_shape_index and area_shape_index contain indices of the interacting shapes from this projectile area and the other area, respectively. collider is the Node of the other area. These values can be used with the PhysicsServer2D.


void body_monitor_callback(body_rid: RID, collider: Node2D, body_shape_index: int, self_shape_index: int)

Handles area-to-body collision events.

self_shape_index and body_shape_index contain indices of the interacting shapes from this projectile area and the other body, respectively. collider is the Node of the other body. These values can be used with the PhysicsServer2D.