Create Account - Login

Home - Scenarios - Tags - About


By dbal - uploaded on 2008-7-22      367 views (26 in the last 7 days)      2 votes (0 in the last 7 days)

Tags: GUI With source demo game

PROJECT: MathGame01

I am publishing this scenario in support of an article that I plan to publish on the topic of custom GUIs using
Greenfoot. If and when the article is published, you will find a link to the article at

This is a relatively simple educational game for children that illustrates the use of custom labels, custom menus,
text input, simple animation, sound effects, and a few other strengths of Greenfoot as a Java development platform.

The default screen consists of a title and instructions for starting the game.

When the user clicks Run, the game board appears consisting of the same title, two menu headers, and a simple math
problem. The two menu headers are:

Skill Level

The Game menu provides the following options:


The Skill Level menu provides the following options:

First Grade
Second Grade
Third Grade

Disclaimer: Because I have no expertise in elementary education, those skill levels are approximations at best.

The bottom portion of the screen contains a simple math problem with instructions for the student to type the answer
and press Enter.

If the student enters the correct answer, a "ding" sounds, a large happy face dances across the screen, and words of
encouragement are presented in green followed by a new problem to be solved.

If the student enters an incorrect answer, a somewhat negative sound effect is played and a large face with a frown
dances across the screen. The correct solution is presented in red followed by a new problem to be solved.

VERSION or DATE: 07/22/08
HOW TO START THIS PROJECT: Click the Run button.

AUTHOR: Dick Baldwin

USER INSTRUCTIONS: Click the Run button. Then select the game and the skill level from the respective menus, type
the solution to the math problem and press Enter.

Visit the web page for this scenario.
Download the source for this scenario.

Your browser is ignoring the <APPLET> tag.

Some people who like this scenario: mik mjrb4

Report this scenario as broken or inappropriate.

mjrb4 writes (on 2008-7-22):

Nice! Looks like a really good start to something here, and the menus work really well.

Couple of improvement suggestions if you're interested - how about a timer? You could turn it into an actual game where you have to answer as many questions as you can in the specified time, then get a score at the end of it all.

Also, I hit enter by accident a couple of times and it said 0 wasn't the correct answer - fair enough, it wasn't, but it'd be nice to have something that said you can't give an answer before you've typed any number? It'd also be good to stop anyone typing letters at all :)

Then there's the obvious things about other problems. Addition and multiplication - the next logical step sounds like implicit differentiation to me! Oh ok. Perhaps there's subtraction first.

Good start though :)

dbal writes (on 2008-7-22):

Thanks for the comments. I'll consider an upgrade containing your suggestions. Maybe a numeric text box that ignores all keystrokes other than numeric keystrokes followed by the Enter key.

Dick Baldwin

mjrb4 writes (on 2008-7-22):

No problem :) The numeric box sounds like a good idea. Another thing in general for the text box, I think it'd be good to just allow characters - i.e. things like the arrow keys and function keys could get filtered out.

A new version of this scenario was uploaded on Wed Jul 23 15:55:36 UTC 2008

marla writes (on 2008-7-24):

Thank you very much for including the source - don't you want to tag it with the with-source tag?

dbal writes (on 2008-7-24):

Done. Thanks,
Dick Baldwin

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