#Creating a "fairy companion" that follows the player from a distance.

9 messages · Page 1 of 1 (latest)

onyx bison
#

Hey there, I'm currently looking to create a flying companion that would follow the player and (if possible) also do various actions like shooting or grabbing onto walls when the player commands it to. Some examples I'm looking at are Rabi-Ribi and Rusted Moss.

I do have a player controller from my previous jam game. What I managed to think of is that I suppose most of the work will be put into making "follow the player from the distance" AI, and that'd probably make use of AnimationPlayer/AnimationTree? I don't really know where to start, so I'd like some guidelines/frameworks if possible. Thanks in advance!

long bough
#

I would create a node in the player and move it to the position you want the fairy to be at. Then make the fairy move to that position

onyx bison
#

Sounds quite simple yeah, though it'll also have to consider which direction the player is facing (the fairy should be behind you usually) and position smoothing

#

I'll see what I can do when I'm free

#

Wondering if I should implement pathfinding for this too

long bough
#

As for the position you could change it to what you want, depending on direction and what ever factors you come up with

#

You would only have to move the Node

flat comet
#

if your companion is a node in the player scene, you can add a Node2D (target_position) to the position you want the companion to go and then you can update the position of the companion with something like

func _physics_process(delta):
____$companion.global_position = lerp($companion.global_position, $target_position.global_position, weight)
#

Then you just have to adjust weight to match the speed you want your companion to have