0 votes

This is the main scene
Instanced Node

My problem:

When the player character (red godot logo) collides with another Godot logo, it must print something in the output console. But the problem is, nothing is happening... I don't understand why.

Area2D Body-Enters event/signal code:

extends Area2D

func _ready():
    print("Area2D ready")

func _on_Area2D_body_enter( body ):
    print("yo! Interacting!") #<-- this code is not getting executed when colliding

Godot project: https://drive.google.com/file/d/1sVC7l2V2UjMBvwzhEHSedkpI98jgoB6I/view?usp=sharing

in Engine by (101 points)

1 Answer

+2 votes
Best answer

You need to connect signal area_enter. It detects intersections with areas that have collision shape (as their direct child).

body_enter detects collision with PhysicsBodies that have collision shape.

by (2,302 points)
selected by

Wow.. thanks man! I was 2 days busy with it... just couldn't figure it how it worked.

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.