1. tritonfx's Avatar
    Hey guys, I read forums.crackberry.com/f9/help-new-guy-making-game-264468/#post3072053 and am using that as a template for a game. The problem is in


    Code:
    public void paint(Graphics g) {
         g.setColor(_random.nextInt();); // _random being a Random object already created
         g.drawEllipse(25, 25, 25 + 10, 25, 25, 25 + 10, 0, 0); 
    }
    I basically just set a diff color for the ellipse each time paint is called, but it seems paint is only called once, so I was wondering if I'm doing it wrong. I basically copied everything from daveinsurgent's post, which is a great starting pt btw.
    01-29-10 06:32 PM
  2. QuiteSimple's Avatar
    you need to call invalidate() in a loop (invalidate() forces the screen to repaint itself)

    I guess you need to implement that part of the sample code:

    Code:
      private class Logic extends Thread {
        pulic Logic() {
          start();
        }
    
        public void run() {
          while (_active) {
            update();
            invalidate();
          }
        }
    As you can see invalidate() is called in the Logic thread
    01-30-10 03:20 AM
  3. tritonfx's Avatar
    well i copyed it word for word i just changed the drawing.
    and it included that.

    Posted from my CrackBerry at wapforums.crackberry.com
    01-30-10 04:12 AM
  4. GlenB's Avatar
    If I were writing a Blackberry game, I would start with Tony Westbrook's excellent blog post which Toni Westbrook dot Com Creating a Blackberry Game - Part 1
    01-30-10 04:48 AM
  5. tritonfx's Avatar
    Thanks, I'm actually using that tut as well. And it seems the problem was because the member _logic is declared as type Thread when it should've been type Logic, which explains why it didn't looped.
    01-30-10 06:19 PM
  6. GlenB's Avatar
    No problem - glad you got it sorted. The most active forum for Blackberry development seems to be the official RIM Java Development forum over at Java Development - BlackBerry Support Community Forums

    Worth a look if you havent already seen it.
    01-31-10 11:59 AM
LINK TO POST COPIED TO CLIPBOARD