/* let loadAssets = { preload: function(){}, create: function() ---------------------------- end of phaser functions }; */ // OUTRAS VARIAVEIS GLOBAIS let passedLevels; //premenu let errorEmptyName; //map let kid, tractor; //square 1 + circle 1 let startX; let clicked, hideLabels, checkCollide, result, hasFigure; let detail; let endPosition; let fractionClicked, fractionIndex; let blocks, maxBlocks, numBlocks, curBlock, blockDirection, blockDistance, blockLabel, blockSeparator; //blocks control //square 1 let blockWidth, blockIndex; let floorBlocks, floorIndex, floorCount, floorClicked, curFloor; let move, moveCounter, moveEnd; let arrow; let arrowPlace; //circle 1 let blockSize, blockAngle, blockTraceColor; let fly, flyCounter, flyend; //flyvariables let trace; //circle trace let numPlus, endIndex; let kid_walk, balloon, basket; let balloonPlace; //square 2 let sizeA, sizeB, valueA, valueB; let clickA, clickB, animateA, animateB, animate, cDelay, eDelay; let blocksA, blocksB, auxblqA, auxblqB; let labelA, fractionA, separatorA, labelB, fractionB, separatorB; let kidDirection, equals, counter, endCounter; let xA, yA, xB, yB, blockW, blockH; // INFO let username; //player name let lang; //language // IMAGES let beepSound, okSound, errorSound; //sounds let okImg, errorImg; let timer, totalTime; // variaveis globais let audioStatus = false; // turns game audio on/off let firstTime = true; //if player has just oppened the game let debugMode = true; //turns console messages for developers on/off (changeable only by code) // game dimentions const defaultWidth = 900; const defaultHeight = 600; // Initialize the game let game = new Phaser.Game( defaultWidth, defaultHeight, Phaser.CANVAS, 'fractions-game' ); const hip = "143.107.45.11"; //Host ip // Game One : kid and truck let levelPosition = 0; //Map position let levelMove = false; //Move to next position let levelDifficulty = 0; //From one to five let levelOperator = ""; //Plus; Minus; Mixed let levelLabel= false; //Show block label let levelShape = ""; //Circle; square let levelType = ""; // A - Place distance; B - Select blocks let levelMenu = true; //adding game states (scenes) game.state.add('language', langState); // preMenu.js game.state.add('load', loadState); // preMenu.js game.state.add('name', nameState); // preMenu.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 let loadAssets = { preload: function(){ //auxiliar directory const 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 = []; let 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.push( '5.png', '5.png', '5.png', '5.png', '5.png', '5.png', '5.png', '5.png' ); } for(let i=0; i