move_and_collide(velocity)`
for some reason, when I play the game it won’t work and ends up as a black screen.
Please help me. Oh and also, ignore the italic ones. Those are just the underscores.
First of all, the correct method to move a charecter should use -= or += depending on the case,
Ex:
if Input.is_action_pressed("right"):
velocity.x += 1
if Input.is_action_pressed("left"):
velocity.x -= 1
if Input.is_action_pressed("down"):
velocity.y += 1
if Input.is_action_pressed("up"):
velocity.y -= 1
Note; I used the input map for simplicity, in you case the input for right would be ui_right
Maybe that is the case?
If not, respond again to this thread or: Godot Docs
or
In gdscript everything aside from member variables (var velocity = Vector2.ZERO) must go in a method (function) which is whitespace defined (with a tab). Note, don’t mix tabs and spaces.