This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

dbal presents ...



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.

10418 views / 1234 in the last 7 days

4 votes | 0 in the last 7 days

Tags: game demo with-source gui

This scenario is a member of: Math Scenarios

open in greenfoot
Your browser does not support the canvas tag.


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 :)


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


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


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


Done. Thanks, Dick Baldwin

Want to leave a comment? You must first log in.

Who likes this?

Rudi Endy24 mik mjrb4