Having trouble and crouching and sliding

Godot Version

4.2

Question

so i have two basic issues that me, a newbi, dont know how to solve, and alot of the youtube videos i watch are just really reallly poor quality and suck. anyways the first issue is crouching, everything works BUT the player is still able to move left and right, i tried doing .disable, and true or false statements but those dont work.

and the second issue is wall jumping ,it works nearly PERFECTLY it just that i cant get the player to jump without having to let go of the direction inputs. i want it to feel similar to sonic where all you gotta do is press jump, then face and hold the directiony you want to wall jump to, i also wanna prevent accidental wall jumps, is there a way to have a safe guard for that?

also heres the wall jumping code

if is_on_wall():
velocity.y = 30
jump_count = 1

Could you post your crouching code?

Your wall jumps need to also set the velocity.x in the opposite direction of the wall. You will also need to either disable player input or give weight to movement, avoiding directly setting velocity.

if is_on_wall():
    var wall_normal = get_last_slide_collision().normal()
    velocity.x = wall_normal * SPEED
    velocity.y = 30
    jump_count = 1

the crouching animation is literally an animation change with a disable true or false collision shape

Try changing the animation callback process mode to physics ro idle.

could you explain to me what this means? im slightly confused on the wording, TwT sorry if i sound dumb

it kinda works? but it crashes the moment i try to wall jump, i think it might be a issue with the x velocity bc i tried doing somthing with the horizontal direction before, and it also crashed the game. tho it might be me for not understand what… “get last slide collission” and “normal” means, i never heard of those phrases (yet)

The “Callback Pocess Mode” is a property of an AnimationPlayer, it will appear in the inspector. Try changing that property.

the function get_last_slide_collision() is a part of CharacterBody2D, it retrieves information about the last collision after calling move_and_slide() part of this information is the contact’s normal, we get this with get_normal() I must have mistyped. The surface normal is a vector pointing away from it’s face, if it’s a floor it will return Vector2.UP, a wall will be either Vector2.LEFT or Vector2.RIGHT depending on which side you touched. A slope will be something in between.

I’m guessing the “crashing” is a stack trace pointing to .normal() which does not exist. Sorry about that. Please post these stack traces, they are your first friend in solving errors.

ok so now theres a new issue
1:crouching still doesnt disable horizontal movement

if Input.is_action_pressed(“ui_down”):
is_crouching == true
parasol_girl.play(“crouching”)
collision.disabled = true
crouch_shape.disabled = false
horizontal_direction = false

elif Input.is_action_just_released("ui_down"):
	is_crouching =  false
	horizontal_direction = true
	collision.disabled = false
	crouch_shape.disabled = true
	
if velocity.y >= 1:
	parasol_girl.play("falling")
if dash_state:
	parasol_girl.play("dashing")

if is_crouching == false:
	horizontal_direction = false

2: attaching to a wall still crashes the game
if is_on_wall():
var wall_normal = get_last_slide_collision().get_normal()
velocity.x = wall_normal * speed
velocity.y = 30
jump_count = 1

3: i tried adding super jump with a button combination of crouching and jumping …it broke…everything relating to jumping, i can infinite jump, my jump height goes stupid high and i dont even know how that happened TwT , and it some how, some way, when holding the down key in the air makes me glide for a few seconds??? I DONT KNOW WHATS GOING WITH PEICE OF CODE

if Input.is_action_just_pressed("jump") and jump_count < max_jumps:
	is_crouching = false
	jump_count += 1
	velocity.y += JUMP_VELOCITY
if !fast_fall and Input.is_action_just_pressed("ui_down") and !is_on_floor():
	# If no 'downwards jump' has been triggered yet, we press the button to 'downward jump' AND we're not on the floor, do the drop!
	fast_fall = true
	jump_count = max_jumps # if we jump downwards.. no more jumping up!
	
if Input.is_action_pressed("jump") and ("ui_down"):
	super_jump = true
	velocity.y += super_jump_height
	is_crouching = false 
	jump_count += 1

It might be best to zip up and post project files. I am missing a lot of key details like how #1 crouching is tied to moving horizontal movement, the error message for #2, the error message for #3 and your InputMap would help since you are still using “ui_down” but also have “jump”.

May be best to open a new thread for individual issues, rather than trying to tackle everything at the same time.

ill make a new post