Starting out with Godot, looking for advice on coding companions

Godot Version

4.3

Question

Hello! Hoping someone can give me some ideas of where to start…My idea is having a character that shoots an arrow and a companion character zooms over to the arrow and attaches to it.

I’ve watched tutorials on navigation pathing and collision, but not really sure how to work out the physics/how to go about it?

Also saw a tutorial where the character has a grappling hook that made sense from what I’ve tested but before i write a 78 line code if anyone has any suggestions i’m down to hear lol

If I were doing this, when you fire an arrow I would emit a signal so the companion knows there is an arrow around to attach to.

The companion could then just accelerate towards the arrow until it reaches it and attaches to it. Whilst approaching and attaching, you would ignore all other arrow signals.

Once the arrow is destroyed, your companion can then return to the original position.

I would also have it that if the companion hits something on the way, like a wall or obstacle, that it would cancel the arrow approach, and wait for the next arrow. You could have the companion ghost through everything as well of course.

Sounds interesting btw. Good luck.

1 Like

Thank you! Definitely gives me something to go off of. Genuinely everything I searched ended up being about enemy pathing, lol. I’ll look into signal stuff! Thanks again! I’ll def post it once it’s done :slight_smile:

Navigation pathing doesn’t exclude using signals. These are 2 separate things.
You would use signals to share information about an event happening (like shooting an arrow that your companion might be interested in), and you can use navigation pathing so that your companion can reach the arrow while avoiding obstacles. If your companion is a “ghost” and can move through walls etc, then there shouldn’t be a need for navigation, it can just zoom in a straight line. But if obstacle avoidance is required, then you need some kind of pathing.

Thank you! THIS is what I couldn’t grasp and that made it so clear! Literally the two options I was debating of having the companion ricochet and bounce off walls or just ghost through the solid obstacles. I’ll definitely look into it: community for the win!! :saluting_face::pray:t2:

2 Likes