System Behind Following Clicked Buttons

Hello folks,

Basically, I am trying to implement this system:


To explain:

  1. We click any button so it is activated and turns green.
  2. Then click any other button so the first clicked button passes “1” to the second click button.

Of course there will be limits like some of the buttons will reach maximum value and even we try to pass “1” to them system will not accept it. But above is the main logic.

Do you have any suggestions on how I can achieve this?

You seem to be letting out a lot in your description. For one, ‘passing “1”’ doesn’t seem to be all, you also seem to change the Name of the buttons by some rule, which you imply with ‘reach Maximum value’.

But if all you want to do is increasing and decreasing the value of the button clicked and last button clicked, there is no need for complex logic: simply remember the last button clicked, and when it’s not null, reduce last button’s Name, increase current buitton’s Name and you are done.

pseudo-code:

if (lastButton != null) {
    currentButton.buttonValue += 1;
    lastButton.buttonValue -=1;
    currentButton = lastButton;
}
1 Like

Hey @csofranz thanks for your reply. In this case I need to reach currentButton and lastButton information. Do you have suggestions how can I achieve this?