Test Arena Developer's Guide

The following section is arranged as follows.

GLOBAL object (global.js)

The global.js file provides a number of useful functionalities for error logging and some convenience methods for performing tasks such as appending information to div elements.

One that may be the most immedietely useful when writing and debugging your game is the eventLog's logMessage function.

		var type = "status"|"warning"|"error"|other
		var message = "An error occured"
		GLOBAL.eventLog.logMessage(type, message)

This function will...

  1. Apply a color to the message based on the type. Green for status, orange for warning, red for error, and the inherited color for any other value.

  2. Flash your message at the top of the page for 3 seconds or until a new message is logged.

  3. Add that message to the page's event log.

Several other functions are available in the GLOBAL object defined in this file. Open the file to discover them.

Drawable Objects (drawable.js)

The drawable.js file defines several convenience objects that implement the constructor pattern.

The constructor for each type takes a single options object as an argument. The options available to each type are specified below.

All of the below types have their own overridden version of the draw() method. This makes it very convenient to simply store all your drawable objects in a structure, then have your GAME.drawBoard() method loop through that structure and call draw() on each of them.

See https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial for more information and clarifications on the options below.

Required options are indicated with a *

TEST_ARENA Object (testArena.js)

The testArena.js file defines and maintains a global TEST_ARENA object. The following attributes of this object may be useful for game developers.

Test Arena Page States

The Test Arena never reloads the page; instead, based on the results of various AJAX requests, and user interaction with the GUI, the testArena.js file handles the transitions between the following states.