Walljump help

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

I have a little minor issue that I have no clue how to solve, maybe also because I’m a beginner but idk.

Basically I have a 2D walljump thing that works pretty well, but whenever you turn around the game thinks you are on the floor and lets you jump normally. I cannot figure out how to fix this.

Here’s the code I used for walljumping

if is_on_wall():
	if Input.is_action_just_pressed("Jump"):
		if is_on_floor():
			motion.y = -JUMPFORCE
		elif facing_right:
			motion.y = -JUMPFORCE
			motion.x = -WALLJUMPOFF
		else:
			motion.y = -JUMPFORCE
			motion.x = WALLJUMPOFF

If anyone could help me I would appreciate it

Do you flip all your player or only it’s sprite ? If your collision shape teleport when changing direction, it can go inside the wall and be detected as a return to the floor.

zeludtnecniv | 2023-06-25 15:06

I only flip the sprite

Ratmanprisma | 2023-06-26 01:29