CodeTurtle's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
6 (0.02 per day)
Joined:
29-May 12
Profile Views:
50
Last Active:
User is offline Jun 08 2012 02:07 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Who Cares
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
XBox
Your Car:
Who Cares
Dream Kudos:
0
Icon   CodeTurtle has not set their status

Posts I've Made

  1. In Topic: Java cannot find symbol - variable

    Posted 31 May 2012

    Okay, thanks for the information. I'm not very familiar with timers but I'll look at some tutorials. :)
  2. In Topic: Java cannot find symbol - variable

    Posted 31 May 2012

    Also, I have one more question if you don't mind. It's just a logic error. My Action Listener code probably isn't in the right spot because when I click the button, the line doesn't speed up. Where should I use my Action Listener to effectively move the line?

    Here is my Action Listener code and below it is my thread that updates the line and moves it across the screen:
    // Method for controlling player line
       public void actionPerformed (ActionEvent e) {
           if (e.getSource() == move) 
           {
               SpeedX2++;
            }
        }
      
       //Move and update line
       public RaceGame() {
          this.setPreferredSize(new Dimension(BOX_WIDTH, BOX_HEIGHT));
      
          // Start line movement (new thread)
          Thread gameThread = new Thread() {
             public void run() {
                while (true) { // Execute one update step
                   X1 = X1 + SpeedX1;
                   X2 = X2 + SpeedX2;
                   if (X1 == lineX) 
                   {
                       SpeedX1 = 0;
                   }
                   if (X2 == lineX) 
                   {
                       SpeedX2 = 0;
                   }
                   // Refresh the display
                   repaint(); // Repaint line across screen
                   // Delay for timing control
                   try {
                      Thread.sleep(1000 / UPDATE_RATE);  // milliseconds
                   } catch (InterruptedException ex) { }
                }
             }
          };
          gameThread.start();  // initiate movement
       }
    
  3. In Topic: Java cannot find symbol - variable

    Posted 31 May 2012

    Thank you so much! :) Forgive me, I'm fairly new to programming so sometimes I make simple mistakes.
  4. In Topic: Hello Dream.In.Code!

    Posted 29 May 2012

    Hi Gunner! I think I did miss that prompt, but oh well. Thanks for the welcoming. Right now I'm in a 9th grade intro programming course, so I still have much to learn.

    I've learned mostly Visual Basic this year, with some C++ and Java. However, I heard VB isn't very useful and I really like Java so I've been teaching myself the language for a few weeks. I feel like there's a lot for me to learn on this site!

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
September 29
Gender:
Programming Languages:
Java

Contact Information

E-mail:
Private

Comments

CodeTurtle has no profile comments yet. Why not say hello?