The object is in type of "StaticBody2D", and as for the area , i plan to use "Area2D".
Do you know how to detect when the object enters the area in codes?
I'm new to godot. Thank you!
StaticBody2D is not meant for an object that can move, I suggest you use KinematicBody2D or RigidBody2D.
Area2D has a signal you can connect to, body_enter: http://docs.godotengine.org/en/latest/classes/class_area2d.html?highlight=body_enter#signals
You can connect it from the Node panel (or in code with connect()) to a method of your script and it will be called whenever a body enters the area.
Thank you. I followed the tutorial from here which is very long to read. Mostly I created an Area2D node, then added a subnode "CollisionShape2D", and I adjusted the shape within the area I want to take care of in the scene file ( say "my_scene.xml") .
And my codes are here:
Honestly I am a little confused about the doc because it doesn't have examples in details like charts or images. But it is helpful. Thank you!
With an area, you can use get_overlapping_areas and get_overlapping_bodies inside fixed process code too.