InstancedProjectile2D
Inherits: Projectile2D < RefCounted < Object
Specialized Projectile2D implementation instancing 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.
Tutorials
Properties
Methods
void | area_monitor_callback |
void | body_monitor_callback |
Property Descriptions
Area2D area
Mandatory InstancedProjectile2D scene area collision component.
NodePath collision_path
Path to the mandatory Area2D element or child component in the InstancedProjectile2D instance scene.
static Node current_scene
Shared root node of the currently loaded main scene used for projectile instancing.
Node2D instance
In-world projectile scene instance.
PackedScene scene
Scene file to be initialized as a projectile.
Your scene must have an Area2D child Node to be valid.
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.