How could I change move_and_slide to move_and_collide?
Hi, I code on GDScript and I have recently followed along with a tutorial on how to make a 2D platformer game. The guy making the tutorial added in a thing called move_and_slide, however I encountered some problems with then navigating through my level, ad the player would slide all over the place. I then tried to swap out move_and_slide with move_and_collide, and it said this: res://Player.gd:53 - Parse Error: At "move_and_collide()" call, argument 2. The passed argument's type (Vector2) doesn't match the function's expected argument type (bool).
I will copy and paste my code for anyone interested in trying to help me fix this- any help would be appreciated!
-----Start of code------
extends KinematicBody2D const up = Vector2(0, -1) const gravity = 50 const max_fall_speed = 1000 const max_move_speed = 300 const jump_force = 1250 const acceleration = 5 var motion = Vector2() var facing_right = true func _ready(): pass func _physics_process(delta): motion.y += gravity if motion.y > max_fall_speed: motion.y = max_fall_speed motion.x = clamp(motion.x,-max_move_speed,max_move_speed) if facing_right == true: $Sprite.scale.x = 1 else: $Sprite.scale.x = -1 if Input.is_action_pressed("left"): motion.x -= acceleration facing_right = false $AnimationPlayer.play("Run") elif Input.is_action_pressed("right"): motion.x += acceleration facing_right = true $AnimationPlayer.play("Run") else: motion.x = lerp(motion.x,0,0.05) $AnimationPlayer.play("idle") if is_on_floor(): if Input.is_action_pressed("jump"): motion.y = -jump_force $AnimationPlayer.play("Jump") if !is_on_floor(): if motion.y < 0: $AnimationPlayer.play("Jump") elif motion.y > 0: $AnimationPlayer.play("Fall") elif motion.y == 0: $AnimationPlayer.play("idle") motion = move_and_slide(motion, up)
-----End of code------
If you can see above, it says move_and_slide, and I'm trying to change that so that I don't slide about, instead I just move and collide with objects.~~~~