On this page:
Organization of the library
World Game Libraries
Images and Tunes
Version: 5.2.1

Organization

Organization of the library

The library consists of two sets of modules (packages). The first set defines the environment for the game and asks the programmer to design the actions of the game (and its display). The second set provides the support for the graphics and sound components of the games.

World Game Libraries

This collection of five libraries (together with the world-images library and optionally the tunes library) allows a novice programmer to model the behavior of an interactive graphics-based game where the game behavior changes in reponse to the key presses, mouse clicks, and as time elapses (monitored by the ticking clock). The programmer also designs the view of the game at each clock tick, or as it changes in response to the key and mouse events.

More advanced programmers will enjoy augmenting their game with sound effects and musical themes.

There are five versions of the worlds to support a gradual increase in the program complexity:

Images and Tunes

The programmer first selects which style of the game she wants to design. The program then needs to import additional libraries from those listed below:

  • javalib.worldimages package allows the programmer to compose geometric shapes (circles, disks, rectangles, and more) with .png images to represent the game objects and the entire game scene. It also includes the class Posn that represents a point on the canvas.

  • javalib.colors package allows the novice programmer to define the six basic colors as (new Red(), new Green(), new Blue(), new White(), new Black(), or new Yellow(). The package should be imported with the javalib.worldimages.

  • javalib.worldcanvas package contains the classes that build the needed frame with a Canvas that displays the game. There are two versions of the canvas, one for Java applications (WorldCanvas) and one for Java Applets (AppletCanvas). The programmer does not need to know anything about the implementation, just include the package in the imports.

  • javalib.tunes package contains the classes that allow the programmer to compose MIDI tune sequence and play the melody using the default MIDI synthesizer. The package provides a class TuneBucket that is used by the sound versions of the worlds to keep track of currently playing MIDI notes for all instruments in the current synthesizer program.

}