So, I have 3 tower slots (It’s the same object created 3 times at the beginning of the scene.) and 3 seedlings.
After I drag and drop a seedling to a tower slot, the tower changes animation and a Stats Layout shows whenever I hover and click the tower. All good till now.
After I summon the second tower, whenever I click any of the 2 towers, the Stats Layout are showing on both towers.
After I summon the 3rd one and click on one of the towers, again the Stats Layout is showing on every tower.
How can I make it so that when I click on one tower, only the specific Stats Layout of the specific tower shows? The number of towers may vary from level to level.
Without seeing the code, perhaps assign a variable to each tower (ie tower =1, tower =2 …) and corresponding variable to each stat (stat=1, stat =2…), so if tower.Variable(tower) = stats.Variable(stats) show stat 1, if tower if tower ≠ stats if “Hide” the stats.? Just thinking for a moment on coffee break, hope it might help
this is only for the action of hiding and showing the ui
and this is how the tower and ui are created
I’m new to identifing variable such as you mentioned.
So, (without testing) I think I would try and handle it like this if it were my game:
I would make each Tower Zone have a variable ID (which it looks like you do) I will assume it is ID 1, 2, and 3, and not all the same. Assuming that, when the Tower Stats, Tower XP, and Collect are made, assign them the SAME ID as the TowerZone they are being made for. Be sure the put all your stat objects in a group, lets call it “stats”.
Then, when the mouse press on a tower_Zone, do something like this:
This should delete the stats not needed, and only show the created stats only for that Tower_ZOne.
Now, as I said, I haven’t tested it, and I am certainly not an expert, and I am sure there are better ways to do this, but perhaps this is a starting point that might help
You are missing the condition “Take account linked objects” in both of these events, because only using the action “link objects” by itself does “nothing”.
You probably want to insert variable checks at the top instead of collision checks, for performance. (Because if a condition is not met, GDevelop won’t read the next ones, avoiding unnecessary checks.)