Highscore demo

By mjrb4 - uploaded on 2009-1-1      1559 views (61 in the last 7 days)      4 votes (0 in the last 7 days)

Tags: game demo with-source highscore

This is a demo of a program that uses high scores - it was primarily intended as this, hence the rather quick-to-finish game being demonstrated.

The numbers will randomly flash at you between 1-10,000, you've got to wait for a high one and then click the red button as soon as you see one. When you do, you'll be asked to enter your name.

After this, the scenario should display a list of the top 10 names along with the numbers they achieved.


Open the scenario in Greenfoot.
Download the source for this scenario.


Your browser is ignoring the <APPLET> tag.

Some people who like this scenario: Ninto programmer haki777 Builderboy2005


This scenario is a member of the following collections: Reusable actors & support classes


Report this scenario as broken or inappropriate.

mjrb4 writes (on 2009-1-5):

Well with the code as it is at the moment, the only way I can think of is to either withold the source completely, or to deal with all the highscore bit in a seperate class and then remove the java source code of that class before you upload - that way you'll hide the name of the scenario used on the highscore database.
That said, it was designed as a quick add on for people wanting to record scores for their games and not as a super secure thing at all ;)

programmer writes (on 2009-1-19):

2 place, good job!

programmer writes (on 2009-1-19):

I changed the code for it to go higher and accidently added me as anonomous, can you please delete it somehow?

mjrb4 writes (on 2009-1-20):

Think I'll just wipe the lot again ;)

Ninto writes (on 2009-3-20):

Why can't greenfoot find the class highScore?

spaceblue writes (on 2009-4-3):

oh my....
highest score!
oh and @ mjrb4
due to there being no highScore.java, i sort of can't understand how this works.

 

bourne writes (on 2009-10-8):

Doesn't show the high scores after entering name?

spaceblue writes (on 2009-10-8):

Hi, I'm getting a list of exceptions on this:
java.io.FileNotFoundException: http://greenfoot.org/greenroom/scoring/test/addscore.php?name=r&score=4729&scenario=highscore
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.URL.openStream(Unknown Source)
at HighScore.addScore(HighScore.java:83)
at HighScore.addScore(HighScore.java:107)
at NumWorld.addScore(NumWorld.java:51)
at StopButton.submit(StopButton.java:33)
at StopButton.act(StopButton.java:23)
at greenfoot.core.Simulation.runOneLoop(Simulation.java:200)
at greenfoot.core.Simulation.run(Simulation.java:129)
java.io.FileNotFoundException: http://greenfoot.org/greenroom/scoring/test/showscore.php?name=highscore
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.URL.openStream(Unknown Source)
at HighScore.getScores(HighScore.java:131)
at NumWorld.showScores(NumWorld.java:68)
at StopButton.submit(StopButton.java:34)
at StopButton.act(StopButton.java:23)
at greenfoot.core.Simulation.runOneLoop(Simulation.java:200)
at greenfoot.core.Simulation.run(Simulation.java:129)
java.lang.NullPointerException
at java.util.Collections.sort(Unknown Source)
at NumWorld.showScores(NumWorld.java:74)
at StopButton.submit(StopButton.java:34)
at StopButton.act(StopButton.java:23)
at greenfoot.core.Simulation.runOneLoop(Simulation.java:200)
at greenfoot.core.Simulation.run(Simulation.java:129)

They weren't here before... I think the highscores file was deleted from Greenfoot gallery.

Builderboy2005 writes (on 2009-10-8):

The highscores seem to be not working altogether. I get the same error on My Speed3D scenario.

mjrb4 writes (on 2009-10-19):

Sorry guys, yes it is a problem with the highscores but I'm afraid it'll have to stay this way for a while at least - I had a look at fixing it quickly but it seems it's not a quick job.

See all comments for this scenario.



If you want to leave a comment on this scenario, you must first log in.


The Greenfoot Network:  Greenfoot.org    Greenfoot Gallery   Greenfoot-Discuss

Our sponsors:

University of Kent Deakin University Sun Microsystems