Tutorial

How Tapegro works

When TAPEGRO.EXE starts, it looks for two files in the current directory: config.cfg and main.js.
The former will contain a number of settings, which include how many frames per second will the game run at, graphics mode, controls, and whether to enable the developer console, plus any Allegro-specific settings.
The latter will be executed as soon as Allegro is initialised, and must include at least one global "Loop" function which will be called every frame. Both drawing and logic is done on this function.
The default files included together with Tapegro will be fine for starting your first game.

Now, some Tapegro-specific features will be discussed.

Handling input

There are 4 "virtual" gamepad states. Each includes directional controls and 12 buttons, much alike the SNES controller. The directional input, however, may be either analog (mouse or analog sticks) or digital (D-pads or keyboard).
There are two arrays, dpad and button. Each element of this array is one controller.
dpad elements have x and y floating point properties, while button is an integer bitfield.

The garbage collector

The garbage collector is voluntary, so you should remember to call it eventually.
Duktape.gc();

The developer console

Enable it on the config file.
You can type anything there and it will be executed just as if it was in main.js.
Input is treated specially if the first character is a colon. If followed by a number, it offers a multiline editor, like that in the C64. It also accepts commands "print" and "run".
: 10 for(var i = 0; i < entities.length; i++){
: 20 Cout(entities[i].name);
: 30 }
: 15 if(!entities[i].alive) break;
: run