• (3 Pages)
  • +
  • 1
  • 2
  • 3

Programing an applet game of Pong A Step By Step Walk-Through And Explanation Rate Topic: ***** 3 Votes

#31 hscribe  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 22-July 12

Posted 25 August 2012 - 01:32 PM

View Posteekie, on 10 August 2012 - 07:12 AM, said:

View Postmacosxnerd101, on 09 August 2012 - 09:07 AM, said:

This is probably a yellow warning, rather than a red error. Some IDEs (note that Eclipse is NOT a compiler) complain about the serialVersionUID. You can add one as prompted or have your IDE ignore it.



Thanks for the information. Adding in the serialVersionUID seemed to resolve the problem. :bananaman:


I have done all of this also, but I still get a black screen in my browser (Firefox) with a grey box saying applet initialized. Any ideas? Thanks
Was This Post Helpful? 0
  • +
  • -

#32 evanf45  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-January 12

Posted 26 August 2012 - 02:54 PM

Ok so have programmed all of it but when I try to compile it it says num expected .
Please help I have tried to compile it using netbeans and javac
Was This Post Helpful? 0
  • +
  • -

#33 Mike+9  Icon User is offline

  • D.I.C Head

Reputation: 13
  • View blog
  • Posts: 104
  • Joined: 10-July 12

Posted 30 August 2012 - 03:05 AM

Hi and first of all thank you for this tutorial. I understood it but after trying to write it 2 times and even just using copy & paste for the code the game still doesn't seem to load up, in Chromium or applet viewer in Eclipse. I'm not getting any errors at all, it just doesn't show up anything.

I also trie dthe version already made on this site here and I get the same problem. Any ideea why it is not working?
Was This Post Helpful? 0
  • +
  • -

#34 Mike+9  Icon User is offline

  • D.I.C Head

Reputation: 13
  • View blog
  • Posts: 104
  • Joined: 10-July 12

Posted 30 August 2012 - 03:33 AM

View PostMike+9, on 30 August 2012 - 03:05 AM, said:

Hi and first of all thank you for this tutorial. I understood it but after trying to write it 2 times and even just using copy & paste for the code the game still doesn't seem to load up, in Chromium or applet viewer in Eclipse. I'm not getting any errors at all, it just doesn't show up anything.

I also trie dthe version already made on this site here and I get the same problem. Any ideea why it is not working?



Never mind, I fixed it. It was because of the java plugin.
Was This Post Helpful? 0
  • +
  • -

#35 evanf45  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-January 12

Posted 31 August 2012 - 02:05 PM

when ever i try to compile PaddleLeft.java, PaddleRight.java, Ball.java with javac it says
invalid flag: PaddleLeft.java
usage: javac <options> <source files>
use -help for a list of possible options.

Please help :helpsmilie: :( :frenchy:
Was This Post Helpful? 0
  • +
  • -

#36 drenfro87  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 25-September 12

Posted 25 September 2012 - 05:51 PM

OK so i have coded the program to exactly what he has and it compiles all of the classes fine. when i try and run the main class in ntextpad i get a white applet window with loading in the bottom left hand corner. When i try and run it in netbeans i get no main class found and when i try and run it in the html file i get pongMain: Unsupported major.minor version 51.0 . I am running it in chrome that is up to date and i have updated my java plug in to the most current version. I am a student and this is my first attempt at a game and my first attempt at a coded GUI. I made one once but it was using jFrame. Any help would be appreciated. Thanks!!
Was This Post Helpful? 0
  • +
  • -

#37 doxyJava  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 16-October 12

Posted 16 October 2012 - 09:45 AM

Trying this , hope it will work.Thanks a lot for this tutorial!
Was This Post Helpful? 0
  • +
  • -

#38 ajewers  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 22-October 12

Posted 22 October 2012 - 07:34 AM

View Postsabretooth, on 03 December 2011 - 06:17 AM, said:

"you have finished your first Game Java applet in a very professionally accepted and methodical way"

Please tell me you are joking.

System resource use is amazingly high due to that while loop which does not even need to be there.
The timer is already polling every 15ms, you don't need the while loop also.

I suggest making the Timer an instance variable and ending the start method at time.start();

This way your actionPerformed can look like this:
  public void actionPerformed(ActionEvent arg0) 
            {
                if(pRight.getScore() == 10)
                 {
                    time.stop();
                    currentTime = System.currentTimeMillis() - currentTime;
                 }
                 else
                 {
	         //moves the ball
	         ball.move();
	         //lines the computer paddle up with the ball
	         pRight.setPos(ball.getY() - 35);
	         //checks the ball for a collision
	         checkCollision();
                 }


	         //repaints the applet
	         repaint();
	    }




Much more efficient.


Is there any chance you could elaborate on this? Particularly on the 'making time an instance variable' part as the problem i'm having is that time.start() and time.stop() seem to need to be inside the same method
Was This Post Helpful? 0
  • +
  • -

#39 Jokerman.  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 22-May 13

Posted 22 May 2013 - 04:31 AM

sorry if this is considered a gravedig but anyway :S

inspired by this and Atari® I am currently making my own version of pong in BlueJ
and it would greatly help me if i had someone i could ask questions to.

would you please be so kind to help me?
(helping would be only answering my questions if i had any ^.^)
Was This Post Helpful? 0
  • +
  • -

#40 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10387
  • View blog
  • Posts: 38,438
  • Joined: 27-December 08

Posted 24 May 2013 - 07:44 PM

If you have questions on your own projects, you should post in the appropriate help forums rather than on a tutorial. Your post will be more visible that way, and probably get a better response!
Was This Post Helpful? 0
  • +
  • -

#41 afarozan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 14-November 13

Posted 16 November 2013 - 02:25 PM

I got this error -----> Compilation completed. The following files were not compiled:
/Users/wasekradio/Pong/pongMain.class should i put a public static args somewhere?
Was This Post Helpful? 0
  • +
  • -

#42 afarozan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 14-November 13

Posted 17 November 2013 - 10:24 AM

I got this error pongMain.class width = 500 height = 300> alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason." Your browser is completely ignoring the <APPLET> tag!
Was This Post Helpful? 0
  • +
  • -

#43 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10387
  • View blog
  • Posts: 38,438
  • Joined: 27-December 08

Posted 17 November 2013 - 11:24 AM

Chances are that Java is not enabled on your browser for security reasons. Java 7 Applets were hacked roughly a year ago; and as a security feature, browsers began auto-disabling Java.
Was This Post Helpful? 0
  • +
  • -

#44 th3rmalice  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 12-April 14

Posted 12 April 2014 - 12:12 PM

Hi everybody,
I know this is a bit late, but I need help. I have written all the code accurately, and yet, every time I try to run pongMain I get an applet with a blank white screen. Can anyone help?
Thanks
Was This Post Helpful? 0
  • +
  • -

#45 donkeydodo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 26-April 14

Posted 26 April 2014 - 03:07 AM

Hello, wonderful topic overall, I really like it! :)
One thing though is that I get this error on one front that I don't know how to fix..
It is:

run:
java.lang.NullPointerException
at PongMain.<init>(PongMain.java:89)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:793)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:722)
at sun.applet.AppletPanel.run(AppletPanel.java:379)
at java.lang.Thread.run(Thread.java:744)
BUILD SUCCESSFUL (total time: 30 seconds)

I'd appreciate if someone would help me out here :helpsmilie:
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3