Topic was automatically imported from the old Question2Answer platform.
i want my player to be able to just go through a block like there is no collision but enemies cant and would just act like there is a collision there also i used this code to make my slime change direction
motion.x = speed * dir
dir *= -1
$Sprite.flip_h = !$Sprite.flip_h
if is_on_floor() == false:
motion.y += gravity
or if there is a way for my slime enemy to go the opposite direction if they see there is an edge and they are gonna fall off if they dont go the opposite direction
This is the perfect situation for collision layers and masks. For example, if you set the collision layer of the block to “block”, you can then set “block” on the mask of the player and disable it on the mask of the enemy.