I'm trying to let some childnodes collide with each other but they ignore each other
I'm confused but here is my code maybe it's my fault
The Enemy's Code:
func _physics_process(delta: float) -> void:
var velocity = direction
velocity.x = direction.x * 150
move_and_slide(velocity, Vector2.UP)
var collision = move_and_collide(velocity * delta)
if collision:
print(collision.get_collider())
collision.collider.move_and_collide(velocity * delta)
func _on_VisibilityNotifier2D_screen_exited() -> void:
queue_free()
func _on_Jump_over_Checker_body_shape_entered(body_id: int, body: Node, body_shape: int, local_shape: int) -> void:
if body.name == "Player":
get_parent().get_node("HUD").update_score()
And the Import of the Scene:
const OBSTACLE = preload("res://Scripts/Enemy.tscn")
func _on_Timer_timeout() -> void:
var obstacle = OBSTACLE.instance()
obstacle.position = Vector2((rand_range(500, 1000)), 192)
add_child(obstacle)