i just started godot and i am looking at a tutorial and i got my character to move but i cant hold a or d (i will just move once) i hope someone can help here is the code
extends KinematicBody2D
const UP = Vector2(0,-1)
const GRAVITY = 20
const MAXFALLSPEED = 2000
const MAXSPEED = 800
const JUMPFORCE = 300
var motion = Vector2()
func _ready():
pass # Replace with function body.
func physicsprocess(delta):
motion.y += GRAVITY
if motion.y > MAXFALLSPEED:
motion.y = MAXFALLSPEED
if Input.is_action_just_pressed("right"):
motion.x = MAXSPEED
elif Input.is_action_just_pressed("left"):
motion.x = -MAXSPEED
else:
motion.x = 0
motion = move_and_slide(motion,UP)
if is_on_floor():
if Input.is_action_just_pressed("jump"):
motion.y = -JUMPFORCE
and here is the tutorial https://www.youtube.com/watch?v=xFEKIWpd0sU
i think its something to do with the delta but im not sure.