From fe1c973edc1cab6d065938df9b46694ece19beff Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Fri, 7 Dec 2012 13:44:59 -0800 Subject: Bug fixes in mapspecs Fixed bug where leaderboard maps break after pressing test. Fixed bug where multipath's 2nd path didn't animate the first square. --- js/mapspecs.js | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) (limited to 'js') diff --git a/js/mapspecs.js b/js/mapspecs.js index 5a64d83..cf3de15 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -223,8 +223,7 @@ function clearwalls(mapid) { } } solution[mapid] = undefined; - //!! - //getmapdata(mapid); + getmapdata(mapid); } function resetwalls(mapid) { @@ -318,7 +317,8 @@ function animatePath(path, mapid, start, pathNumber) { } function animatePathDone(mapid) { - scoresRequestPage(mapid, currentPage[mapid]); + if (typeof(currentPage) == "object") + scoresRequestPage(mapid, currentPage[mapid]); document.getElementById(mapid+',btn').disabled = false; if (isChallenge == true) { challengeGo(mapid); @@ -335,7 +335,7 @@ function checkSound(mapid) { return true; } -var snake = new Array(); +//var snake = new Array(); function doanimate(x, y, p, c, mapid, pathNumber) { //x, y position @@ -348,10 +348,11 @@ function doanimate(x, y, p, c, mapid, pathNumber) { if (count[mapid] == undefined) { count[mapid] = 0; } - if (snake[mapid] == undefined) { - snake[mapid] = new Array(); - mapdata[mapid].pathColor[pathNumber] = '#ccc'; - } + //TODO: Delete + // if (snake[mapid] == undefined) { + // snake[mapid] = new Array(); + // mapdata[mapid].pathColor[pathNumber] = '#ccc'; + // } if (count[mapid] == 0) { if (t == 'a') { mapdata[mapid].pathColor[pathNumber] = '#F777FF'; @@ -392,28 +393,30 @@ function doanimate(x, y, p, c, mapid, pathNumber) { handle.classOrigName = origclass; - //Track move count + //Animate the first square in a path. + if (count[mapid] == 0 && !(c > 0)) { + count[mapid]--; + mapdata[mapid].moveCount[pathNumber]--; + c = t; + if (!(c > 0)) + c = '2'; + } + switch(c) { - case 'f': - case 'a': - if (count[mapid] !== 0) - break; - count[mapid]--; - mapdata[mapid].moveCount[pathNumber]--; - //The path is moving to a new position case '1': //1 - Up case '2': //2 - Right case '3': //3 - Down case '4': //4 - Left + //Track move count count[mapid]++; mapdata[mapid].moveCount[pathNumber]++; //Notify users on score levels; switch(count[mapid]) { - case mapjson[mapid].best: + //case mapjson[mapid].best: //flashelement(mapid+',dspCount', 4, "#FF0000"); - break; + //break; case 500: case 400: //case 350: @@ -433,15 +436,13 @@ function doanimate(x, y, p, c, mapid, pathNumber) { break; } - // - childdiv = document.getElementById('child_'+handle.id); if (childdiv.className.indexOf('grid_td_walls') < 0) { childdiv.setAttribute('class', 'grid_td_path'+pathNumber+'-'+c); handle.style.backgroundColor = mapdata[mapid].pathColor[pathNumber]; - string = "if (document.getElementById('"+'child_'+eid+"').className == 'grid_td_path"+pathNumber+'-'+c+"')"; + var string = "if (document.getElementById('"+'child_'+eid+"').className == 'grid_td_path"+pathNumber+'-'+c+"')"; string += "document.getElementById('"+'child_'+eid+"').removeAttribute('class');"; setTimeout(string, 855); @@ -455,17 +456,15 @@ function doanimate(x, y, p, c, mapid, pathNumber) { break; //Teleports - case 't': case 'u': case 'm': case 'g': case 'i': case 'k': - - //case 'q': //Teleport out; - //Checkpoints + case 't': case 'm': case 'g': case 'i': case 'k': + //Outs + case 'u': case 'n': case 'h': case 'j': case 'l': case 'r': // if (handle.pressed == true) // break; //case 'a': case 'b': case 'c': case 'd': case 'e': - //handle.setAttribute('class', 'grid_td_pressed'); //handle.classOrigName = 'grid_td_pressed'; //if (handle.pressed == true) { -- cgit v1.2.3