I'm trying to use the Godot 2D physics (a RigidBody2D to be more specific) to create a retro arcade platformer, but the one problem I can't seem to solve or find a solution for anywhere is to reset the player's horizontal velocity back to 0.
Please don't judge me for my terribly sloppy code, I'm new to python-like coding. :)
My code for moving the player left and right:
if (go_left and not go_right):
if (go_right and not go_left):
The notmoving variable is defined early in my code as being true "if not (goleft or goright)"
I know for a fact my notmoving variable works for detecting when neither the left or right arrow key is pressed because I set it to print to the console.
The goleft and goright variables are working too, because pressing the respective arrow key will apply the velocity.
The only thing is, when I release both arrow keys, the player just keeps moving in the last pressed direction. I'm trying to create a platformer with very tight controls, so this doesn't bode well at all. If anyone can help, please do!
Thanks in advance,