NAME

Invaders -- A Space Invaders Game

DESCRIPTION

  A small application to test out a Sprite class that I'm using 
  for another project.  The documentation applies to the Sprite
  class.  The NOTES below will address the game, as well as inline
  coments.

  (c) Clinton Pierce 2001

  Feel free to redistribute.  Enjoy!

EXAMPLE

      my $s=new Sprite();
      $s->name('spaceship', 'player1');
      $s->image($shipdata);
      $s->place(10,10);
      
      if ($s->collide()=~/asteroid/) {
          $s->image($blowup, 1);
          sleep(2);
          $s->delete();
      }
$Sprite::keycode
  These keypress codes work for Windows and Linux (XFree86).
  There''s problems, of course, with using these to control a 
  game.  See IMPROVEMENTS below.
new
  Create a new sprite.
names([spritenames...])
  Assigns a name to the sprite.  Calling with no arguments
  returns the names.  Calling with a list of strings assigns those
  names to the sprite.
image(imagedata, [changeflag])
  Create a sprite with an image.  If changeflag is true, then
  the existing sprite is overwritten with the new image.
delete
  Remove the sprite
draw( createPolygon_args... )
  Calls createPolygon to draw a new object here.
place( x, y )
  Place the image at the specified location.
collide
  Will return a string of comma-separated sprite names that the 
  current object is touching.  So if:
      
      $rocketship->collide()=~/asteroid/

  You''d want to blow up.  Note: You''re always in collision with
  yourself.

GAME

  Left/Right arrow moves the ship, Control key fires.  Alien
  bombs or aliens reaching the bottom of the screen will kill you.
  To reset, kill the app and start again.

IMPROVEMENTS

  All kinds of improvements can be made trivially
  (with 3 or fewer lines of code):

      * limited number of shots onscreen at once.
            (this cures one sure-fire winning strategy.)
      * make aliens shoot more when there are fewer 
        of them.
      * make aliens faster when there are fewer of
        them.
      * "mothership" hovering above for bonus points
      * animate the aliens.
      * missles should have some momentum after being 
        released.
            (this kills the other.)
      * missles should themselves blow up

  Some less trivially (still fewer than 20 lines):

      * independant movement of aliens left/right,
        up/down
      * "galaxian" style swooping aliens
      * multiple lives
      * etc...

  Control difficulties:

      * Pressing "fire" stops left/right movement.
        perhaps someone with a better understanding of
        X11/Tk key bindings can help with this.