Select and deselect instances (radio button style)

Get help using Construct 2

Post » Tue May 23, 2017 1:03 pm

I'm working a while on this (simple?) problem, but I can't find a solution. I'm working on a strategy game and when you click a building it turns in the "move mode". Ok great, but I can't figure out how to deselect an instance when I click another Instance from the same object. There should be only one instance in move mode like radio buttons.

Here is what I've done:

2/3: "mode_move" on/off state
4: Button to create a new building and turn on the "mode_move"
5: Clicking anywhere "mode_move" turns off and set the new building position
6: Clicking anywhere "mode_move" turns off and set the previous building position when overlapping another building
7: Clicking a building turns "mode_move" off for all instances and turns "mode_move" on for the clicked object

I think event 7 does not work, so you can click multible buildings.
Posts: 8
Reputation: 191

Post » Tue May 23, 2017 1:24 pm

Not sure why so complicated. Or use drag&drop or use an boolean together with a position to mouse (every tick).

If you use drag&drop, it does not need to be disabled. Unless the buildings have a state that does not allow them to move. But i dont see that in your events.

Now you have all the drag&drop conditions.

On drag start
___ Here you can set the boolean, if you need it

On drop
___ Here you can unset the boolean
___ Reposition (snap) if need
Posts: 2,493
Reputation: 21,450

Post » Tue May 23, 2017 2:38 pm

Thank you, that helped me a lot.
I want that you first need to click once the building before you kann move it, to prevent accidently move a building while scrolling over the map.

I solved it with a group in this way:
Posts: 8
Reputation: 191

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests