Just as the title says
I am having problem with it my player can place objects in game but it can place multiple objects on the same spot
How can I fix that?
This would hardly depend on HOW you are placing objects
Here i can place stones with what i call selector (that white thing that replaces mouse cursor)
It moves on grid
Now i only check if it is in collision with stone or not
IF it is not i can place another stone if it is i can’t
As simple as that
So most simple solution is to check if where you want to place your object it collides with something already
You could create invisible object in front of your player if you are not using mouse like me
And check if that object is in collision with something and based on result allow or not to place new object
if you use mouse cursor to place object you could add to it invisible object and also check if it is in collision with something or not
Sounds simple but what if i have lots of objects that can be placed?
Then would i need to make the check collision event every time for each object?
Use object groups. Instead of using a specific sprite/object, use the group name. It’ll cover all the object types that are in the group.
Thank you Thank you i will try it