I am trying to make a prompt for when my player character when a certain object how do I do this I have a sprite 2D and an Area2D on my block and my player has a collison shape 2D and a sprite 2D in a player charater2D
All help would be appreciated
what body your character use? the body have signals when you attach script to them.
CharacterBody
// Using MoveAndCollide.
var collision = MoveAndCollide(Velocity * (float)delta);
if (collision != null)
{
GD.Print("I collided with ", ((Node)collision.GetCollider()).Name);
}
// Using MoveAndSlide.
MoveAndSlide();
for (int i = 0; i < GetSlideCollisionCount(); i++)
{
var collision = GetSlideCollision(i);
GD.Print("I collided with ", ((Node)collision.GetCollider()).Name);
}
Im not sure if this is important but i have a area 2d on the object i want to check collision with and collision shape 2d as a child of it, the code didnt seem to work, but i am also able to walk through the object so that might be a problem on my end