summaryrefslogtreecommitdiffstats
path: root/pages/tutorial.php
diff options
context:
space:
mode:
authorraylu <raylu@mixpanel.com>2011-11-15 23:09:44 -0800
committerraylu <raylu@mixpanel.com>2011-11-15 23:09:44 -0800
commit55b25d5e66710298a50ecdcc8fb8db8cb3b2fb8a (patch)
treef23d11260b32c3bb4ad2255fbe3374128ed0a938 /pages/tutorial.php
parent8a7969ad2e6189d1d536b9fd58ef9e53ed94b555 (diff)
downloadpathery-55b25d5e66710298a50ecdcc8fb8db8cb3b2fb8a.tar.xz
change locking
Diffstat (limited to 'pages/tutorial.php')
-rw-r--r--pages/tutorial.php31
1 files changed, 10 insertions, 21 deletions
diff --git a/pages/tutorial.php b/pages/tutorial.php
index d3a1aa0..36d6721 100644
--- a/pages/tutorial.php
+++ b/pages/tutorial.php
@@ -18,7 +18,7 @@ function challengeGo(mapid) {
switch (mapid) {
case '1':
- tv.unlock(2);
+ tv.unlock();
flashelement('nextbtn', 15, null, 400);
updateDsp(1, 'instructions', "Now that you see what's going on, let's move on to some puzzles.");
break;
@@ -27,7 +27,7 @@ function challengeGo(mapid) {
if (moves >= 18) {
flashelement('nextbtn', 15, null, 400);
updateDsp(1, 'instructions', "Great, that's 18 moves!<br />Lets move on to the next shall we?");
- tv.unlock(3);
+ tv.unlock();
} else {
updateDsp(1, 'instructions', "The goal for this map is 18 moves.<br />Place 2 walls to make the path longer");
var tiles = ["2,3,5","2,4,6"];
@@ -39,7 +39,7 @@ function challengeGo(mapid) {
if (moves >= 64) {
flashelement('nextbtn', 15, null, 400);
updateDsp(1, 'instructions', '<p>I almost confused you! hehe.</p><p>Next?</p>');
- tv.unlock(4);
+ tv.unlock();
} else {
updateDsp(1, 'instructions', '<p>The path can travel over the start and end tiles too.</p><br>');
var tiles = ["3,3,6","3,4,7","3,3,2","3,2,1"];
@@ -51,7 +51,7 @@ function challengeGo(mapid) {
if (moves >= 45) {
flashelement('nextbtn', 15, null, 400);
updateDsp(1, 'instructions', "Figure out how that teleport worked?<br />Play with it if you didn't");
- tv.unlock(5);
+ tv.unlock();
} 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"];
@@ -104,8 +104,6 @@ function challengeLoad() {}
function challenge() {
//this.
}
-challenge.prototype.unlock = function(id) {
-}
//var ch = new challenge();
@@ -141,8 +139,6 @@ function TutorialView(low, high) {
this.low = low;
this.high = high;
this.cur = low;
- //Lock them all.
- this.locked = low;
this.nextbtn = document.getElementById('nextbtn');
this.prevbtn = document.getElementById('prevbtn');
}
@@ -154,22 +150,19 @@ 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);
}
TutorialView.prototype.next = function() {
- //Is the next map locked?
- if (this.locked <= this.cur)
+ if (this.nextbtn.className.indexOf(' disabled') > -1)
return;
this.showTutorial(++this.cur);
if (this.cur == this.high) {
if (this.nextbtn.className.indexOf('hidden') < 0)
this.nextbtn.className += ' hidden';
- } else
+ } else {
this.nextbtn.className = this.nextbtn.className.replace('hidden', '');
+ this.nextbtn.className += ' disabled';
+ }
this.prevbtn.className = this.prevbtn.className.replace('hidden', '');
}
TutorialView.prototype.prev = function() {
@@ -181,12 +174,8 @@ TutorialView.prototype.prev = function() {
this.prevbtn.className = this.prevbtn.className.replace('hidden', '');
this.nextbtn.className = this.nextbtn.className.replace('hidden', '');
}
-TutorialView.prototype.unlock = function(num) {
- if (num > this.locked) {
- this.locked = num;
- if (this.locked >= this.cur)
- this.nextbtn.className = this.nextbtn.className.replace('disabled', '');
- }
+TutorialView.prototype.unlock = function(n) {
+ this.nextbtn.className = this.nextbtn.className.replace('disabled', '');
}
</script>