Godot Version
4.4
Question
ok so this is the code
extends CharacterBody2D
const speed = 50
const jump = -100
const gravity = 3
const acc = 1
# acc = acceleration
const UP = Vector2(0, -1)
var motion = Vector2()
func _physics_process(delta):
motion.y += gravity
if Input.is_action_pressed("move_right"):
motion.x = speed
elif Input.is_action_pressed("move_left"):
motion.x = max(motion.x - acc, -speed)
else:
motion.x = lerp(motion.x, 0.0, 0.2)
Im trying to make my first game, a 2D platformer, and for some reason the game isnt working? The character doesnt move and the code doesnt give error. If I add a print(“left”) to the moving to the left it does print it so its working but the caracter isnt moving for some reason.
Someone help me, I have no idea TwT