How to do Area Entered in 2D(It doesn't work)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Pr0AppleMan

I’m new to Godot, and I’m stuck here. I watched a yt video which he used area entered. Here’s what i did:

  • added a area2D as a child of the player
  • added a collision as the area2D’s child
  • then in the nodes/signals tab i connected area2D to the player’s script
  • it automatically took me to the script in which a function is already entered.
func _on_SwordAttack_area_entered(area):

I placed the area2D’s collision lower than the player’s collision, so from my understanding It should print “OOY” when he player just touches the ground. Or is that not how it works? Should i send what’s written in the whole script?

:bust_in_silhouette: Reply From: kidscancode

Is your ground an Area2D? Because you connected the area_entered signal, which fires when another area enters.

If your ground is a body (more likely), then you need to use the body_entered signal.