Back to the horror game. I programmed movement methods and tested them using inputs and tried to assign them to player position checks, but they just aren't doing what I need to. it's driving me crazy. It only needs to move along the x axis, it frees its own queue when it hits a door event. This all works fine.

I have searched and found many different methods of doing this and no consensus on which works best. What do you recommend? I only need to chase the player along the x-axis (side-scrolling). I read the docs, i even already have a player object doing exactly what i want. But for some reason whenever i apply these same methods to an enemy object, the behavior is off. Literally i use the velocity/alpha/delta equation and then nothing happens.

I would suggest the move_and_collide(distance: Vector2) method or move_and_slide(velocity: Vector2) if you want the KinematicBody2D to slide when it hits a slope. Where you could change the vector to Vector2(x, 0), Vector2.ZERO or Vector2(-x, 0) depending on which direction you want the enemy to move to where x is equal to the distance (velocity * delta) or velocity respectively you want the enemy to move with.

With these methods all movement and collisions are handled for you, the only thing you'd have to do is decide when and how to move. The godot tutorial is pretty clear about it.

I just realize i made that question a bit broad. I should probably zoom in.

KinematicBody and the movement tutorial i am quite familiar with. Input movement? No sweat. The physics aren’t the problem.

My goal is the behavior. Programming “when” movement happens.

    SnapCracklins Right, If you want the enemy to always chase the player you could continuously check if the player position is >, < or == to the enemy position and decide on moving in that direction.

    If there's some conditions that have to be complied with, you could use a boolean variable to check if those conditions are met, and have the code where those conditions change set the boolean to the desired value or emit a signal that's connected to the enemy.

    Perhaps showing some code could give some more insight into what you're doing exactly and what might be going wrong.

    I think you may have solved it. I just see that question a lot so I didn't want to bore a bunch of people repeating it and posting my broken code.

    This may be a job for storing some vectors to move the monster towards when the player is "hidden".

    Thanks!

    6 months later