Question

I am currently working on a Connect four game.

My game works by the user pressing the 'New game' button. This then draws 42 (7*6) green circles to screen. These circles are used to represent holes on the connect four board i.e. green circles currently do not contain a player's token/counter

At this moment in time I am working on adding the tokens/counters. I have got code working (to a certain point) that enables the user to pick a column. Using log.d() It seems that I am successful changing the colour value of the gaps. My problem is that I do not know how to send this changing in colour to the View i.e. so the gap actually changes from green to red (player's token colour).

How can I send a request to the View so the gap is re-drawn?

N.B. Sorry for the lack of code but it is currently messy and not fully working. The View is controlled by a ConnectFourView.java (View), the game screen is Board.java (Model) and the code that works out which column has been selected Gaps.java (controller)

Was it helpful?

Solution

Just call invalidate() on your view and it will be redrawn

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top