0 votes

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)
in Engine by (18 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.