Table of ContentsThe MenuThe Game Loop

The Game Screen

The GameScreen class represents the core of your game. This includes object movement, graphics rendering, and reading and reacting to input.

Because you have to start somewhere, begin with the graphics. To implement this for RoadRun, you need to derive a class from the MIDP LCDUI's low-level Canvas to represent your game's screen. Take a look at the starting code for the GameScreen class:

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;

public class GameScreen extends Canvas
{
   private RoadRun theMidlet;

   public GameScreen(RoadRun midlet)
   {
       theMidlet = midlet;
   } 
   protected void paint(Graphics graphics)
   {
   }
}

Again, this is skeleton stuff. You need to do quite a bit more to make things happen. Before you can really add any action in here, you need something more fundamental. You need to pull out the defibrillators, yell "Clear!," and start your game's heart.

    Table of ContentsThe MenuThe Game Loop