0 votes

I am trying to replicate the Super Mario Thwomp and I created a space where if the player is inside it activates the Thwomp descent. Because he falls before Mario goes under. When I try to getoverlappingareas it doesn't find Mario's KinematicBody2D. Wish someone could explain to me the use of getoverlappingareas and getoverlappingbodies?
Below is an image with details.

enter image description here

asked Aug 1, 2019 in Gossip by coderpy (12 points)

1 Answer

+1 vote

get_overlapping_areas() detects other Area2Ds.

get_overlapping_bodies() detects PhysicsBody2D types (RigidBody2D, KinematicBody2D, or StaticBody2D).

Note that as stated in the Area2D documentation, the get_overlapping_* methods are only updated once per physics frame. It is typically preferable to use the area's body_entered and/or area_entered signals.

This would be perfect for your situation. Mario entering the "Thwomp Scan Area" will trigger the body_entered signal and you can make the Thwomp fall.

answered Aug 1, 2019 by kidscancode (15,508 points)

Thanks for your response. I managed to solve the problem. I'm very grateful.

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 How to use this Q&A? before posting your first questions.