Godot Version
4.6.1
Question
When moving a CharacterBody2D towards a collision, the collision shapes sort of go inside of each other, and when I let go of the key that moves the CharacterBody2D, it snaps the CharacterBody2D out of the other collision.
The code for the player is based on the “dodge the creeps” player code, with the only important difference being an additional move_and_collide() at the end of the movement code.
func _process(delta):
var movement = Vector2.ZERO
if Input.is_action_pressed("move_right"):
movement.x += 1
$AnimatedSprite2D.flip_h = false
if Input.is_action_pressed("move_left"):
movement.x -= 1
$AnimatedSprite2D.flip_h = true
if Input.is_action_pressed("move_down"):
movement.y += 1
if Input.is_action_pressed("move_up"):
movement.y -= 1
move_and_collide(movement * delta)
I apologize if this is worded really weirdly btw, I couldn’t really think of any other way to put it.