0 votes

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

in Engine by (15 points)

1 Answer

+2 votes
Best answer

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.

by (109 points)
selected by

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

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

how do i do that?

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

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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.

Categories