So I have trees, and I want the player to be able to chop down trees for resources. However, I need a way for the game to be able to distinguish between the tree object and individual trees present in the game. That way chopping down one tree doesn’t destroy every other tree on the map. How do I accomplish this?
Using GDevelop’s Pick Nearest Object
condition. Take this for example:
In this example, I pick the tree object closest to the center of the player, check if its animation is cutting trees, and then delete the tree. Basically, the following conditions/actions will only affect the object that has been selected. Just make sure Pick Nearest Object
comes first in your conditions or it might not work.
1 Like