termlib.js home | multiple terminals | parser | faq | documentation | samples
Invaders Sample
 
> open terminal  

> play invaders 

 
 
(c) mass:werk,
N. Landsteiner 2005-2008
http://www.masswerk.at

Termlib - Invaders
 

A simple text-mode invaders game.

Requires version 1.4 of "termlib.js".

Usage:

    TermlibInvaders.start(TerminalRef [, maxCols [, maxRows]])

returns status (boolean, true: success).

The optional arguments maxCols and maxRows specify the maximum dimensions to use for the game. If the terminal window is bigger, the game will be centered in the window and a frame will be drawn around.

The code is contained in a single global object and supports configurable colors using the web-colors API.

Usage example:

if ( TermlibInvaders.start(this) ) {
    return;
}
else {
    // oops, terminal doesn't meet the requirements
    this.write('Sorry, invaders failed.');
}