detecting hit with kinmaticbody2d

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

Hello
my player is knimaticbody2d and my enemy is rigidbody2d

my goal is to detect whenever the rigidbody hits the kinematicbody and when it does I want to player to hide()
I tried several times , and searched the web , but to no avail
my player nodes are collisionshape2d and sprite, the same goes for the enemy
the way to do this is probably by using area2d but I couldn’t figure it out
please help me

:bust_in_silhouette: Reply From: rballonline

Add an Area2D to your sprite, add a CollisionShape2D to it. Choose the shape of your collision. Do the same for another object. Now when moving they’ll bump into each other.

No idea what hide() means.

thx a lot it worked
I added the area 2d to the kinematicbody itself, not the sprite
and it worked
thx man

godotuser123 | 2020-11-15 04:12

Mind giving me an upvote or marking it as an answer?

rballonline | 2020-11-15 05:58

how do i do that?

godotuser123 | 2020-11-15 11:50

Should be an option on my answer. Just nice to know when things have been answered.

rballonline | 2020-11-16 02:17