Browse Source

gui and debug changes: - level icons in the main menu and arrows in the difficulty menu were changed to make it more intuitive to the player - changes in the floor gui of the tractor levels - a variable called debugmode was created to activate/deactivate debug messages in the console

lairaalmas 5 years ago
parent
commit
5076b541ec

BIN
TEMPORARIOS/backup-versao-inicial.zip


BIN
assets/img/game/1-left-subs.png


BIN
assets/img/game/1-right-nosubs.png


BIN
assets/img/game/2-left-subs.png


BIN
assets/img/game/2-right-nosubs.png


BIN
assets/img/game/3-left-subs.png


BIN
assets/img/game/3-right-nosubs.png


BIN
assets/img/game/4-left-subs.png


BIN
assets/img/game/4-right-nosubs.png


BIN
assets/img/game/5.png


assets/img/game/five-s.png → assets/img/game/backup/five-s.png


assets/img/game/four-c.png → assets/img/game/backup/four-c.png


assets/img/game/four-s.png → assets/img/game/backup/four-s.png


assets/img/game/one-c.png → assets/img/game/backup/one-c.png


assets/img/game/one-s.png → assets/img/game/backup/one-s.png


assets/img/game/three-c.png → assets/img/game/backup/three-c.png


assets/img/game/three-s.png → assets/img/game/backup/three-s.png


assets/img/game/two-c.png → assets/img/game/backup/two-c.png


assets/img/game/two-s.png → assets/img/game/backup/two-s.png


BIN
assets/img/game/fases projeto 1.0.psd


BIN
assets/img/game/fases projeto 2.0.psd


BIN
assets/img/garage (copy).png


+ 13 - 9
js/boot.js

@@ -89,15 +89,15 @@
 	        game.load.image('road', imgsrc+'road.png');
 	        
 	        //game phases buttons list
-	        game.load.image('game1c', imgsrc+'game/one-c.png');
-	        game.load.image('game2c', imgsrc+'game/two-c.png');
-	        game.load.image('game3c', imgsrc+'game/three-c.png');
-	        game.load.image('game4c', imgsrc+'game/four-c.png');
-	        game.load.image('game1s', imgsrc+'game/one-s.png');
-	        game.load.image('game2s', imgsrc+'game/two-s.png');
-	        game.load.image('game3s', imgsrc+'game/three-s.png');
-	        game.load.image('game4s', imgsrc+'game/four-s.png');
-	        game.load.image('game5s', imgsrc+'game/five-s.png');
+	        game.load.image('game1s', imgsrc+'game/1-left-subs.png');
+	        game.load.image('game2s', imgsrc+'game/1-right-nosubs.png');
+	        game.load.image('game3s', imgsrc+'game/2-left-subs.png');
+	        game.load.image('game4s', imgsrc+'game/2-right-nosubs.png');
+	        game.load.image('game1c', imgsrc+'game/3-left-subs.png');
+	        game.load.image('game2c', imgsrc+'game/3-right-nosubs.png');
+	        game.load.image('game3c', imgsrc+'game/4-left-subs.png');
+	        game.load.image('game4c', imgsrc+'game/4-right-nosubs.png');
+	        game.load.image('game5s', imgsrc+'game/5.png');
 	        
 	        //header menu buttons
 	        game.load.image('back', imgsrc+'menu/back.png');
@@ -129,6 +129,10 @@
 	        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');

+ 22 - 9
js/circleOne.js

@@ -75,9 +75,14 @@ var menuCircleOne = {
             blueCircle.beginFill(0xefeff5);
             blueCircle.drawCircle(0, 0, 60);
             blueCircle.endFill();
-        var r_arrow = game.add.sprite(startSymbol, 195, 'h_arrow'); 
-            r_arrow.scale.setTo(0.7);
+        var r_arrow = game.add.sprite(startSymbol+40, 195, 'h_arrow'); 
+            r_arrow.scale.setTo(0.35);
             r_arrow.anchor.setTo(0.5,0.5);
+            r_arrow.alpha = 0.8;
+        var r_arrow2 = game.add.sprite(startSymbol, 195, 'kid_walk'); 
+            r_arrow2.scale.setTo(0.6);
+            r_arrow2.anchor.setTo(0.5,0.5);
+            r_arrow2.alpha = 0.8;
         
         stairsPlus = [];
         for(var i=1;i<=5;i++){
@@ -113,10 +118,17 @@ var menuCircleOne = {
             redCircle.beginFill(0xefeff5);
             redCircle.drawCircle(0, 0, 60);
             redCircle.endFill();
-        var l_arrow = game.add.sprite(startSymbol, 350, 'h_arrow');
-            l_arrow.scale.setTo(-0.7, 0.7);
+
+        var l_arrow2 = game.add.sprite(startSymbol, 350, 'h_arrow');
+            l_arrow2.scale.setTo(-0.35, 0.35);
+            l_arrow2.anchor.setTo(0.5,0.5);
+            l_arrow2.alpha = 0.8;
+        var l_arrow = game.add.sprite(startSymbol+40, 350, 'kid_walk');
+            l_arrow.scale.setTo(-0.6, 0.6);
             l_arrow.anchor.setTo(0.5,0.5);
-        
+            l_arrow.alpha = 0.8;
+
+
         var stairsMinus = [];
         for(var i=1;i<=5;i++){
             //stair
@@ -160,8 +172,9 @@ var menuCircleOne = {
             rCircle.endFill();
         
         var d_arrow = game.add.sprite(startSymbol, 500, 'h_double'); 
-            d_arrow.scale.setTo(0.7);
+            d_arrow.scale.setTo(0.5);
             d_arrow.anchor.setTo(0.5,0.5);
+            d_arrow.alpha = 0.8;
         
         var stairsMixed = [];
         for(var i=1;i<=5;i++){
@@ -900,16 +913,16 @@ var gameCircleOne = {
         hr.open("POST", url, true);
         hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
         hr.onreadystatechange = function() {
-            console.log(hr);
+            if(debugmode) console.log(hr);
 
             if(hr.readyState == 4 && hr.status == 200) {
                 var return_data = hr.responseText;
-                console.log(return_data);
+                if(debugmode) console.log(return_data);
             }
         }
         // Send the data to PHP now... and wait for response to update the status div
         hr.send(vars); // Actually execute the request
-        console.log("processing...");
+        if(debugmode) console.log("processing...");
 
     },
             

+ 2 - 2
js/preMenu.js

@@ -1,6 +1,6 @@
 
 var errorEmptyName;
-
+var debugmode = false;
 /*
     var langState = {
         create: function(){},
@@ -181,7 +181,7 @@ var nameState = {
         
         // saves the typed name on username variable
         username = document.getElementById("name_id").value;
-        console.log("user is" + username);        
+        if(debugmode) console.log("user is" + username);        
 
         document.getElementById("text-field-div").style.visibility = "hidden";
 

+ 60 - 28
js/squareOne.js

@@ -65,7 +65,7 @@ var menuSquareOne = {
         var stairHeight = 40; //height growth of a stair
         var stairWidth = 100; //Width of a stair
         var startStair = 320;
-        var startSymbol = 150;
+        var startSymbol = 180; 
         var startSquare = (startSymbol/2)+startStair+stairWidth*3;
         
          //First stairs, plus, 3 levels, blue square
@@ -75,11 +75,18 @@ var menuSquareOne = {
             blueSquare.beginFill(0xefeff5);
             blueSquare.drawRect(0, 0, 80, 40);
             blueSquare.endFill();
-        var bplus = game.add.sprite(startSymbol, 195, 'h_arrow');
-            bplus.frame = 0;
-            bplus.scale.setTo(0.7);
+        var bplus = game.add.sprite(startSymbol+30, 215, 'tractor_green');
+            //bplus.frame = 0;
+            bplus.scale.setTo(0.5);
+            bplus.alpha = 0.9;
             bplus.anchor.setTo(0.5,0.5);
         
+        var bplus2 = game.add.sprite(startSymbol+100, 215, 'h_arrow');
+            bplus2.scale.setTo(0.3);
+            bplus2.alpha = 0.9;
+            bplus2.anchor.setTo(0.5,0.5);
+        
+
         var stairsPlus = [];
         for(var i=1;i<=3;i++){
             //stair
@@ -114,12 +121,20 @@ var menuSquareOne = {
             redSquare.beginFill(0xefeff5);
             redSquare.drawRect(0, 0, 80, 40);
             redSquare.endFill();
-        var rminus = game.add.sprite(startSymbol, 350, 'h_arrow');
-            rminus.frame = 5;
-            rminus.scale.setTo(0.7);
-            rminus.scale.x *= -1;
+        var rminus = game.add.sprite(startSymbol+70, 370, 'tractor_red');
+            //rminus.frame = 5;
+            rminus.scale.setTo(0.5);
+            rminus.alpha = 0.9;
+            //rminus.scale.x *= -1;
             rminus.anchor.setTo(0.5,0.5);
         
+        var rminus2 = game.add.sprite(startSymbol, 370, 'h_arrow');
+            rminus2.scale.setTo(0.3);
+            rminus2.alpha = 0.9;
+            rminus2.scale.x *= -1;
+            rminus2.anchor.setTo(0.5,0.5);
+        
+
         var stairsMinus = [];
         for(var i=1;i<=3;i++){
             //stair
@@ -272,7 +287,7 @@ var mapSquareOne = {
         game.physics.arcade.enable(this.tractor);
         var walk = this.tractor.animations.add('walk',[0,1,2,3,4]);
         this.tractor.animations.play('walk', 5, true);
-        this.tractor.angle -= 10;
+        this.tractor.angle -= 25;
         
         // Delay to next level
         this.count = 0;
@@ -409,14 +424,17 @@ var gameSquareOne = {
             tractor.scale.x *= -1;
         }
         
-         //generator
+        //generator
         //Blocks and fractions
-        console.log("pos " +onePosition);
+        if(debugmode) console.log("pos " +onePosition);
+        
         maxBlocks = onePosition+4; //Maximum blocks
         if(oneType=='B' || oneOperator=='Mixed') maxBlocks = 10;
         blocks = game.add.group(); //Fraction arrays (apilled)
         numBlocks = game.rnd.integerInRange(onePosition+2, maxBlocks); //Number of blocks
-        console.log("num " + numBlocks+", min " + (onePosition+2) + ", max " + maxBlocks);
+        
+        if(debugmode) console.log("num " + numBlocks+", min " + (onePosition+2) + ", max " + maxBlocks);
+        
         curBlock = 0; //Actual index block
         blockDirection = []; //Directions right(plus), left (minus)
         blockDistance = []; //Displacement distance of the blocks
@@ -427,12 +445,14 @@ var gameSquareOne = {
         endPosition = startX; //Ending position, accumulative
         if(oneOperator=='Minus') endPosition -= blockWidth;
         else endPosition += blockWidth;
+        
         //Game A exclusive variables 
         floorBlocks = game.add.group(); //Selectable floor blocks
         floorIndex = -1; //Selected floor block
         floorCount = 8; //Number of floor blocks
         floorClicked = false; //If clicked portion of floor
         curFloor = -1;
+        
         //Game B exclusive variables
         arrowPlace = startX; //Fixed place for help arrow
         if(oneOperator=='Minus') arrowPlace  -= blockWidth;
@@ -441,6 +461,7 @@ var gameSquareOne = {
         fractionIndex = -1; //Index of clicked fraction (game B)
         
         hasFigure = false;
+
         for(var p=0;p<numBlocks;p++){
 
             var portion = game.rnd.integerInRange(1, oneDifficulty); //Portion of the square, according to difficulty
@@ -453,18 +474,20 @@ var gameSquareOne = {
             
             if(oneOperator=='Plus'){
                 direction = 'Right';    
-                lineColor = 0x31314e;
+                lineColor = 0x31314e; //plus block: "black'
             }else if(oneOperator=='Minus'){
                 direction = 'Left';
-                lineColor = 0xb30000;
+                lineColor = 0xb30000;//minus block : "red"
             }
             
+            //blocks close to tractor
             var block = game.add.graphics(startX, 460-p*blockHeight);
                 block.anchor.setTo(0.5, 0.5);
                 block.lineStyle(2, lineColor);
                 block.beginFill(0xefeff5);
-            
+
             blockDirection[p] = direction;
+            
             if(portion==1){
                 block.drawRect(0, 0, blockWidth, blockHeight);
                 
@@ -481,6 +504,7 @@ var gameSquareOne = {
                 }
             }else{
                 if(portion==3) portion = 4;
+                
                 var distance = blockWidth/portion;
                 
                 block.drawRect(0, 0, distance, blockHeight);
@@ -554,12 +578,13 @@ var gameSquareOne = {
         floorCount = 8*oneDifficulty;
         
         var widFloor = blockWidth/oneDifficulty;
+
         if(oneDifficulty==3){
             floorCount = 8*4;
             widFloor = blockWidth/4;
         }
         
-        for(var i = 0; i<floorCount; i++){
+        for(var i = 0; i < floorCount; i++){
             var posX = startX;
             
             if(oneOperator=='Minus') posX -= (blockWidth + i*widFloor);
@@ -580,10 +605,12 @@ var gameSquareOne = {
                     }
                 }
             }
+
+            // blocks on the floor
             var block = game.add.graphics(posX, 500);
                 block.anchor.setTo(0.5, 0);
-                block.lineStyle(0.2, 0xffffff);
-                block.beginFill(0x000000);
+                block.lineStyle(0.9, 0xffffff);
+                block.beginFill(0xa8c0e6);
                 block.drawRect(0, 0, widFloor, blockHeight);
                 block.endFill();
             if(oneOperator=='Minus') block.scale.x *= -1;
@@ -771,6 +798,7 @@ var gameSquareOne = {
     overSquare: function(){
 
         if(!clicked){
+            //on level type A
             if(oneType=="A"){
                 for(var i=0;i<floorCount;i++){
                     if(i<=this.indice){
@@ -780,13 +808,13 @@ var gameSquareOne = {
                     }
                 }
                 floorIndex = this.indice;
+            //on level type B
             }else if(oneType=="B"){
-                
                 for(var i=0;i<numBlocks;i++){
                     if(i<=this.indice){
-                        blocks.children[i].alpha = 1;
-                    }else{
                         blocks.children[i].alpha = 0.5;
+                    }else{
+                        blocks.children[i].alpha = 0.2;
                     }
                 }
                 blockIndex = this.indice;
@@ -798,13 +826,15 @@ var gameSquareOne = {
     outSquare: function(){
 
         if(!clicked){
+            //on level type A
             if(oneType=="A"){
                 for(var i=0;i<floorCount;i++){
                     floorBlocks.children[i].alpha = 0.5;
                 }
                 floorIndex = -1;
+            //on level type B
             }else if(oneType=="B"){
-                for(var i=0;i<=this.indice;i++){
+                for(var i=0;i<numBlocks;i++){
                     blocks.children[i].alpha = 0.5;
                 }
                 blockIndex = -1;
@@ -817,6 +847,7 @@ var gameSquareOne = {
 
         if(!clicked && !move){
             
+            //on level type A
             if(oneType=='A'){
     
                 arrow.alpha = 1;
@@ -848,6 +879,8 @@ var gameSquareOne = {
                 }
                     
                 blockIndex = numBlocks - 1;
+
+            //on level type B
             }else if(oneType=='B'){ //Delete unselected blocks
 
                 var minusBlocks = 0;
@@ -861,7 +894,7 @@ var gameSquareOne = {
                 }
                 numBlocks -= minusBlocks; //Final reduced blocks
                 
-                arrow.alpha = 1;
+                arrow.alpha = 0;
                 clicked = true;
                 animate = true;
                 if(audioStatus){
@@ -881,7 +914,7 @@ var gameSquareOne = {
     postScore: function (){
 
         var lang_str = "pt_BR"; //TODO NAO esta pegando a lingua definida pelo usuario!
-	var aux;
+        var aux;
         // Get correct information about username and default language
 	// Variables 'username' and 'lang' is define on: js/menu.js
 	// Variable 'lang' has all the JSON content of 'assets/languages/pt_BR.json', 'lang.lang' defined in 'js/preMenu.js' (setLang())
@@ -927,15 +960,15 @@ var gameSquareOne = {
         hr.open("POST", url, true);
         hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
         hr.onreadystatechange = function() {
-            console.log(hr);
+            if(debugmode) console.log(hr);
             if(hr.readyState == 4 && hr.status == 200) {
                 var return_data = hr.responseText;
-                console.log(return_data);
+                if(debugmode) console.log(return_data);
             }
         }
         // Send the data to PHP now... and wait for response to update the status div
         hr.send(vars); // Actually execute the request
-        console.log("processing...");
+        if(debugmode) console.log("processing...");
 
     },       
         
@@ -1028,7 +1061,6 @@ var endSquareOne = {
     },
     
     verMenu: function(){
-
         if(oneMenu){
             game.state.start('menu');
         }

+ 8 - 8
js/squareTwo.js

@@ -415,19 +415,19 @@ var gameSquareTwo = {
         animate = null; //Final animation sequence
         
         //generator
-        console.log("----------");
-        console.log("Diff " + twoDifficulty + ", ini " + ((twoDifficulty-1)*2+1) + ", end " + ((twoDifficulty-1)*2+3));
+        if(debugmode) console.log("----------");
+        if(debugmode) console.log("Diff " + twoDifficulty + ", ini " + ((twoDifficulty-1)*2+1) + ", end " + ((twoDifficulty-1)*2+3));
         
         var rPoint = game.rnd.integerInRange((twoDifficulty-1)*2+1,(twoDifficulty-1)*2+3);
         sizeA = points[rPoint];
         
-        console.log("Rpoint " + rPoint + ", val " + sizeA);
+        if(debugmode) console.log("Rpoint " + rPoint + ", val " + sizeA);
         
         sizeB =  this.getRndDivisor(sizeA);
         blockB = game.rnd.integerInRange(1, sizeB);
         blockA = (sizeA/sizeB) * blockB;
         
-        console.log("SA " + sizeA + ", SB " + sizeB + ", BA " + blockA + ", BB " + blockB );
+        if(debugmode) console.log("SA " + sizeA + ", SB " + sizeB + ", BA " + blockA + ", BB " + blockB );
         
         //Blocks and fractions group
         blocksA = game.add.group(); //Main blocks A
@@ -453,7 +453,7 @@ var gameSquareTwo = {
         var fillColorS = 0xe0ebeb;
         
         for(var i=0; i<sizeA; i++){
-            //console.log("Block A"+i+": x:"+(xA+i*widthA)+", y:"+yA);
+            //if(debugmode) console.log("Block A"+i+": x:"+(xA+i*widthA)+", y:"+yA);
                         
             var block = game.add.graphics(xA+i*widthA, yA);
                 block.anchor.setTo(0.5, 0.5);
@@ -812,16 +812,16 @@ var gameSquareTwo = {
         hr.open("POST", url, true);
         hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
         hr.onreadystatechange = function() {
-            console.log(hr);
+            if(debugmode) console.log(hr);
 
             if(hr.readyState == 4 && hr.status == 200) {
                 var return_data = hr.responseText;
-                console.log(return_data);
+                if(debugmode) console.log(return_data);
             }
         }
         // Send the data to PHP now... and wait for response to update the status div
         hr.send(vars); // Actually execute the request
-        console.log("processing...");
+        if(debugmode) console.log("processing...");
 
     },