943,633 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Marked Solved
  • Views: 646
  • Java RSS
Mar 21st, 2008
0

Show an oval moving up til a value in an array?

Expand Post »
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:

Java Syntax (Toggle Plain Text)
  1.  
  2. while(fallingCounter == true && x[j][i] < playerTurn)
  3. {
  4. //Move the counter vertically down the grid's rows appearing to fall
  5.  
  6. fallingCounter();
  7. g.setColor(counterColour);
  8. //counterWidth = counterWidth - 10;
  9. topYPos = topYPos + 10;
  10. //centeredCounterInColumn = centeredCounterInColumn +10;
  11. g.fillOval(centeredCounterInColumn,topYPos, counterWidth, counterHeight);
  12.  
  13. }

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.
Reputation Points: 39
Solved Threads: 12
Junior Poster
StephNicolaou is offline Offline
156 posts
since Nov 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Image Icon displays file name text
Next Thread in Java Forum Timeline: In desperate need of help with iterative insert method for avl tree. please help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC