How to create a highlighted button for the menu

Hi,

Im trying to create a button for my menu that select multiple objects in 1 click/tap and those objects should stay highlighted and if i click the button once more eliminate the selection returning those objects to the [0] animation, dont send me to wiki.compilgames.net/doku.php/gd … ingbuttons because thats NOT i want to do

The “linked objects extension” should do the trick.
You can can virtually “link” the selected objects to the button.
When clicking on the button to deselect the objects you can loop over every linked object of the button and set their animation back to 0 in order to deselect them.

where i can find that option? is it a condition in the events of the scene or is a behavior for the object?

You can activate it in the “Projects” tab under “Extensions and platforms”.
The extension is only available in the events sheet with both conditions and actions.

okay this is an image, i only have 3 days using Gdevelop fighting with this contidions and still dont know how to put a good logic for this objects, this isn’t working, why? imagine that “SeleccionarTodos” is my button and PJ_Infiltrado is my character that i want to pick, by the way is there a better logic to select 11 diferent characters, all in 1 click?
http://prntscr.com/dpq7ha

This actually work, but someone know how to reverse it? i mean how to deselect and get everything to the original animation?

http://prntscr.com/dpr4ns

In case the objects you want to highlight are different independent objects and not the instances of the same object,
what I suggest is put all the objects you want to highlight in to a group, and when you press the button, use the group name to refer to the objects when you change their animations.

In case the objects you want to highlight are instances of the same object, I believe by simply using the object name when you change the animation should change the animation of all, but in case you want to change the animation only of a few specific instance, you can use an object variable to mark them or the linking extension to link them to the button as you try it now but I’m not sure if you really need that.

For example, to change animation of objects when a button is pressed, I would do something like this:

You may notice the variable “mouse_released”, I use that to make sure the animation is changed only once each time I press the button. Without the variable, when the animation is “0” I change it to “1” and because it is “1” in the next event, it would change back to “0” automatically. By using this variable trick I can avoid that and make the objects sort of “selected”, “deselected” each time I press the same button.

My example should work in case you want to change the animation of ALL instances of the same object, or different objects in the same group.

In case you want to change the animation only of specific instances of the same objects using a specific button, you need to use object variables to make a link and use the “For each object” event (this is a special event) to go through every single instance and look for the variable related to the button you pressed and then change the animation the way I have done. Or you can use the linking extension but to make a link work you still need something, a condition that is true only for the specific objects to be able to make a link. A specific animation, name, variable, position or something. This topic can be complex depends on what you really trying to do and I don’t have time to explain in detail every single possibility but I hope it helps to get started.