Handle buttons on actions - best practices
Posted: 18 January 2022, 17:16
I started my first small project yesterday, based on the Reversi tutorial, and I would like to apply some changes to the basic gameplay.
I would like to show two buttons after choosing an available cell, asking the player to select the colour of the token they want to place:
What is the common workflow in order to achieve this behaviour?
I see that the buttons need to be added in onUpdateActionButtons() function, but I don't understand how to show them when a specific condition is met (in this case, just after a click on a cell). Colour is just a variable to be set before the onPlayDisc() function since it's the only thing that changes between the two options.
Do I have to setup 2 different states (one for choosing the cell and another for the colour selection) or is it feasible in just one state?
I would like to show two buttons after choosing an available cell, asking the player to select the colour of the token they want to place:
What is the common workflow in order to achieve this behaviour?
I see that the buttons need to be added in onUpdateActionButtons() function, but I don't understand how to show them when a specific condition is met (in this case, just after a click on a cell). Colour is just a variable to be set before the onPlayDisc() function since it's the only thing that changes between the two options.
Do I have to setup 2 different states (one for choosing the cell and another for the colour selection) or is it feasible in just one state?