On this page:
Sample Games
Functional World
Mutable World
Mutable World with Sound
Sound World Applets
Images Samples
Version: 5.2.1

Samples

Sample Games

Here are samples of actual working games for each of the five libraries. The BlobWorld series are designed to illustrate all features for the specific library - how to make images, handle ticks, key events, and mouse events, as well as end the game either after a tick, or in response to the key event.

All of them use .png images that can be downloaded here:

Images.zip

The OceanWorld example shows a typical game students can implement early on.

The TickyTack series of samples ends with an illustration of how to play a background melody using a circular iterator.

Functional World

BlobWorldFun.java

This sample shows how to handle the clock tick events, key events, mouse clicks, how to end the game in response to a key event, or after a clock tick.

It provides examples of the basic images as well as the display of a final text when the game ends.

Most importantly, the class BlobExamples shows how every part of the game program (except the graphical display) can be tested without running the game.

TickyTackFun.java

This sample shows how to compose and reuse images, and again illustrates the design of game ending in two different ways.

Mutable World

BlobWorldImp.java

This sample shows how the game written in the functional style converts to the imperative (mutable) style.

The really interesting part is the illustration of how the tests for the game’s methods change in the presence of muation.

OceanWorldImp.java

A complete game with a shark eating incomming school of fish with images.

TickyTackImp.java

This is another example of converting a game from the functional style to the imperative style.

Mutable World with Sound

DrawFaceSound.java

This sample shows how to add simple sound effects to the game.

The really interesting part is how to handle the tunes of different duration.

TickyTackSong.java

This shows how using the music can illustrate the use of a circular iterator.

Sound World Applets

The DrawFaceSoundApplet.html illustrates how to play notes of longer duration, how to end the game either on tick, or on key event.

Note, thet even though the game canvas size is only 100 by 100, we must make the space for the frame bigger — at least 200 pixels wide and 230 pixels high - to leave the space for the controls.

The TickyTackSongApplet.html plays the familar tune with the familiar scene...

The TunesDemoApplet.html illustrates how the javalib.tunes library can be used for a variety of musical explorations and demonstrations.

We do not provide the sources for this example, as we feel all of it, or some of its parts, would make a great project for students.

_________________________________________________________________________________

Images Samples

ExamplesImageDrawings.java

This example (with the output shown in the Images section) tests (and illustrates) the drawing of all images and the composition of images.

ExamplesImageMethods.java

This is a comprehensive test of all methods defined in the classes that comprise the javalib.worldimages package, except those for the TextImage class.

ExamplesTextImages.java

A test suite (and illustration of the use) of the TextImage class.