Character won't jump when moving left.

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

I am making a simple platformer. It has all the basic mechanics such as running and jumping. But for some reason, it doesn’t jump when moving left. It works fine for the other direction. Here is my code:

extends KinematicBody2D

const UP = Vector2(0, -1)
var jump_power = 400
var gravity = 10
var speed = 250
var motion = Vector2()

func _physics_process(delta):
	motion.y += gravity                           #Gravity!

	if Input.is_action_pressed("ui_left"):        #Slide to the left!
		motion.x = -1 * speed
	elif Input.is_action_pressed("ui_right"):     #Slide to the right!
		motion.x = 1 * speed
	else:                                         # Freeze!                               
		motion.x = 0

	if is_on_floor():                             #Jump left PLEASE!
		if Input.is_action_pressed("ui_up"):
			motion.y = -1 * jump_power

	motion = move_and_slide(motion, UP)


:bust_in_silhouette: Reply From: Magso

Your code is fine, this is a common problem when certain keyboards don’t register certain combinations. Unfortunately chances are space + left won’t work on your keyboard with any game :confused: