can you give me an example,i dont quite understand sorry

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By VestBeginner

var velocity = Vector2.ZERO

func _physics_process(delta):
var Input = Vector3.ZERO
var Input.x = Input.get_action_strength(“ui_right”) - Input.get_action_strength(“ui_left”)

if Input.x == 0:
if Input.is_action_just_pressed("ui_up"):
	velocity.y = -120

velocity = move_and_slide(velocity)

func apply_gravity():
velocity.y += 4

func apply_friction():

func apply_acceleration(amount):
velocity.x = move_toward(velocity.x, 50 + amount, 20)

:bust_in_silhouette: Reply From: Gluon

You are trying to set input as a variable, this is one of the terms in the godot engine which has a meaning so this wont work. You cannot create a variable named if for example for the same reason. If you just change the name of your variable it should work.

Just change all of your references to input above to something like character_input
so for example

var character_input =


if character_input.x == 0:

just make that change in your code and it should work.

Dont change the line


as this is an actual reference to the godot engines input function.