123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- var passedLevels;
-
- var errorEmptyName;
-
- var kid, tractor;
-
- 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;
-
- var blockWidth, blockIndex;
- var floorBlocks, floorIndex, floorCount, floorClicked, curFloor;
- var move, moveCounter, moveEnd;
- var arrow;
- var arrowPlace;
-
- var blockSize, blockAngle, blockTraceColor;
- var fly, flyCounter, flyend;
- var trace;
- var numPlus, endIndex;
- var kid_walk, balloon, basket;
- var balloonPlace;
-
- 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;
-
- var username;
- var lang;
-
- var beepSound, okSound, errorSound;
- var okImg, errorImg;
- var timer, totalTime;
-
- var audioStatus = false;
- var firstTime = true;
- var debugMode = false;
-
- var defaultWidth = 900;
- var defaultHeight = 600;
-
- var game = new Phaser.Game(
- defaultWidth,
- defaultHeight,
- Phaser.CANVAS,
- 'fractions-game'
- );
- hip = "143.107.45.11";
- name = "";
- lang = "";
-
- levelPosition = 0;
- levelMove = false;
- levelDifficulty = 0;
- levelOperator= "";
- levelLabel= false;
- levelShape = "";
- levelType = "";
- levelMenu = true;
-
-
- game.state.add('language', langState);
- game.state.add('load', loadState);
- game.state.add('name', nameState);
- game.state.add('menu', menuState);
- game.state.add('map', mapState);
- game.state.add('menuCircleOne', menuCircleOne);
- game.state.add('gameCircleOne', gameCircleOne);
- game.state.add('endCircleOne', endCircleOne);
- game.state.add('menuSquareOne', menuSquareOne);
- game.state.add('gameSquareOne', gameSquareOne);
- game.state.add('endSquareOne', endSquareOne);
- game.state.add('menuSquareTwo', menuSquareTwo);
- game.state.add('gameSquareTwo', gameSquareTwo);
- game.state.add('endSquareTwo', endSquareTwo);
- var loadAssets = {
-
- levelSpriteList: null,
- levelShapeList: null,
- levelTypeList: null,
- preload: function(){
-
- var imgsrc = 'assets/img/';
-
- game.load.image('progressBar', imgsrc+'pgbar.png');
-
- 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');
-
- 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');
-
- this.levelSpriteList = [];
-
- var levelSpriteSource = [
- '1-left-subs.png',
- '2-left-subs.png',
- '3-left-subs.png',
- '4-left-subs.png',
- '5.png'
- ];
-
-
- if(debugMode){
- levelSpriteSource = [
- '1-left-subs.png',
- '2-left-subs.png',
- '3-left-subs.png',
- '4-left-subs.png',
- '5.png',
- '5.png',
- '5.png',
- '5.png',
- '5.png',
- '5.png',
- '5.png',
- '5.png',
- '5.png'
- ];
- }
-
- for(var i=0; i<levelSpriteSource.length; i++){
- this.levelSpriteList[i] = 'game'+i;
- game.load.image(this.levelSpriteList[i], imgsrc+'game/'+levelSpriteSource[i]);
- }
-
-
- this.levelShapeList = [
- 'Square',
- 'Square',
- 'Circle',
- 'Circle',
- 'Square',
- ];
-
-
- if(debugMode){
- this.levelShapeList = [
- 'Square',
- 'Square',
- 'Circle',
- 'Circle',
- 'Square',
- 'Square',
- 'Square',
- 'Square',
- 'Square',
- 'Square',
- 'Square',
- 'Square',
- 'Square'
- ];
- }
-
- this.levelTypeList = [
- 1,
- 2,
- 1,
- 2,
- 3
- ];
-
-
- if(debugMode){
- this.levelTypeList = [
- 1,
- 2,
- 1,
- 2,
- 3,
- 3,
- 3,
- 3,
- 3,
- 3,
- 3,
- 3,
- 3
- ];
- }
-
-
- game.load.image('back', imgsrc+'menu/back.png');
- game.load.image('home', imgsrc+'menu/home.png');
- game.load.image('info', imgsrc+'menu/info.png');
- game.load.image('world', imgsrc+'menu/language.png');
- game.load.image('list', imgsrc+'menu/menu.png');
- game.load.image('help', imgsrc+'menu/help.png');
- game.load.image('pgbar', imgsrc+'menu/progressBar.png');
- game.load.image('block', imgsrc+'menu/block.png');
- game.load.spritesheet('audio', imgsrc+'menu/audio_48x48.png',48,48,2);
-
- game.load.image('add', imgsrc+'operator/add.png');
- game.load.image('subtract', imgsrc+'operator/subtract.png');
- game.load.image('separator',imgsrc+'operator/separator.png');
- game.load.image('equal', imgsrc+'operator/equal.png');
-
-
- game.load.image('h_arrow', imgsrc+'help/arrow.png');
- game.load.image('h_double', imgsrc+'help/double.png');
- game.load.image('h_error', imgsrc+'help/error.png');
- game.load.image('h_ok', imgsrc+'help/ok.png');
- game.load.image('down', imgsrc+'help/down.png');
- game.load.image('pointer', imgsrc+'help/pointer.png');
-
-
- game.load.spritesheet('kid_run', imgsrc+'kid/run.png', 82, 178, 12);
- game.load.spritesheet('kid_walk', imgsrc+'kid/walk.png', 78, 175, 26);
- game.load.spritesheet('kid_lost', imgsrc+'kid/lost.png', 72, 170, 6);
- game.load.spritesheet('tractor', imgsrc+'tractor/frame.png', 201, 144, 10);
-
- game.load.image('tractor_green', imgsrc+'tractor/frame-0.png');
- game.load.image('tractor_red', imgsrc+'tractor/frame-5.png');
-
- game.load.image('balloon', imgsrc+'airballoon_upper.png');
- game.load.image('balloon_basket', imgsrc+'airballoon_base.png');
- game.load.image('birch', imgsrc+'birch.png');
- game.load.image('flag', imgsrc+'flag.png');
- game.load.image('house', imgsrc+'house.png');
- game.load.image('place_a', imgsrc+'place_a.png');
- game.load.image('place_b', imgsrc+'place_b.png');
- game.load.image('garage', imgsrc+'garage.png');
- game.load.image('farm', imgsrc+'farm.png');
- game.load.image('rock', imgsrc+'rock.png');
- game.load.image('school', imgsrc+'school.png');
- game.load.image('sign', imgsrc+'sign.png');
- game.load.image('tree1', imgsrc+'tree.png');
- game.load.image('tree2', imgsrc+'tree2.png');
- game.load.image('tree3', imgsrc+'tree3.png');
- game.load.image('tree4', imgsrc+'tree4.png');
-
-
- game.load.audio('sound_ok', ['assets/fx/ok.ogg', 'assets/fx/ok.mp3']);
- game.load.audio('sound_error', ['assets/fx/error.ogg', 'assets/fx/error.mp3']);
- game.load.audio('sound_beep', ['assets/fx/beep.ogg', 'assets/fx/beep.mp3']);
- },
- create: function(){
- game.physics.startSystem(Phaser.Physics.ARCADE);
- game.state.start('language');
-
- }
-
- };
-
- game.state.add('loadAssets', loadAssets);
- game.state.start('loadAssets');
|