/**
 * game.js
 *
 * This module houses the high-level instantiation and event binding for the
 * entire game. If interfaces need to be exposes to the global scope or parent
 * namespace, it should be done so in this module.
 */

define('game',

['Canvas', 'Player', 'vent'],

function( Canvas, Player, vent ){

    'use strict';

    var canvas,
        player,
        game;

    // Create the canvas stage that we'll be using for primary game entities
    canvas = new Canvas();

    // Create the player entity
    player = new Player(canvas);

    // Create an object we can expose as an interface for debugging
    // (modules shouldn't be touch this object)
    game = {
        canvas: canvas,
        player: player,
        vent: vent
    };

    document.addEventListener('keydown', function( ev ){
        vent.emit('keydown', ev);
    });
    document.addEventListener('keyup', function( ev ){
        vent.emit('keyup', ev);
    });

    // Couple DOM events to our custom event emitter
    document.addEventListener('DOMContentLoaded', function(){
        vent.emit('create', game);
        vent.emit('start', game);
    });

    vent.on('game-over', function( submsg ){
        vent.emit('message', 'Game Over', submsg);
    });

    // Expose the interface
    window.game = game;

    return game;

});

@@ -1201,38 +1201,293 @@
 mit(
-'message', 'Game Over', submsg
+%0A            'message',%0A            'Game Over',%0A            submsg + '%3Cbr/%3E%3Cbr/%3E Press %5C'R%5C' to try again.'%0A        );%0A        vent.on('keydown', function( ev )%7B%0A            if ( ev.keyCode === 82 )%7B%0A                window.location.href = window.location.href;%0A            %7D%0A        %7D
 );%0A 

add restart option on game over event