/* * @projectDescription NuPogodi HTML5 Game * * @version 0.0.1 * @author Paweł Winiecki * @copyright 2014 NerdLab.pl * @license MIT License * */ var NuPogodi = NuPogodi || {}; (function() { "use strict"; NuPogodi.generateQuickGuid = function() { return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); } NuPogodi.getCallerId = function() { var id = localStorage.getItem('caller_id'); if (id == null) { id = NuPogodi.generateQuickGuid(); localStorage.setItem('caller_id', id); } return id; } NuPogodi.flushCallerId = function () { localStorage.removeItem('caller_id'); } window.createGame = function(city) { NuPogodi.flushCallerId(); // Creating Phaser Game object NuPogodi.game = new Phaser.Game(1350, 808, Phaser.AUTO, 'board', null, true, true); if (typeof city == 'undefined') { city = 'gdansk'; } NuPogodi.city = city // Gdańsk Gdynia Poznan // Adding States to Game NuPogodi.game.state.add('Boot', NuPogodi.BootState); NuPogodi.game.state.add('Preload', NuPogodi.PreloadState); NuPogodi.game.state.add('Menu', NuPogodi.MenuState); NuPogodi.game.state.add('Game', NuPogodi.GameState); // Starting whole game with Boot State NuPogodi.game.state.start('Boot'); //document.querySelectorAll('#board')[0].className = NuPogodi.city; }; })();