print("Physics is running")
var direction = Input.get_axis("left", "right")
if not is_on_floor():
velocity.y += get_gravity().y * delta
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = JUMP_VELOCITY
if direction != 0:
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0.0, SPEED)
move_and_slide()
Question
Hi sorry to bother everyone but I need help with some coding. I don’t have any experience with coding or video game design. I’mtrying to create a very simple platformer with the goal of having a character move left and right and jump on the platforms. the issue is whenever I run the scene, I cannot move the player character at all. My keyboard does work and I've followed youtube tutorials, but I;m getting nowhere,and for some reason, the scene does not play. The nodes look okay and the colison effect is there.
No, you don’t include the quotation marks when you enter it in the input map. You only use quotation marks when checking what input is pressed/released/etc.
So in input map, if you have an action called right, you just enter it as: right. When you want to work with it in your code, you write it “right”. The double quotation marks are there because the original name (right) is a string. Double quotation marks means “the characters between us is a string”.