Input.get_vector what arguments setting

Godot Version

4.0

Question

Hi, I was trying to implement character movement by defining direction vector to manage all allowed movements along accorded directions; just because all movements in my 2D platform are just: on left, on right and Jump I thougth using:
var direction = Input.get_vector(“go_left”,“go_right”,null,null)

but It looks like i cannot use null…

Input.get_vector is intended for 2D-movement

  • left ↔ right
  • up ↔ down

You use only 1D-movement left ↔ right with jump as a special move.

You might want to try Input.get_axis("go_left", "go_right") and handle jump separately from that.