Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
* * * * - 2 votes

Game - A simple Pong

pong game java

  • Please log in to reply
31 replies to this topic

#25 Chall

Chall

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 349 posts
  • Location:Cedar Rapids, IA
  • Programming Language:Java
  • Learning:C, Java, C++, C#, Python, JavaScript, Assembly

Posted 15 June 2014 - 07:29 PM

do you know how to fix it?

Have you written a "PanelBall" class?

Another problem could be that there was a problem compiling the PanelBall class, and so it doesn't recognize it as a valid class.


Edited by Chall, 15 June 2014 - 07:33 PM.

  • 0
Speaks fluent Java

#26 SethChun

SethChun

    CC Lurker

  • New Member
  • Pip
  • 4 posts

Posted 16 June 2014 - 07:13 AM

yes, i have a PanelBall.java 6KB, a PanelBall.class 4 KB, and a Main.java 3KB


  • 0

#27 Chall

Chall

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 349 posts
  • Location:Cedar Rapids, IA
  • Programming Language:Java
  • Learning:C, Java, C++, C#, Python, JavaScript, Assembly

Posted 18 June 2014 - 11:15 AM

yes, i have a PanelBall.java 6KB, a PanelBall.class 4 KB, and a Main.java 3KB

Are you getting compilation errors for PanelBall at all? Not references of it, but errors within it?


  • 0
Speaks fluent Java

#28 SethChun

SethChun

    CC Lurker

  • New Member
  • Pip
  • 4 posts

Posted 18 June 2014 - 12:24 PM

Are you getting compilation errors for PanelBall at all? Not references of it, but errors within it?

no compilation errors at all but when i try to compile Main.java, it has the errors. i tried re-copying and pasting Main countless times, but it didn't work


  • 0

#29 Chall

Chall

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 349 posts
  • Location:Cedar Rapids, IA
  • Programming Language:Java
  • Learning:C, Java, C++, C#, Python, JavaScript, Assembly

Posted 18 June 2014 - 02:12 PM

no compilation errors at all but when i try to compile Main.java, it has the errors. i tried re-copying and pasting Main countless times, but it didn't work

Well then what you want to do is go through and find the bug.

When the compiler throws an error, it gives you the number of the line where it occurs, and which class it occurred in:

 

Main.java:13: error: cannot find symbol

private PanelBall panel = null; // This is the panel of the game class

^

symbol: class PanelBall

location: class Main

 

So line 13 has the error, which you already know. But this is just an example. I don't know why this error would happen if everything is valid, so check any other errors that aren't related to line 13 of main, and try and fix them.


Edited by Chall, 18 June 2014 - 02:13 PM.

  • 0
Speaks fluent Java

#30 JocuriNoi

JocuriNoi

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 06 October 2014 - 02:28 PM

public void moverPlayer1(){
        if(player1FlagUp == true && rock1Y>=0)
            rock1Y+=down;
        if(player1FlagDown == true && rock1Y<=(this.getHeight()-25))[B];[/B] // [B]Remove semicolon here[/B]
            rock1Y+=up;
        positionPlayer1(rock1X, rock1Y);
    }
    public void moverPlayer2(){
        if(player2FlagUp == true && rock2Y>=0)
            rock2Y+=down;
        if(player2FlagDown == true && rock2Y<=(this.getHeight()-25))[B];[/B] // [B]and here[/B]
            rock2Y+=up;
        positionPlayer2(rock2X, rock2Y);
    }


  • 0

#31 Jhon

Jhon

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 16 November 2014 - 04:16 PM

I created the Pong class and copied the first part of the code, then I created the Complements class and copied the another part of the code, but the part keypressed and keyreleased are giving error.
 
    private void formKeyPressed(KeyEvent evt)
    {
        panel.keyPressed(evt);
    }
    private void formKeyReleased(KeyEvent evt)
    {
        panel.keyReleased(evt);
    }
The error is:
 
"cannot find symbol
symbol: method keyPressed(KeyEvent)
location: variable panel of the type JPanel"
 
What do I do?
*PS: the variable panel is your PanelPelota

  • 0

#32 Jhon

Jhon

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 18 November 2014 - 05:37 PM

 

I created the Pong class and copied the first part of the code, then I created the Complements class and copied the another part of the code, but the part keypressed and keyreleased are giving error.
 
    private void formKeyPressed(KeyEvent evt)
    {
        panel.keyPressed(evt);
    }
    private void formKeyReleased(KeyEvent evt)
    {
        panel.keyReleased(evt);
    }
The error is:
 
"cannot find symbol
symbol: method keyPressed(KeyEvent)
location: variable panel of the type JPanel"
 
What do I do?
*PS: the variable panel is your PanelPelota

 

 

NERVERMIND, I already solved!


  • 0





Also tagged with one or more of these keywords: pong, game, java