Move and slide resetting velocity on cpu controlled characterbody2d

Godot Version

4.5.1

Question

I am trying to get an enemy to jump when shooting a bullet at it, but unfortunately everytime I try to set velocity.y to get the enemy to jump, it never moves.

This is my output from my script. After every code block in the game, I made a print statement to find out that move_and_slide() was resetting the velocity to 0.0 from 400.0 only a few moments ago. I just can’t figure out why. Nothing is in the way that could cause the enemy to not jump. And I even checked the collision layers, it was set to default before but even with my collision masks and layers set correctly it still doesn’t work.

I was previously setting the velocity as soon in the area2d’s signal, but even after switching it over to the very next physics_process() update, it still doesn’t work.

This is the setup for my collision layer on the characterbody2d


and this is for the collision mask

If someone has any ideas for what i could try or maybe a new approach, i’d really appreciate the help.

If you set velocity.y to a positive value in a 2D game, the body will move downwards, not upwards. It should be -400.0 to jump upwards.