I am writing a simple game for 2 players, where they have to make turns after each other (select a few objects to remove from the screen) and press "End turn" at the end to pass the turn to another player.
The turns are switched in onClick
method on a onClickListener
, attached to the button "End turn". And it works fine for the case of 2 humans playing (on the same device). But if a person plays with the computer, the AI calculates and makes its move in the same onClick
method. Thus, its move are not drawn on the screen and the player sees as if after his move the board was redrawn immediately with the changes made by the computer's move (objects removed). How can I make is so automatic moves are drawn as in case of human play - the objects are selected by the AI and then removed (at this time the button "End turn" would be disabled)?