UPDATE: Someone called soxxoxsmox helped me with the code.
You can see the changes in the script now.
Godot Version
Question
Here’s my goal:
This enemy walks slowly but when the Player enters its raycast, it enters a “chase” state.
In this state, I’d like to make it jump if touching a wall.
The 2 problems:
The first is that throughout different versions of its script, I couldn’t make it jump while moving.
And even when it did jump (Namely just making it switch from MOVING/CHASE to JUMP state), I couldn’t make it move to left or right.
Second problem: The jumping’s physics are weird: Either it keeps going up, fall slowly or barely gets up.
It seems I just need to figure out the right values or something, which comes off as gambling.
One reason why this is weird to me is because some of this code is borrowed from CompanionFourth, which doesn’t seem to have these issues.
(In general, some things in my game borrow bits from each this: This is another reason why I want to make an enemy that can jump and move at the same time, if it means something I can reuse and modify in later situations and ideas).
Because of this, lots of code is commented out in its script.
These 2 are the issues I have with this enemy so far.
Because otherwise, the main feature of the enemy (Attaching itself to the Player) and even damage as of now are figured out.