I am trying to build a trail follows the mouse only while the player is clicking a button. So far I have followed another tutorial and i'm only able to make one that follows the mouse, even when it is not being clicked. Can you help me make it so that the trail is only visible when the mouse is clicked?
I have a Node2D with a Line2D as a child.
The Node2D has script:
# Called when the node enters the scene tree for the first time.
global_position = get_global_mouse_position()
Node2D's child Line2D has script:
var length = 5
var point = Vector2()
global_position = Vector2(0,0)
global_rotation = 0
point = get_parent().global_position
while get_point_count() > length:
I have tried adding a statement
if Input.is_action_just_pressed("click"): to
func _process(delta):, but the trail doesn't even show up when I add that.
Thanks for your help. I'm new to Godot and this is really challenging for me!