// OUTRAS VARIAVEIS GLOBAIS var passedLevels; //premenu var errorEmptyName; //map var kid, tractor; //square 1 + circle 1 var startX; var clicked, hideLabels, animate, checkCollide, result, hasFigure; var detail; var endPosition; var fractionClicked, fractionIndex; var blocks, maxBlocks, numBlocks, curBlock, blockDirection, blockDistance, blockLabel, blockSeparator; //blocks control //square 1 var blockWidth, blockIndex; var floorBlocks, floorIndex, floorCount, floorClicked, curFloor; var move, moveCounter, moveEnd; var arrow; var arrowPlace; //circle 1 var blockSize, blockAngle, blockTraceColor; var fly, flyCounter, flyend; //flyvariables var trace; //circle trace var numPlus, endIndex; var kid_walk, balloon, basket; var balloonPlace; //square 2 var sizeA, sizeB, valueA, valueB; var clickA, clickB, animateA, animateB, result, animate, cDelay, eDelay; var blocksA, blocksB, auxblqA, auxblqB; var labelA, fractionA, separatorA, labelB, fractionB, separatorB; var kidDirection, equals, counter, endCounter; var xA, yA, xB, yB, blockW, blockH; // INFO var username; //player name var lang; //language // IMAGES var beepSound, okSound, errorSound; //sounds var okImg, errorImg; var timer, totalTime; // variaveis globais var audioStatus = false; // turns game audio on/off var firstTime = true; //if player has just oppened the game var debugMode = false; //turns console messages for developers on/off (changeable only by code) // game dimentions var defaultWidth = 900; var defaultHeight = 600; // Initialize the game var game = new Phaser.Game( defaultWidth, defaultHeight, Phaser.CANVAS, 'fractions-game' ); hip = "143.107.45.11"; //Host ip name = ""; //player name lang = ""; //language // Game One : kid and truck levelPosition = 0; //Map position levelMove = false; //Move to next position levelDifficulty = 0; //From one to five levelOperator= ""; //Plus; Minus; Mixed levelLabel= false; //Show block label levelShape = ""; //Circle; square levelType = ""; // A - Place distance; B - Select blocks levelMenu = true; //adding game states (scenes) game.state.add('language', langState); // boot.js game.state.add('load', loadState); // boot.js game.state.add('name', nameState); // boot.js game.state.add('menu', menuState); // menu.js game.state.add('map', mapState); // map.js game.state.add('menuCircleOne', menuCircleOne); // circleOne.js game.state.add('gameCircleOne', gameCircleOne); // circleOne.js game.state.add('endCircleOne', endCircleOne); // circleOne.js game.state.add('menuSquareOne', menuSquareOne); // squareOne.js game.state.add('gameSquareOne', gameSquareOne); // squareOne.js game.state.add('endSquareOne', endSquareOne); // squareOne.js game.state.add('menuSquareTwo', menuSquareTwo); // squareTwo.js game.state.add('gameSquareTwo', gameSquareTwo); // squareTwo.js game.state.add('endSquareTwo', endSquareTwo); // squareTwo.js var loadAssets = { levelSpriteList: null, levelShapeList: null, levelTypeList: null, preload: function(){ //auxiliar directory var imgsrc = 'assets/img/'; //Progress bar image game.load.image('progressBar', imgsrc+'pgbar.png'); //flags game.load.image('flag_BR', imgsrc+'flag/BRAZ.jpg'); game.load.image('flag_PE', imgsrc+'flag/PERU.jpg'); game.load.image('flag_US', imgsrc+'flag/UNST.jpg'); game.load.image('flag_FR', imgsrc+'flag/FRAN.jpg'); game.load.image('flag_IT', imgsrc+'flag/ITAL.png'); //scenario game.load.image('bgimage', imgsrc+'bg.jpg'); game.load.image('bgmap', imgsrc+'bg_map.png'); game.load.image('cloud', imgsrc+'cloud.png'); game.load.image('floor', imgsrc+'floor.png'); game.load.image('road', imgsrc+'road.png'); //game phases buttons list this.levelSpriteList = []; var levelSpriteSource = [ '1-left-subs.png', //square I '2-left-subs.png', //square II '3-left-subs.png', //circle I '4-left-subs.png', //circle II '5.png' //square III ]; if(debugMode){ levelSpriteSource = [ '1-left-subs.png', //square I '2-left-subs.png', //square II '3-left-subs.png', //circle I '4-left-subs.png', //circle II '5.png', //square III '5.png', '5.png', '5.png', '5.png', '5.png', '5.png', '5.png', '5.png' ]; } for(var i=0; i