diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2011-12-05 00:52:15 -0800 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2011-12-05 00:52:15 -0800 |
commit | 2fcf71ee0f0feb98cdd1fb1a44b2711a567056fe (patch) | |
tree | 7189615499db5ff6180ee6b17c9b95c3962c3af7 /pages/tutorial.php | |
parent | f5d9568541feab221a366075517d99d5c17a57c6 (diff) | |
download | pathery-2fcf71ee0f0feb98cdd1fb1a44b2711a567056fe.tar.xz |
Tutorial added in. More testing with a solver.
Diffstat (limited to 'pages/tutorial.php')
-rw-r--r-- | pages/tutorial.php | 144 |
1 files changed, 89 insertions, 55 deletions
diff --git a/pages/tutorial.php b/pages/tutorial.php index 15a7c83..9b472ff 100644 --- a/pages/tutorial.php +++ b/pages/tutorial.php @@ -12,21 +12,53 @@ topbar($Links); <script>
isChallenge = true;
+
+
+function challengeLoad() {}
+
+
+challenge1 = new Object();
+challenge2 = new Object();
+challenge3 = new Object();
+challenge4 = new Object();
+challenge5 = new Object();
+
+
+challenge1.start = "The objective in this game is to create the longest <i>path</i> between the start and the finish.<br>Below is a demonstration.<br>Press <b>Go!</b>";
+challenge1.complete = "Now that you see what is going on, let's move on to some puzzles.<br/>Press <b>Next</b>";
+
+challenge2.start = "Let's start off simple.<br>Start by pressing <b>Go!</b> first.";
+challenge2.wallstext = "Excellent; those wall placements look good!<br>Press <b>Go!</b> and see the path you\'ve made.";
+challenge2.complete = "Splendid!<br>Shall we move on to the next puzzle?<br/>Press <b>Next</b>";
+challenge2.help = "Click on the board to place two walls to make the path longer.<br>You can click on a placed wall to remove it.";
+
+challenge3.start = "The goal for this map is 64 moves<br>Press <b>Go!</b> first again.";
+challenge3.complete = "Impressive!<br/>Press <b>Next</b>";
+challenge3.help = "Note that the path can travel over the <i>Start</i> and <i>End</i> tiles.";
+
+challenge4.start = "Teleports are traps you can use to your advantage. See if you can use the teleport to reach 33 moves!<br>Press <b>Go!</b>";
+challenge4.complete = "Well done!<br>Teleports add extra intrigue to the game.";
+challenge4.help = "Let's use that teleport to block the way to the <i>A</i>!<br>We can make the path take longer to get to <i>A</i> in the process.";
+
+challenge5.start = "Now for a difficult one. The goal for this one is 75 moves.<br>Press <b>Go!</b> to check your path.";
+challenge5.complete = "Look at you, so pro.<br><a href='?page=home'>Go play the game!</a>";
+challenge5.help = "Try placing the walls as highlighted.";
+
function challengeGo(mapid) {
var moves = mapjson[mapid].moves;
switch (mapid) {
case '1':
- tv.unlock();
- updateDsp(1, 'instructions', "Now that you see what's going on, let's move on to some puzzles.");
+ tv.unlock(2);
+ updateDsp(1, 'instructions', challenge1.complete);
break;
case '2':
if (moves >= 18) {
- updateDsp(1, 'instructions', "Great, that's 18 moves!<br />Lets move on to the next shall we?");
- tv.unlock();
+ updateDsp(1, 'instructions', challenge2.complete);
+ tv.unlock(3);
} else {
- updateDsp(1, 'instructions', "The goal for this map is 18 moves.<br />Place 2 walls to make the path longer");
+ updateDsp(1, 'instructions', challenge2.help);
var tiles = ["2,3,5","2,4,6"];
markTiles(tiles);
}
@@ -34,32 +66,32 @@ function challengeGo(mapid) { case '3':
if (moves >= 64) {
- updateDsp(1, 'instructions', '<p>I almost confused you! hehe.</p><p>Next?</p>');
- tv.unlock();
+ updateDsp(1, 'instructions', challenge3.complete);
+ tv.unlock(4);
} else {
- updateDsp(1, 'instructions', '<p>The path can travel over the start and end tiles too.</p><br>');
+ updateDsp(1, 'instructions', challenge3.help);
var tiles = ["3,3,6","3,4,7","3,3,2","3,2,1"];
markTiles(tiles);
}
break;
case '4':
- if (moves >= 45) {
- updateDsp(1, 'instructions', "Figure out how that teleport worked?<br />Play with it if you didn't");
- tv.unlock();
+ if (moves >= 33) {
+ updateDsp(1, 'instructions', challenge4.complete);
+ tv.unlock(5);
} else {
- updateDsp(1, 'instructions', "Let's use that teleport to block the way to the A!<br />We can also make it take longer to get to A in the process.");
- var tiles = ["4,1,5","4,2,6","4,3,7","4,5,9"];
+ updateDsp(1, 'instructions', challenge4.help);
+ var tiles = ["4,1,5","4,2,6","4,3,7","4,4,9"];
markTiles(tiles);
}
break;
case '5':
if (moves >= 75) {
- updateDsp(1, 'instructions', 'Look at you so pro.<br />Go play the game!');
+ updateDsp(1, 'instructions', challenge5.complete);
//Unlock next button.
} else {
- updateDsp(1, 'instructions', 'Now it gets more difficult.<br />');
+ updateDsp(1, 'instructions', challenge5.help);
var tiles = ["5,1,5","5,2,6","5,3,3","5,4,2","5,3,1"];
markTiles(tiles);
}
@@ -90,28 +122,17 @@ function challengeWall(mapid) { return;
}
}
- updateDsp(1, 'instructions', 'Excellent; those wall placements look good!<br>Press "Go!" and see the path it takes')
-}
-
-function challengeLoad() {}
-
-function challenge() {
-//this.
+ updateDsp(1, 'instructions', challenge2.wallstext)
}
-
-//var ch = new challenge();
-
-
-
function highlightElement(Eid) {
}
function startChallenge(mapid) {
- console.log("start challenge", mapid);
+ //console.log("start challenge", mapid);
switch (mapid) {
case 1:
- updateDsp(1, 'instructions', '<p>The point of this game is to create the longest <i>path</i> between the start and the finish.</p><p>Press Go!</p>');
+ updateDsp(1, 'instructions', challenge1.start);
var goBtn = document.getElementById('1,btn');
var interval1 = setInterval(function() {
goBtn.className += ' flash';
@@ -131,16 +152,16 @@ function startChallenge(mapid) { }
break;
case 2:
- updateDsp(1, 'instructions', "<p>Let's start off simple;</p><p>Start by pressing 'Go!' first.</p>");
+ updateDsp(1, 'instructions', challenge2.start);
break;
case 3:
- updateDsp(1, 'instructions', "The goal for this map is 64 moves<br />Press 'Go!'");
+ updateDsp(1, 'instructions', challenge3.start);
break;
case 4:
- updateDsp(1, 'instructions', "Teleports are traps. See if you can use the teleport to reach 45 moves!<br />Press 'Go!'");
+ updateDsp(1, 'instructions', challenge4.start);
break;
case 5:
- updateDsp(1, 'instructions', "Now for a difficult one. The goal for this one is 75 moves.<br />Press 'Go!' for help");
+ updateDsp(1, 'instructions', challenge5.start);
break;
}
}
@@ -149,6 +170,12 @@ function TutorialView(low, high) { this.low = low;
this.high = high;
this.cur = low;
+ //Lock them all.
+ this.locked = low;
+
+ //Override hack to unlock all the levels.
+ //this.locked = high;
+
this.nextbtn = document.getElementById('nextbtn');
this.prevbtn = document.getElementById('prevbtn');
this.interval1 = this.interval2 = null;
@@ -161,7 +188,12 @@ TutorialView.prototype.showTutorial = function(num) { }
var elem = document.getElementById("tut-" + num);
elem.className = elem.className.replace('hidden', '');
+ //Is the map after this disabled?
+ this.nextbtn.className = this.nextbtn.className.replace(' disabled', '');
+ if (this.locked <= this.cur)
+ this.nextbtn.className += ' disabled';
startChallenge(num);
+ tv.nextbtn.className = tv.nextbtn.className.replace(' flash', '');
}
TutorialView.prototype.next = function() {
clearInterval(this.interval1);
@@ -173,10 +205,10 @@ TutorialView.prototype.next = function() { if (this.nextbtn.className.indexOf('hidden') < 0)
this.nextbtn.className += ' hidden';
} else {
- this.nextbtn.className = this.nextbtn.className.replace('hidden', '');
- this.nextbtn.className += ' disabled';
+ this.nextbtn.className = this.nextbtn.className.replace(' hidden', '');
+ //this.nextbtn.className += ' disabled';
}
- this.prevbtn.className = this.prevbtn.className.replace('hidden', '');
+ this.prevbtn.className = this.prevbtn.className.replace(' hidden', '');
}
TutorialView.prototype.prev = function() {
this.showTutorial(--this.cur);
@@ -184,19 +216,26 @@ TutorialView.prototype.prev = function() { if (this.prevbtn.className.indexOf('hidden') < 0)
this.prevbtn.className += ' hidden';
} else
- this.prevbtn.className = this.prevbtn.className.replace('hidden', '');
- this.nextbtn.className = this.nextbtn.className.replace('hidden', '');
+ this.prevbtn.className = this.prevbtn.className.replace(' hidden', '');
+ this.nextbtn.className = this.nextbtn.className.replace(' hidden', '');
}
TutorialView.prototype.unlock = function(n) {
- this.nextbtn.className = this.nextbtn.className.replace('disabled', '');
- this.interval1 = setInterval(function() {
- tv.nextbtn.className += ' flash';
- }, 1200);
- setTimeout(function() {
- tv.interval2 = setInterval(function() {
- tv.nextbtn.className = tv.nextbtn.className.replace(' flash', '');
- }, 1200);
- }, 600);
+ if (n > this.locked) {
+ this.locked = n;
+ if (this.locked >= this.cur) {
+ this.nextbtn.className = this.nextbtn.className.replace(' disabled', '');
+ this.interval1 = setInterval(function() {
+ tv.nextbtn.className += ' flash';
+ }, 1200);
+ setTimeout(function() {
+ tv.interval2 = setInterval(function() {
+ tv.nextbtn.className = tv.nextbtn.className.replace(' flash', '');
+ }, 1200);
+ }, 600);
+ }
+ }
+
+
}
</script>
@@ -227,11 +266,7 @@ include('./includes/maps.php'); ?>
<div id="tut-wrapper">
<div style='height:80px;' id='1,instructions'>
- <p>
- The point of this game is to create the longest <i>path</i> between the start and the finish.
- </p><p>
- Press Go!
- </p>
+ <p>The objective in this game is to create the longest <i>path</i> between the start and the finish.<br>Below is a demonstration.<br>Press <b>Go!</b></p>;
</div>
<?
@@ -265,12 +300,11 @@ $myparams['teleports'] = 0; $myparams['walls'] = 4;
$map3 = GenerateShapedMap($challenge3, $myparams);
-$challenge4[] = "suooooatoof";
+$challenge4[] = "suooooaooof";
$challenge4[] = "sooooooooof";
$challenge4[] = "sooooooooof";
$challenge4[] = "sooooooorof";
-$challenge4[] = "sooooooooof";
-$challenge4[] = "sooooooooof";
+$challenge4[] = "soooooootof";
$myparams['checkpoints'] = 1;
$myparams['teleports'] = 1;
$myparams['walls'] = 4;
|