Results 1 to 2 of 2
  1. #1
    linux_devil is offline Member
    Join Date
    Jun 2012
    Posts
    2
    Rep Power
    0

    Exclamation Breakout game : trying to change paddle width uploading different image , but failed

    this is piece of my code in paddle class :
    Java Code:
     
          
          public Paddle(){
              this(0);
          }
    and this is where collision of special ball is detected on paddle and overloaded constructor is called , depending on ctr1/2 paddle is scaled along its width by calling overloaded constructor and loading a new image file
    Java Code:
    if(ctr1){
             if(ball1.getRect().intersects(paddle.getRect())){
                paddle = new Paddle(1);
              }
            }
              if(ctr2){
             if(ball2.getRect().intersects(paddle.getRect())){
                paddle = new Paddle(2);
              }
              }
    There is no compile time error but run time error the moment constructor is called and game freezes . Please help
    Thanks in advance for your time
    Last edited by linux_devil; 06-25-2012 at 11:43 PM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Breakout game : trying to change paddle width uploading different image , but fai

    Questions:
    • When you say you have a run-time error, are you causing an exception to be thrown?
    • And if so, can you post the Exception stacktrace?
    • Do you have any println debug statements to see what is happening when the game freezes?
    • What are you using for your game loop? A Swing Timer perhaps?
    • Is this a Swing GUI? AWT? Something else?
    • Will the ball intersect immediately with the new Paddle object? If so, will this keep happening ad infinitum?

Similar Threads

  1. Paddle Class: Trying to code details to ball & paddle..
    By CuppaCoffee in forum New To Java
    Replies: 1
    Last Post: 01-09-2012, 12:14 AM
  2. Breakout game in the assignment 3 cs106
    By dage in forum New To Java
    Replies: 5
    Last Post: 03-16-2011, 05:07 PM
  3. Making a breakout Game
    By JavaIsSoEasy?? in forum Java Gaming
    Replies: 0
    Last Post: 03-05-2011, 10:52 AM
  4. Need help with Breakout game
    By tfitz666 in forum New To Java
    Replies: 9
    Last Post: 03-22-2010, 05:26 AM
  5. Breakout Game code help.
    By Ceasar in forum New To Java
    Replies: 6
    Last Post: 10-10-2009, 01:30 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •