Prechádzať zdrojové kódy

fix missing textures and total Timer bugs

Bernardo Martins 5 rokov pred
rodič
commit
447a077dff
2 zmenil súbory, kde vykonal 5 pridanie a 6 odobranie
  1. 4 2
      js/iHanoiFunctions.js
  2. 1 4
      js/start.js

+ 4 - 2
js/iHanoiFunctions.js

@@ -4,7 +4,8 @@ function inicio (QntityDisks){
 	var x = 0;
 	var y = 549.5;
 	var w = 330;
-	startOfMove=Date.now();
+	start = Date.now();
+	startOfMove = Date.now();
 	for (var i = 0; i < QntityDisks; i++) {
 		var disk = new Disk(x,y,w,40,pat[i+1]);
 		towerA.push(disk);
@@ -39,7 +40,8 @@ function reset (QntityDisks){
 	towerB.splice(0,towerB.length);
 	towerC.splice(0,towerC.length);
 	moves.splice(0,moves.length);
-	nMovements=0;
+	nMovements = 0;
+	nTotalMovements = 0;
 	idF = " ";
 	idT=" ";
 	toMove=null;

+ 1 - 4
js/start.js

@@ -6,6 +6,7 @@ var idF=" ", idT= " ";
 var nMovements = 0, nTotalMovements = 0, nWrongMoves = 0, nDisks = 2;
 var moves = [], totalMoves = []; //vector to save movements
 var acertou=0;
+var start;
 var optimalSolution;
 		 	//NavyBlue  Lime     Fuchsia   yellow   Orange   LightSteelBlue  red
 var colors = ["#000080","#00FF00", "#FF00FF", "yellow", "#FFA500", "#B0C4DE","red"];
@@ -31,13 +32,9 @@ function loadIMGS(n){
   });
   Promise.all(allImgs).then(function(imgs){
     for (var i = imgs.length - 1; i >= 0; i--) {
-      if (imgs[i].complete){
-        console.log(imgs[i]);
-      }
       pat[i] = context.createPattern(imgs[i], "repeat");
     }
   }).then(function(){
-      console.log(pat);
 			inicio(n);
 		});
 }