StephNicolaou 32 Posting Whiz in Training

This is a connect four game and I'm trying to show the counter falling. What I have so far is this which is in a for loop:

while(fallingCounter == true && x[j][i] < playerTurn)
                {
                    //Move the counter vertically down the grid's rows appearing to fall

                        fallingCounter();
                        g.setColor(counterColour);
                        //counterWidth = counterWidth - 10;
                        topYPos = topYPos + 10;
                        //centeredCounterInColumn = centeredCounterInColumn +10;
                        g.fillOval(centeredCounterInColumn,topYPos, counterWidth, counterHeight);

                }

This and similar versions of this, in and outside the for loop and in a do loop have shown the counter rapidly falling continuously showing previous ovals drawn (so it shows the whole falling path like a long rounded line going downwards). It only stops when I say until < grid[0].length in the while/for but I'm still left with the former problem and I want the "animation" to stop before a counter in the column - not just go over already inserted counters in the column till it reaches the bottom. I've been trying this for at least 5 hours now so I really would appreciate help with this one. I really would like to do this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.