Single movement trouble (move_and_slide())

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By halcyon

I have a basic script to move my character, if another object hits a body change a boolean variable that will run move_and_slide() for the player. When the player hits an Area2D it will stop and this code will keep repeating.

func move_character():
if GLOBALS.playerGoingToMove == true: #If i hit the box I move
	self.get_parent().get_node("PLAYER/Body").move_and_slide(Vector2(50,0))
elif GLOBALS.playerGoingToMove == false:
	 self.get_parent().get_node("PLAYER/Body").move_and_slide(Vector2(0,0))

move_character() is inside of _physics_process(delta)
Initially it will run slowly, wait for a bit then it will go fast, wait for a bit and it will go faster.

I think I know what’s going on but I can’t fix it. I believe the Vector2(50,0) keeps on increasing but if I set it to Vector2(0,0) I thought that it would fix it but it doesn’t.
I saw a video where he made the Vector2 a variable and reset the variable to equal the new current vector but I can’t do that because it will stop moving once it hits something rather than using input controls.

Would really like input for my code if I did something wrong or forgotten about something.