Breakout game Help

  • (2 Pages)
  • +
  • 1
  • 2

16 Replies - 2018 Views - Last Post: 03 June 2014 - 07:27 PM Rate Topic: -----

#1 Greencake  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 03-June 14

Breakout game Help

Posted 03 June 2014 - 05:45 AM

When i press play, only a small grey box appears, i don't know why, any errors or suggestions in my coding?

//package breakout;

static public void main(String args[]) {
  PApplet.main(new String[]{"BreakOut"});
}

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.util.Random;

public class Ball {
    
    public int x,y;
    public Dimension xMax,yMax;
    public final int radius;
    public final Color colour;
    public double dirX, dirY;
    public double speed;
    
    public Ball(int x, int y, int radius, Color colour,double speed){
        
        this.x = x;
        this.y = y;
        this.radius = radius;
        this.colour = colour;
        this.speed = speed;
        
        Random ran = new Random();
        double num = ran.nextDouble()*2;
        dirX = num;
        double dirDiv = Math.sqrt(dirX*dirX + dirY*dirY);
        
        dirX += dirX/dirDiv;
        dirY += (1-dirX)/dirDiv;       
    }
    
    // Paints Ball given values from Breackout class
    public void paintThis(Graphics g){
        g.setColor(colour);
        g.fillOval(x-radius, y-radius, 2*radius, 2*radius);
    }
    
    // Bounds to for handleCollisions method in Breakout
    public Rectangle getBounds(){
        return new Rectangle(x-radius, y-radius, 2*radius, 2*radius);       
    }
    
    // int speed requirement to speed up the ball as the game progresses
    public void move(double speed){
        
            x -= (int) (dirX*speed);
            y -= (int) (dirY*speed);
    }
    
    // Changes Direction of the ball after hitting an object
    public void reflect (boolean vertical, boolean horizontal){
        
        if (vertical) dirX *= -1;
        if (horizontal) dirY *= -1;
    }
}

//package breakout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.Timer;
import java.util.TimerTask;
import java.util.Vector;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class Breakout extends TimerTask{

    public Vector<Brick> bricks;
    public Ball ball;
    public Paddle paddle;
    public PaintingPanel panel;
    public boolean gameRunning = false;
    public int score, paddSpeed, paddSize, paddThickness;
    public double speed;
    public JLabel cScore;
    
    public Breakout(){
        Vector<Object> vecObj = new Vector();
        
        // Game window size 800x560
        int gameWidth = 800;
        int gameHeight = 560;       
        
        // Displays score
        cScore = new JLabel("Score: " + score);
        cScore.setForeground(Color.yellow);
        
        panel = new PaintingPanel(vecObj);              
        panel.setBackground(Color.BLACK);
        panel.setPreferredSize(new Dimension(gameWidth,gameHeight));
        panel.add(cScore);
        
        
        // Create new paddle and centres it with initial size & speed
        paddSize = 100;
        paddThickness = 10;
        paddle = new Paddle(paddSize,paddThickness);
        paddSpeed = 25;
        paddle.centreX = gameWidth/2;
        paddle.centreY = gameHeight-5;
        vecObj.add(paddle);
        
        // Create new array of bricks
        bricks = new Vector<Brick>();
        // i = number of columns  im = i multiplier
        // j = number of rows     jm = j multiplier
        // bw = brick width       db = distance from top left & right border/side
        int im = 78; int jm = 30; int bw = 68; int db = 14;
        for (int i = 0; i<10; i++){
            for(int j = 0; j<8; j++){
               if(j<4){
                   // Coloured bricks see below for what each brick does
                   if(i == 2 && j == 1 || i == 7 && j == 1){
                     Brick brick = new Brick(i*im+db,j*jm+db,bw,20,Color.WHITE);
                     bricks.add(brick);
                     vecObj.add(brick);
                   }
                   else if(i == 3 && j == 2 || i == 6 && j == 2){
                     Brick brick = new Brick(i*im+db,j*jm+db,bw,20,Color.RED);
                     bricks.add(brick);
                     vecObj.add(brick);
                   }else{                     
                     Brick brick = new Brick(i*im+db,j*jm+db,bw,20,Color.BLUE);
                     bricks.add(brick);
                     vecObj.add(brick);}
                   }else if(i == 1 && j == 4 || i == 8 && j == 4){                      
                     Brick brick = new Brick(i*im+db,j*jm+db,bw,20,Color.YELLOW);
                     bricks.add(brick);
                     vecObj.add(brick);
                   }else if(i == 3 && j == 6 || i == 6 && j == 6){                      
                     Brick brick = new Brick(i*im+db,j*jm+db,bw,20,Color.WHITE);
                     bricks.add(brick);
                     vecObj.add(brick);
                   }else{
                     Brick brick = new Brick(i*im+db,j*jm+db,bw,20,Color.GREEN);
                     bricks.add(brick);
                     vecObj.add(brick);
               }
            }
        }
        
        // Create new ball with inital speed
        speed = 4;
        ball = new Ball(gameWidth/2,gameHeight-17,7,Color.RED,speed);
        vecObj.add(ball);
               
        showGUI(panel);
    }
    
    // Starts the game by making boolean true
    public void beginGame(){
        gameRunning = true;
    }
    
    @Override
    public void run() {
        if(gameRunning){
            ball.move(speed);
            handleCollisions();
            Vector<Object> vecObj = new Vector<Object>();
            vecObj.add(ball);
            vecObj.add(paddle);
            for(Brick brick:bricks)
                vecObj.add(brick);
            panel.contents = vecObj;
            panel.repaint();
            
        }   
    }
    // Stops the game by making boolean false
    public void stopGame(){
        gameRunning = false;
    }
    
    public void handleCollisions(){
        if(bricks.isEmpty() == true){
            stopGame();
        }
        
        // Ensures the paddle does not go off the screen
        if(paddle.centreX < 0)
            paddle.centreX = 10;
        if(paddle.centreX > 800)
            paddle.centreX = 790;
        
        if(ball.y > 560){
            stopGame();
        }
        if(ball.x < 0 || ball.x > 800)
            ball.reflect(true, false);
        if(ball.y < 0)
            ball.reflect(false, true);
        if(ball.getBounds().intersects(paddle.getBounds()))
                ball.reflect(false, true);     
        
        for(Brick brick: bricks){
            if(ball.getBounds().intersects(brick.getBounds())){
                // Scoring for hitting bricks with score update
                if(brick.colour == Color.BLUE){
                    score += 10;
                    cScore.setText("Score: " + score);
                }else if(brick.colour == Color.RED){
                    // Score Multiplier Brick
                    score *= 3;
                    cScore.setText("Score: " + score);
                }else if(brick.colour == Color.YELLOW){   
                    // Score Multiplier Brick and speed up brick
                    score *= 2;
                    paddSpeed += 10;
                    cScore.setText("Score: " + score);
                }else if(brick.colour == Color.WHITE){   
                    // Score Brick and size increase
                    paddle.padSize +=10;
                    paddle.padThickness +=1;
                    score += 10;
                    cScore.setText("Score: " + score);    
                } else {
                    score += 5;
                    cScore.setText("Score: " + score);
                }
                // Speed up as you destroy more bricks
                speed += 0.15;
                ball.reflect(false, true);
                bricks.remove(brick);     
                break;
            }
        }
    }
       
    public /*static*/ void main(String[] args) { 
        Timer t = new Timer();
        t.schedule(new Breakout(), 0, 40);
    }
    
    // static wasn't used because it says "You MAY use the following description 
    //                                     of classes and interfaces as guideline."
    // Standard GUI method
    public void showGUI(PaintingPanel panel){
        
        JFrame frame = new JFrame("Breakout");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setContentPane(panel);
        frame.addKeyListener(new Breakout.KeyListen());
        frame.setResizable(false);
        frame.pack();
        frame.setVisible(true);   
    } 
    
    // KeyListener for paddle
    private class KeyListen extends KeyAdapter implements KeyListener{     
        @Override
        public void keyPressed(KeyEvent ke) {
            switch(ke.getKeyCode()){
                case KeyEvent.VK_LEFT:
                    paddle.centreX -= paddSpeed;
                    break;
                case KeyEvent.VK_RIGHT:                  
                    paddle.centreX += paddSpeed;
                    break;
                case KeyEvent.VK_SPACE:
                    beginGame();
                    break;
            }
        }
    } 
}

//package breakout;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;

public class Brick{
    
    public final int topLeftX, topLeftY, width, height;
    public final Color colour;
    
    public Brick (int topLeftX, int topLeftY, int width,
            int height,Color colour){
            
        this.topLeftX = topLeftX;
        this.topLeftY = topLeftY;
        this.width = width;
        this.height = height;
        this.colour = colour;   
    }
    
    // Paints Brick given values from Breackout class
    public void paintThis(Graphics g){
        g.setColor(colour);
        g.fillRect(topLeftX, topLeftY, width, height);
    }
    
    // Bounds to for handleCollisions method in Breakout
    public Rectangle getBounds(){
        return new Rectangle(topLeftX, topLeftY, width, height);
    }
}

//package breakout;
import java.awt.Graphics;
import java.util.Vector;
import javax.swing.JPanel;

public class PaintingPanel extends JPanel{
    
    public Vector<Object> contents;
    
    public PaintingPanel(Vector<Object> contents){
        this.contents = contents;
    }

    public void paintComponent(Graphics g){
        super.paintComponent(g);
        for(Object obj: contents){
            if(obj instanceof Ball){              
                ((Ball)obj).paintThis(g);
            } else if(obj instanceof Brick){
                ((Brick)obj).paintThis(g);
            } else if(obj instanceof Paddle){
                ((Paddle)obj).paintThis(g);
            }             
        }   
    }
}

//package breakout;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;

public class Paddle {
    public int padSize;
    public int padThickness;
    public int centreX, centreY;
       
    public Paddle(int padSize, int padThickness){
        this.padSize = padSize;
        this.padThickness = padThickness;
    }
    // Paints Paddle given values from Breackout class
    public void paintThis(Graphics g){
        g.setColor(Color.WHITE);
        g.fillRect(centreX-padSize/2, centreY-padThickness/2, padSize, padThickness);
    }
    
    // Bounds to for handleCollisions method in Breakout
    public Rectangle getBounds(){ 
        return new Rectangle(centreX-padSize/2, centreY-padThickness/2, padSize, padThickness); 
    }
}

This post has been edited by smohd: 03 June 2014 - 05:49 AM
Reason for edit:: Code tags! please use them when posting code


Is This A Good Question/Topic? 0
  • +

Replies To: Breakout game Help

#2 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3485
  • View blog
  • Posts: 15,762
  • Joined: 20-September 08

Re: Breakout game Help

Posted 03 June 2014 - 06:25 AM

And when you've got so much code, please paste AND attach it
Was This Post Helpful? 0
  • +
  • -

#3 farrell2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 874
  • View blog
  • Posts: 2,706
  • Joined: 29-July 11

Re: Breakout game Help

Posted 03 June 2014 - 07:34 AM

The only suggestion I can offer on your code is to scrap it and start over. You have taken something simple and made it overly complicated to the point where it is masochistic to even attempt to decipher it. There are plenty of breakout tutorials online. You should spend some time checking them out.
Was This Post Helpful? 0
  • +
  • -

#4 Greencake  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 03-June 14

Re: Breakout game Help

Posted 03 June 2014 - 04:35 PM

nope, doesn't work? >.< , please help, D: , i just need to change some code to have it working in c++, please. i have to make it complicated as it is required
Was This Post Helpful? 0
  • +
  • -

#5 drjoliv  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 67
  • Joined: 27-August 13

Re: Breakout game Help

Posted 03 June 2014 - 04:36 PM

Can you be more specific with your question what part of the code do you believe the error occurs?
Was This Post Helpful? 0
  • +
  • -

#6 Greencake  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 03-June 14

Re: Breakout game Help

Posted 03 June 2014 - 04:46 PM

I shouldn't use any import java.awt.*. Nor specify a package!
import java.util.Random; is redundant, since Processing got a random() function already!

i dont know how to change or fix these codes
Was This Post Helpful? 0
  • +
  • -

#7 drjoliv  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 67
  • Joined: 27-August 13

Re: Breakout game Help

Posted 03 June 2014 - 05:01 PM

I finished a course very recently in which the end product was a the exact same game. What are the requirements and when is it due? If you understand the requirements maybe we can get rid of some of this dead weight.
Was This Post Helpful? 0
  • +
  • -

#8 Greencake  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 03-June 14

Re: Breakout game Help

Posted 03 June 2014 - 05:05 PM

The requirements is to just make a game with a complicated code, i decided to make the game "breakout", it is due on friday 8pm, i just want it to run properly using as much of the code, i have now.
Was This Post Helpful? 0
  • +
  • -

#9 drjoliv  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 67
  • Joined: 27-August 13

Re: Breakout game Help

Posted 03 June 2014 - 05:22 PM

Well that's the dumbest thing I ever heard. Code should be intuitive well documented and not complicated. You start of fairly well with the Ball and Paddel class. The PaintingPanel adds alot more code for no apparent reason. And you extend TimerTask when a simple javax.swing.Timer would do to repaint the panel and handle such simple game logic.
Was This Post Helpful? 0
  • +
  • -

#10 Greencake  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 03-June 14

Re: Breakout game Help

Posted 03 June 2014 - 05:34 PM

yeah, i know, ~.~, sigh..

I don't need to shrink it down, i just need to change some parts to it, to make it work, like trimming it down, wouldn't necessarily make my game work..
Was This Post Helpful? 0
  • +
  • -

#11 drjoliv  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 67
  • Joined: 27-August 13

Re: Breakout game Help

Posted 03 June 2014 - 06:24 PM

What IDE are you using?

Are you using netBeans?

Are you using netBeans?
Was This Post Helpful? 0
  • +
  • -

#12 drjoliv  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 67
  • Joined: 27-August 13

Re: Breakout game Help

Posted 03 June 2014 - 06:36 PM

I went through and deleted your Panel class and made it a bit simpler. I didnt dare fix all those overly complicated if else statements. I also added a picture attachment of what the code looks like if you copy it correctly. I kept alot of your code just changed the things I mentioned earlier. Feel free to ask questions about it i think you could make a much better looking game also, you have lots of time left.


import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.ArrayList;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.Timer;

public class Breakout extends JComponent {

    public javax.swing.Timer tictoc;
    public ArrayList<Brick> bricks;
    public Ball ball;
    public Paddle paddle;
    public boolean gameRunning = true;
    public int score, paddSpeed, paddSize, paddThickness;
    public double speed;
    public Breakout() {

        // Game window size 800x560
        int gameWidth = 800;
        int gameHeight = 560;
        setFocusable(true);
        setPreferredSize(new Dimension(gameWidth, gameHeight));
        // Displays score
        
        // Create new paddle and centres it with initial size & speed
        paddSize = 100;
        paddThickness = 10;
        paddle = new Paddle(paddSize, paddThickness);
        paddSpeed = 25;
        paddle.centreX = gameWidth / 2;
        paddle.centreY = gameHeight - 5;

        // Create new array of bricks
        bricks = new ArrayList<>();
        // i = number of columns  im = i multiplier
        // j = number of rows     jm = j multiplier
        // bw = brick width       db = distance from top left & right border/side
        int im = 78;
        int jm = 30;
        int bw = 68;
        int db = 14;
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 8; j++) {
                if (j < 4) {
                    // Coloured bricks see below for what each brick does
                    if (i == 2 && j == 1 || i == 7 && j == 1) {
                        Brick brick = new Brick(i * im + db, j * jm + db, bw, 20, Color.WHITE);
                        bricks.add(brick);

                    } else if (i == 3 && j == 2 || i == 6 && j == 2) {
                        Brick brick = new Brick(i * im + db, j * jm + db, bw, 20, Color.RED);
                        bricks.add(brick);

                    } else {
                        Brick brick = new Brick(i * im + db, j * jm + db, bw, 20, Color.BLUE);
                        bricks.add(brick);
                    }
                } else if (i == 1 && j == 4 || i == 8 && j == 4) {
                    Brick brick = new Brick(i * im + db, j * jm + db, bw, 20, Color.YELLOW);
                    bricks.add(brick);
                } else if (i == 3 && j == 6 || i == 6 && j == 6) {
                    Brick brick = new Brick(i * im + db, j * jm + db, bw, 20, Color.WHITE);
                    bricks.add(brick);
                } else {
                    Brick brick = new Brick(i * im + db, j * jm + db, bw, 20, Color.GREEN);
                    bricks.add(brick);
                }
            }
        }

        // Create new ball with inital speed
        speed = 4;
        ball = new Ball(gameWidth / 2, gameHeight - 17, 7, Color.RED, speed);
        
        addKeyListener(new KeyListen());

        tictoc = new Timer(1000 / 30, new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                run();
            }
        });
        tictoc.start();
    }

    // Starts the game by making boolean true
    public void beginGame() {
        gameRunning = true;
    }

    public void run() {
        if (gameRunning) {
            ball.move(speed);
            handleCollisions();
            repaint();
        }
    }

    // Stops the game by making boolean false

    public void stopGame() {
        gameRunning = false;
    }

    public void handleCollisions() {
        if (bricks.isEmpty() == true) {
            stopGame();
        }

        // Ensures the paddle does not go off the screen
        if (paddle.centreX < 0) {
            paddle.centreX = 10;
        }
        if (paddle.centreX > 800) {
            paddle.centreX = 790;
        }

        if (ball.y > 560) {
            stopGame();
        }
        if (ball.x < 0 || ball.x > 800) {
            ball.reflect(true, false);
        }
        if (ball.y < 0) {
            ball.reflect(false, true);
        }
        if (ball.getBounds().intersects(paddle.getBounds())) {
            ball.reflect(false, true);
        }

        for (Brick brick : bricks) {
            if (ball.getBounds().intersects(brick.getBounds())) {
                // Scoring for hitting bricks with score update
                if (brick.colour == Color.BLUE) {
                    score += 10;
                } else if (brick.colour == Color.RED) {
                    // Score Multiplier Brick
                    score *= 3;
                } else if (brick.colour == Color.YELLOW) {
                    // Score Multiplier Brick and speed up brick
                    score *= 2;
                    paddSpeed += 10;
                } else if (brick.colour == Color.WHITE) {
                    // Score Brick and size increase
                    paddle.padSize += 10;
                    paddle.padThickness += 1;
                    score += 10;
                } else {
                    score += 5;
                }
                // Speed up as you destroy more bricks
                speed += 0.15;
                ball.reflect(false, true);
                bricks.remove(brick);
                break;
            }
        }
    }

    // KeyListener for paddle
    private class KeyListen extends KeyAdapter implements KeyListener {

        @Override
        public void keyPressed(KeyEvent ke) {
            int code = ke.getKeyCode();
            switch (code) {
                case KeyEvent.VK_LEFT:
                    paddle.centreX -= paddSpeed;
                    break;
                case KeyEvent.VK_RIGHT:
                    paddle.centreX += paddSpeed;
                    break;
                case KeyEvent.VK_SPACE:
                    beginGame();
                    break;
            }
        }
    }

    public void paintComponent(Graphics g) {
        g.drawString("Your score is: " + score, 10, 560);
        for (Brick b : bricks) {
            b.paintThis(g);
        }
        paddle.paintThis(g);
        ball.paintThis(g);

    }

    static public void main(String args[]) {

        JFrame frame = new JFrame("Break Out");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add(new Breakout());
        frame.pack();
        frame.setVisible(true);
    }
}




package breakout;


import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.util.Random;

public class Ball {
    
    public int x,y;
    public Dimension xMax,yMax;
    public final int radius;
    public final Color colour;
    public double dirX, dirY;
    public double speed;
    
    public Ball(int x, int y, int radius, Color colour,double speed){
        
        this.x = x;
        this.y = y;
        this.radius = radius;
        this.colour = colour;
        this.speed = speed;
        
        Random ran = new Random();
        double num = ran.nextDouble()*2;
        dirX = num;
        double dirDiv = Math.sqrt(dirX*dirX + dirY*dirY);
        
        dirX += dirX/dirDiv;
        dirY += (1-dirX)/dirDiv;       
    }
    
    // Paints Ball given values from Breackout class
    public void paintThis(Graphics g){
        g.setColor(colour);
        g.fillOval(x-radius, y-radius, 2*radius, 2*radius);
    }
    
    // Bounds to for handleCollisions method in Breakout
    public Rectangle getBounds(){
        return new Rectangle(x-radius, y-radius, 2*radius, 2*radius);       
    }
    
    // int speed requirement to speed up the ball as the game progresses
    public void move(double speed){
        
            x -= (int) (dirX*speed);
            y -= (int) (dirY*speed);
    }
    
    // Changes Direction of the ball after hitting an object
    public void reflect (boolean vertical, boolean horizontal){
        
        if (vertical) dirX *= -1;
        if (horizontal) dirY *= -1;
    }
}



package breakout;


import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;

public class Brick{
    
    public final int topLeftX, topLeftY, width, height;
    public final Color colour;
    
    public Brick (int topLeftX, int topLeftY, int width,
            int height,Color colour){
            
        this.topLeftX = topLeftX;
        this.topLeftY = topLeftY;
        this.width = width;
        this.height = height;
        this.colour = colour;   
    }
    
    // Paints Brick given values from Breackout class
    public void paintThis(Graphics g){
        g.setColor(colour);
        g.fillRect(topLeftX, topLeftY, width, height);
    }
    
    // Bounds to for handleCollisions method in Breakout
    public Rectangle getBounds(){
        return new Rectangle(topLeftX, topLeftY, width, height);
    }
}

package breakout;


import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;

public class Paddle {
    public int padSize;
    public int padThickness;
    public int centreX, centreY;
       
    public Paddle(int padSize, int padThickness){
        this.padSize = padSize;
        this.padThickness = padThickness;
    }
    // Paints Paddle given values from Breackout class
    public void paintThis(Graphics g){
        g.setColor(Color.WHITE);
        g.fillRect(centreX-padSize/2, centreY-padThickness/2, padSize, padThickness);
    }
    
    // Bounds to for handleCollisions method in Breakout
    public Rectangle getBounds(){ 
        return new Rectangle(centreX-padSize/2, centreY-padThickness/2, padSize, padThickness); 
    }
}


Forgot to attache the picture

Attached image(s)

  • Attached Image

Was This Post Helpful? 0
  • +
  • -

#13 Greencake  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 03-June 14

Re: Breakout game Help

Posted 03 June 2014 - 06:55 PM

Sorry, if this is too late to say, but the program i am using is "Processing.org"

When i copy and paste your code, an error at the line
" tictoc = new Timer(1000 / 30, new ActionListener() { "

saying "The new ActionListener(){} must implement the inherited abstract method ActionListener.actionPerformed(ActionEvent)
Was This Post Helpful? 0
  • +
  • -

#14 drjoliv  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 67
  • Joined: 27-August 13

Re: Breakout game Help

Posted 03 June 2014 - 07:03 PM

In line 083 it does implement the method actionPerformed(ActionEvent)
Was This Post Helpful? 0
  • +
  • -

#15 drjoliv  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 67
  • Joined: 27-August 13

Re: Breakout game Help

Posted 03 June 2014 - 07:12 PM

Do you know how to run your code in the cmd prompt?
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2