public void run()
  {
        requestFocus();
        // create offscreen buffer
    fOffscreenImage=createImage(size().width, size().height);
    fOffscreenGraphics=fOffscreenImage.getGraphics();

    while(true)
    {
          // rotate left
      if (fKeyLeft)
      {
        if ((fPlayerArc-=ANGLE10)<ANGLE0)
          fPlayerArc+=ANGLE360;
      }
          // rotate right
      else if (fKeyRight)
      {
        if ((fPlayerArc+=ANGLE10)>=ANGLE360)
          fPlayerArc-=ANGLE360;
      }

          //  _____     _
          // |\ arc     |
          // |  \       y
          // |    \     |
      //            -
          // |--x--|  
          //
          //  sin(arc)=y/diagonal
          //  cos(arc)=x/diagonal   where diagonal=speed
      float playerXDir=fCosTable[fPlayerArc];
      float playerYDir=fSinTable[fPlayerArc];

          // move forward
      if (fKeyUp)
      {
        fPlayerX+=(int)(playerXDir*fPlayerSpeed);
        fPlayerY+=(int)(playerYDir*fPlayerSpeed);
      }
          // move backward
      else if (fKeyDown)
      {
        fPlayerX-=(int)(playerXDir*fPlayerSpeed);
        fPlayerY-=(int)(playerYDir*fPlayerSpeed);
      }

      render();
      try
      {
        Thread.sleep(50);
      }
      catch (Exception sleepProblem)
      {
        showStatus("Sleep problem");
      }
    }
  }