0 votes

hello. im new to coding and trying to learn how to code the kinematic body.
i have been able to make it move. but it will only move once each button press.
here is my code.
extends KinematicBody2D

var velocity = Vector2()

func physicsprocess(delta):
velocity.y += 0

if Input.is_action_just_pressed("ui_right"):
    velocity.x = 100
elif Input.is_action_just_pressed("ui_left"):
    velocity.x = -100
    velocity.x = 0


in Engine by (39 points)

1 Answer

0 votes
Best answer

You have to write Input.isactionpressed instead of Input.isactionjust_pressed

by (232 points)
selected by

thanks :D that was great help.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.