This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Can you have a single path with multiple nodes spawned in, through code, that start at different offsets on the path?

I want to spawn X number of monsters based on a signal timer.

   func _process(delta):    
        pathToFollow.set_offset(pathToFollow.get_offset() + 350 * delta)

func _on_EnemySpawner_timeout():
    var BubbleWingInstance = BubbleWing.instance()

Can I spawn in a monster, on the first point of the path and have it follow the path?

in Engine by (12 points)

1 Answer

+1 vote

It would be easier to use a PathFollow2D for each monster. Move their offsets independently.

Also, instead of

pathToFollow.set_offset(pathToFollow.get_offset() + 350 * delta)

you can just do

pathToFollow.offset += 350 * delta
by (22,191 points)
edited by

I could do that - do you think the overhead of having 30 or 40 PathFollow2D on screen at one time is better than doing a tween between nodes and managing the paths manually?

It's almost always better to use built-in methods than do it manually. If you're already spawning 30-40 objects, what's the harm in one more node for each of them?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.