ProjectileBlueprint2D
Inherits: Resource < RefCounted < Object
Class representing the model and desing of a Projectile2D.
Description
Projectile Blueprints are custom Godot Resources, and like Textures and Materials they only serve as data containers. Projectile Blueprints are used by the AP engine to create the real-time Projectile Objects.
Note: Do not change ProjectileBlueprint2Ds at run time, these serve strictly as static data. Any changes you want to make at runtime must be done on the Projectile2D themselves, through any of the ProjectileCaller2D methods.
Good:
projectile_manager.get_projectile(0).set_property("lifetime", 10.0)
Also Good:
projectile_manager.get_projectile(0).lifetime = 10.0
Bad:
projectile_manager.get_projectile_blueprint(0).lifetime = 10.0
Horrible:
projectile_manager.get_projectile(0).resource.lifetime = 10.0
Tutorials
Properties
float | after_hit_angular_speed | 100 |
bool | allow_rehit | false |
float | angular_speed | 100 |
float | angular_spread | 0 |
bool | area_monitoreable | true |
float | cast_radius | 200 |
int | collision_layer | 0 |
int | collision_mask | 0 |
String | collision_path | "Collision" |
int | damage | 1 |
Dictionary[StringName, Variant] | global_properties | {} |
Dictionary[StringName, Variant] | individual_properties | {} |
PackedScene | instance | |
int | instances | 1 |
float | lifetime | 1.0 |
float | linear_deviation | 0 |
float | linear_speed | 1000 |
bool | lock_to_target | false |
bool | look_at | true |
StringName | name | |
StringName | on_expired_projectile_id | |
String | on_hit_call | "damage" |
int | pierce | 1 |
ProjectileDirectionality | proj_directionality | 2 |
ProjectileSpread | proj_spread | 0 |
ProjectileType | proj_type | 0 |
int | radius | 20 |
bool | randomize_positions | false |
bool | randomize_spread | false |
float | rehit_cooldown | 0.1 |
int | seeking_mask | 0 |
bool | seeking | false |
float | size | 1.0 |
float | spawn_interval | 0 |
Texture2D | texture | null |
float | vertical_spread | 0 |
Property Descriptions
float after_hit_angular_speed = 100
Angular speed used in seeking projectiles after the first hit (Useful for ricochet behaviors).
bool allow_rehit = false
If true
the projectile will be able to hit already hit targets.
float angular_speed = 100
Maximum allowed rotation, in degrees per second, in seeking projectiles.
float angular_spread = 0
Fixed radial extension in which angular spread projectiles will evenly distribute (in degrees).
bool area_monitoreable = true
If true
the projectile can interact with other monitoring Area2Ds.
float cast_radius = 200
Radius of the circle cast shape searching for secondary targets on seeking projectiles.
int collision_layer = 0
Physics layers of the projectile itself.
int collision_mask = 0
Physics layers that can interact with the projectile.
String collision_path = "Collision"
INSTANTIATED Projectiles ONLY
Path to the mandatory Area2D element or child component in the InstancedProjectile2D instance Scene.
int damage = 1
Sum of health points that this projectile removes from targets on collision.
Dictionary[StringName, Variant] global_properties = {}
This dictionary is shared between all projectiles created by this blueprint.
If you change its values on any of its projectiles, you will change them in all the rest.
Dictionary[StringName, Variant] individual_properties = {}
This dictionary is independent in all projectiles created by this blueprint.
Modifying it will only affect the targeted projectile.
PackedScene instance
INSTANTIATED Projectiles ONLY
The Scene to instantiate as a InstancedProjectile2D.
int instances = 1
Amount of projectiles instantiated on creation.
float lifetime = 1.0
Active duration in seconds.
float linear_deviation = 0
Random amount of deviation the velocity vector of the projectile can differ once instantiated (in pixels).
float linear_speed = 1000
Distance traveled in pixels per second.
bool lock_to_target = false
If true
the projectile will ignore all potential collisions in the way to hit its assigned target.
bool look_at = true
If true
the projectile will actively look at the direction it travels.
StringName name
Unique identifier. Used to distinguish between different projectiles on the Global Database.
StringName on_expired_projectile_id
Name of the Secondary projectile on the Global Database to be instantiated once the main projectile runs out of pierce or lifetime.
String on_hit_call = "damage"
Name of the method that the projectile will try to call upon collision.
int pierce = 1
How many different targets this projectile can hit before expiration.
ProjectileDirectionality proj_directionality = 2
Type of direction the projectile will take once instantiated.
ProjectileSpread proj_spread = 0
Type of spread the projectile instances will have once instantiated.
ProjectileType proj_type = 0
Specific projectile sub-class the projectile will use.
int radius = 20
AREA Projectiles ONLY
Size of the projectile circle collision in pixels.
The collision radius of the projectile is affected by the size of the projectile itself.
bool randomize_positions = false
If true
linear and angular projectiles positions will be randomly spread.
bool randomize_spread = false
If true
the spread of angular and circular projectiles will be randomized exclusively between its edges.
float rehit_cooldown = 0.1
Minimum amount of time between consecutive collisions on identical targets.
int seeking_mask = 0
The projectile will actively seek targets on these Collision layers. Use it so your projectiles don't seek into walls.
bool seeking = false
If true
the projectile will actively follow its targets.
float size = 1.0
Applied uniform Scale of the projectile.
float spawn_interval = 0
Fixed time between each instance generation.
Texture2D texture = null
AREA Projectiles ONLY
Main projectile graphic texture.
float vertical_spread = 0
Fixed amount of linear extension in which linear and angular projectiles will be evenly distributed (in pixels).