+2 votes

I'm create game in which i have create Area2D node for each stone. what i want is when i drag stone i don't to overlap with other stones.

My Node Tree Look like: BaseStone.tscn


My all stone are inherit from BaseStone.tscn

reference Image

in Engine by (53 points)

2 Answers

0 votes
Best answer

Sounds like you need collision. Use RigidBody2D or KinematicBody2D.

by (4,187 points)
selected by

I used KinematicBody2D body but still its overlapping. do i have make any changes ?


i have two object in one scene, but still this two object overlapping.
Any idea??

With KinematicBody2D you have to call move_and_slide or move_and_collide for the collision to work. Or you can just use RigidBody2D.

Thanks , i'm not calling move_and_slide thats why node get overlapped.

0 votes

What about the use of collision layers and masks?
You can set a layer for stones and remove the mask for stone layer.

It will work if you do not want to have any collision among stones.

by (313 points)
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 Frequently asked questions and 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 [email protected] with your username.