FIXED: Got 2 problems with homing projectile shooting enemy

Godot Version

Godot 3.5.1.

FIXED

First problem was fixed with help from someone (See the code changes if you don’t mind).
Second problem was me just recreating the enemy from scratch and he can turn properly now.

Question

Problem 1: How Do I make the seeking arrow work properly?

Arrow scene called GhalbeenArrow.
Ideally, I’d want the arrow to travel and chase the player when the enemy (Called HerrkoRedGhalbeen) shoots it.
The arrow would obviously disappear if hurting the player but also if touching the world.
(And I guess the Companion too if HerrkoRedGhalbeen seems the Companion with its Raycast, instead of the Player, if that distinction is needed.

Problem 2: The enemy can’t flip properly when touching a well.

They start off moving to the right, which is normal.
But when they touch a well, they do not turn to the left and instead get stuck.
I remember having a similar issue with another enemy (RedJester) and I fixed it by recreating them, but if I recall, I think I did the same with the Ghalbeen and it didn’t work.
I thought it had to do with how the collisions are placed in the enemy’s scene but not sure if that’s true.
Anyway, here’s the script/scene pages on the game’s Github.

(Look for HerrkoRedGhalbeen)

(Look for GhalbeenArrow)

(I’m also limited to 2 links here).

Any help is appreciated.

1 Like

For the first question, take a look at tbis persons question, their code was causing the projectile to seek the target (but they didnt want it to).

You should be able to use their original logic to make a homing projectile

It’s a different version of Godot, but the principle used should helpful.

Thing is, I’ve yet to get into Godot 4, so I can’t tell if the differences are just the words/names or they also include the overall syntax/structure.

Also I should mention: When I put the arrow in the level as its own scene, it can chase the Player on its own.
Might be because a scene directly acknowledging another can only do that if already part of the scene tree.
Meaning the projectile’s awareness of the Player has to come from the Ghalbeen, which I still can’t quite figure out.

Someone helped me fix the arrow.
But the Ghalbeen’s inability to turn around is still there.