Skip to main content
gamedev.net
🔒 Locked

[java] small article needs proof-reading

Started by progstuff Apr 16, 2003 at 5:37 AM 8 replies 250+ views
Original Post
progstuff
progstuff
hi! i decided to make a tutorial series for java newbies, and i''d like to get some feedback on the first article which i just uploaded to my site. it''s a small tutorial with code for a java applet and it definately needs some proof reading of other java developers so i can update it and use it for the next tutorials. you can find the article on my site by following the ''java'' link. if you''d like to spare a few minutes of your time to have a look at it and tell me what you think that would be great! unfortunately i don''t have a guestbook on my site yet so please reply in this thread or by email if you like. many thanks in advance for your help! go to my site here
Wrathnut
Wrathnut
Hmm the article doesn''t seem to bad for just presenting code. But there are a few things that should be mentioned.

1.The applet doesn''t seem to work in JVM 1.1.x. Actually I am not so sure the the class is even uploaded. Looking through the source it should run just fine, hence my questioning if it is even there yet.(I also tried to download it from the link but my download manager couldn''t find it.)
2. There are a few depreciated methods that you are using but, if you address them in your future tutorials like it sounds like you are, it should be ok. But here goes anyway:

The keyDown() methods are depreciated. The implements keyListener would be a better choice.

Applet.size() is depreciated, Applet.getSize() is the replacement method.

The thread handling you are doing might cause it to break in the newer VM''s. Apparently setting your thread to null in the stop() method is a no-no I am told. A better way to manager your thread would be sometihng like

  
public void start(){
isRunning = true;
runner = new Thread(this);
runner.start();
}

public void stop(){
isRunning = false;
}

public void run(){

while(isRunning){
//Run game

}
}


3. One question I have is: Is this goign ot be an on going tutorial? I mean are you going to go through and make a pong game from te ground up through sveral tutorial iterations? Just wondering cause I noticed that you were setting up variables to do some collision detection but never implemented it.

Other than that the code was easy to read. The comments were right on and explained what you were trying to accomplish clearly. Keep em coming.
progstuff
progstuff
hi wrathnut, many thanks for your input.

yes, i''ve already replaced the deprecated methods and used a KeyListener interface instead of the keyDown(), i''ll upload a new version soon. thanks for the tip about the threads, i didn''t know excactly but it worked ok for me, i''ll also change that!

about your 3rd question: yes i thought about doing an ongoing series with a full game in the end (graphics,text-output,sound,gamestates,savin hiscore to a file etc.), so it''s necessary that i ask you guys if everything looks right.

hmmm, the Pong.class file is actually on the server and it runs fine for me (which doesn''t say too much, i know). could be that it has been damaged by ftp''ing it or something (?)... i will check that out in a few minutes...

again, thanks for having a look!


p.s. yes, the link to the 2nd article is dead, because there is no 2nd article yet . it should be online in 1 or 2 days, featuring the changes you suggested, an AI-opponent and some simple graphics
progstuff
progstuff
hi!

i compiled the applet with the j2sdk (1.4.0) which i''m currently using.

i uploaded a new version of the article, with the changes you suggested. it compiles fine without any -deprecated warnings now, and the download for the code+applet also works now (sorry, the link was just broken!). does the applet on the page run in your browser now? the Pong.class file is on the server and the applet is embedded in the page, so if it doesn''t start it must be some other problem...

thanks for your help
Wrathnut
Wrathnut
Hi progstuff,
The code looks good. The applet didn''t work but that is only because it was compiled in 1.4, This is a good thing I think. I have been holding back from changing my programming from 1.1 to 1.4 because some the projects I have been working on run slower in the 1.4''s graphics pipeline. But I would have to say that by now most people are running a new JVM than 1.1.

Cheers


"And then 2 men appeared... Men in dark suits.. with dark soulless eyes. Men like this could have come from only one place..
The bank."
NuffSaid
NuffSaid
Having to code to a 1.1 standard is the main reason I stopped coding applets.

Anyhow, if you want to get class files that are compatible with JVM 1.1, just pass the compiler flag -target=1.1 and javac will generate 1.1 compatible class files.
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
progstuff
progstuff
thanks, i wasn''t aware of that.

cu
progstuff
progstuff
just wanted to add that i have just uploaded the 2nd article, which features some input things and basic pong game logic.

it''s really as simple as can be, and unless you are a extreme noob it may not be worth reading it ... the next article which i''m writing at the moment will probably be more interesting since i''m adding graphics- and text output and a reusable class for sprite animation.

p.s. i think last time i have recompiled the applet of the first tutorial with target=1.1, so it should work for most people now.


cu


go to my site here

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.