Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | deezy |
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 _physics_process(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
else:
velocity.x = 0
move_and_slide(velocity)
pass