Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Aayush |
code:
extends KinematicBody2D
var velocity = Vector2()
export var jumpheight = 100
export var walkspeed = 150
func _get_input():
if Input.is_action_pressed(“left_move”):
velocity.x = -walkspeed
elif Input.is_action_pressed(“right_move”):
velocity.x = walkspeed
else:
velocity.x = 0
func _physics_process(delta):
_get_input()
var motion = velocity.x*delta
move_and_collide(motion)
I keep getting the error but the guy from the tutorial always runs it.Ther error says:
"Invalid write in function ‘move_and_collide’ in base ‘Kinematicbody2D’ Cannot convert argument 1from float to Vector2’
If you can solve this or tell me where the mistake is, It would be greatly appreciated!
You said move_and_slide in title btw
Annoying_Brother | 2020-12-11 18:52
Also is the move_and_collide() in the physics process func?
Annoying_Brother | 2020-12-11 18:53