diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2011-09-15 00:41:14 -0700 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2011-09-15 00:41:14 -0700 |
commit | cc2e1384904ff984208cf0236a9a5c6e957ba899 (patch) | |
tree | 78f06be19662c55bebe4aa6da1264b6efaa567d9 /js | |
parent | 5332f68b60f6c37850468ab3922936d0a12d9daf (diff) | |
download | pathery-cc2e1384904ff984208cf0236a9a5c6e957ba899.tar.xz |
Tutorial work
Diffstat (limited to 'js')
-rw-r--r-- | js/mapspecs.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/js/mapspecs.js b/js/mapspecs.js index 17e4a74..2494800 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -8,11 +8,13 @@ window.onload = function(){ //document.getElementById('blocksdisplay').innerHTML = "<b>"+blocks+"</b>";
//doSend();
loadSol();
- if (ischallenge == true) {
- challengehint();
+ if (isChallenge == true) {
+ challengeLoad();
}
}
+var isChallenge = false;
+
var solution = new Array();
var blocks = new Array();
var count = new Array();
@@ -55,13 +57,16 @@ function grid_click(obj) { mapid = tmp[0] - 0;
y = tmp[1];
x = tmp[2];
-
+
+ //The users solution - prepare it if it's not started
if (solution[mapid] == undefined) {
getmapdata(mapid);
}
//alert(obj.cv);
+ //Is this placing a wall, or removing one?
if (obj.cv) {
+ //Removing a wall
obj.cv = false;
//obj.style.backgroundColor = '#ffffff';
@@ -74,6 +79,7 @@ function grid_click(obj) { solution[mapid] = solution[mapid].replace('.'+y+','+x+'.', '.');
//alert(y+','+x+'.');
} else {
+ //Placing a wall
if (blocks[mapid] < 1) {
//alert("Outa blocks!");
updateDsp(mapid, 'dspWalls', "OUT!");
@@ -90,7 +96,9 @@ function grid_click(obj) { blocks[mapid]--;
}
//document.getElementById('blocksdisplay').innerHTML = "<b>"+blocks[mapid]+"</b>";
-
+ if (isChallenge == true) {
+ challengeWall(mapid);
+ }
updateDsp(mapid, 'dspWalls', blocks[mapid]+" walls");
//document.getElementById(mapid+',dspWalls').innerHTML = " "+blocks[mapid]+" walls";
@@ -277,8 +285,8 @@ function animatePathDone(mapid) { updateDsp(mapid, 'dspScore', htmlscores);
htmlscores = '';
}
- if (ischallenge == true) {
- challengecomplete(mapid);
+ if (isChallenge == true) {
+ challengeGo(mapid);
}
}
|