Getting Started

How do I spawn a Projectile?


  1. Add a ProjectileCaller component to your desired node.

Right click on your node -> Add child nodeā€¦
Search for ProjectileCaller -> Select ProjectileCaller2D -> Create

  1. Add any ProjectileBlueprint in the Projectile Resources Array of the ProjectileCaller node.

Select Projectile Resources array -> Add Element
Select empty -> Quick Load -> Select any -> Open

  1. Call the ProjectileCaller from any of your scripts and request any of its Projectile Resources.

extends Node2D

@onready var projectile_caller = $ProjectileCaller2D
									
func _process(_delta):
	if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
		var destination = get_global_mouse_position()
		projectile_caller.request_projectile(0, position, destination)

How do I create a Projectile Blueprint?


  1. Right click on any Godot FileSystem folder Create New Resource

Right click on your Godot FileSystem -> Create New -> Resource

  1. Search for ProjectileBlueprint Create Name it Save

Right click on your Godot FileSystem -> Create New -> Resource
Search for ProjectileBlueprint -> Select ProjectileBlueprint2D -> Create -> Name it -> Save

How do I modify the behavior of a projectile?


  • You can change the behavior of your Projectiles when requesting its creation from the ProjectileCaller.

  • The request_projectile method will take your custom functions as parameters.

extends Node2D

@onready var projectile_caller = $ProjectileCaller2D
						

# In this example the "custom_movement" function is passed as a Callable in the optional "move_method" parameter.
# The ProjectileCaller "request_projectile" method can also change the collision, expiration or target of your projectiles.
func _process(_delta):
	if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
		var destination = get_global_mouse_position()
		projectile_caller.request_projectile(0, position, destination, null, custom_movement)


# Each optional Callable argument follows a define pattern and must take a set number of parameters.
# To learn more about these custom methods and how to use them go to the ProjectileCaller section.
func custom_movement(proj: Projectile2D, _delta: float) -> Vector2:
	return Vector2.UP