diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2011-09-10 01:44:35 -0700 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2011-09-10 01:44:35 -0700 |
commit | f5fae4bbf7d84419cf4ecb38238bfb9bb2f911e5 (patch) | |
tree | 5d6a70ddea2a88268372ee63bcff99f13b5c05ec | |
parent | 33dfdb5654c3ba8fe43203e3212cefd8495cf2ea (diff) | |
download | pathery-f5fae4bbf7d84419cf4ecb38238bfb9bb2f911e5.tar.xz |
Tutorial started
-rw-r--r-- | index.php | 4 | ||||
-rw-r--r-- | js/mapspecs.js | 22 | ||||
-rw-r--r-- | pages/tutorial.php | 78 |
3 files changed, 91 insertions, 13 deletions
@@ -29,6 +29,10 @@ switch (strtolower($_GET[page])) { require("pages/test.php");
break;
+ case "tutorial":
+ require("pages/tutorial.php");
+ break;
+
case "embed":
require("pages/embed.php");
break;
diff --git a/js/mapspecs.js b/js/mapspecs.js index fe58658..17e4a74 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -8,6 +8,9 @@ window.onload = function(){ //document.getElementById('blocksdisplay').innerHTML = "<b>"+blocks+"</b>";
//doSend();
loadSol();
+ if (ischallenge == true) {
+ challengehint();
+ }
}
var solution = new Array();
@@ -274,6 +277,9 @@ function animatePathDone(mapid) { updateDsp(mapid, 'dspScore', htmlscores);
htmlscores = '';
}
+ if (ischallenge == true) {
+ challengecomplete(mapid);
+ }
}
function request_scores_done() {
@@ -624,12 +630,16 @@ function doanimate(x, y, p, c, mapid) { setTimeout("doanimate("+x+","+y+",'"+p+"','"+t+"','"+mapid+"')",rs);
}
-function flashelement(eid, times, color) {
+function flashelement(eid, times, color, speed) {
//alert("exe"+eid);
if (document.getElementById(eid) == undefined) return;
if (!color) {
color = "#FFFF44";
}
+ if (!speed) {
+ speed = 220;
+ }
+ speedon = speed * .5;
//document.getElementById(eid).setAttribute('class', 'no_transition');
var currentclass = document.getElementById(eid).className;
if (document.getElementById(eid).classOrigName != undefined)
@@ -639,17 +649,17 @@ function flashelement(eid, times, color) { document.getElementById(eid).style.backgroundColor = '#000000';
for (var i=0; i<times; i++) {
//Flash bright
- setTimeout("document.getElementById('"+eid+"').style.color = '#000000'", i*220);
- setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '"+color+"'", i*220);
+ setTimeout("document.getElementById('"+eid+"').style.color = '#000000'", i*speed);
+ setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '"+color+"'", i*speed);
// setTimeout("document.getElementById('"+mapid+",dspCount').style.fontWeight = 'bold'", i*200);
//Flash out
- setTimeout("document.getElementById('"+eid+"').style.color = ''", (i*220) + 100);
- setTimeout("document.getElementById('"+eid+"').style.backgroundColor = ''", (i*220) + 100);
+ setTimeout("document.getElementById('"+eid+"').style.color = ''", (i*speed) + speedon);
+ setTimeout("document.getElementById('"+eid+"').style.backgroundColor = ''", (i*speed) + speedon);
// setTimeout("document.getElementById('"+mapid+",dspCount').style.fontWeight = ''", i*200);
}
//setTimeout("document.getElementById('"+eid+"').className = '"+currentclass+"'", (i*220) + 200);
- setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '"+currentColor+"'", (i*220) + 200);
+ setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '"+currentColor+"'", (i*speed) + 200);
//document.getElementById(eid).className=currentclass;
//document.getElementById(eid).style.backgroundColor=currentColor;
}
diff --git a/pages/tutorial.php b/pages/tutorial.php index 1980bb5..3ce0d06 100644 --- a/pages/tutorial.php +++ b/pages/tutorial.php @@ -8,6 +8,39 @@ topbar($Links); <script type="text/javascript" src="sounds/script/soundmanager.js"></script>
+<?
+$requiredmoves = '18';
+?>
+
+<script type="text/javascript">
+ischallenge = true;
+
+function challengecomplete(mapid) {
+ var moves = mapjson[mapid].moves;
+
+ if (moves == <? echo $requiredmoves; ?>) {
+ flashelement('nextbtn', 15, null, 400);
+ updateDsp(1, 'instructions', 'Great Job!<br />Lets move on to the next shall we?')
+ } else {
+ //challengehint();
+ updateDsp(1, 'instructions', 'Place some walls<br />What would make it travel the longest?')
+ flashelement('1,instructions', 2, '#cce', 700);
+ setTimeout("flashelement('1,3,5', 10, '#cce', 760);", 1500);
+ setTimeout("flashelement('1,4,6', 10, '#cce', 760);", 1500);
+ }
+}
+
+function challengehint() {
+ //setTimeout("flashelement('1,3,5', 10, '#cce', 620);", 100);
+ //setTimeout("flashelement('1,4,6', 10, '#cce', 620);", 100);
+ setTimeout("flashelement('1,btn', 6, '#ee4', 620);", 1500);
+ setTimeout("flashelement('1,instructions', 3, '#cce', 620);", 700);
+ //updateDsp(mapid, element, data) {
+}
+
+
+</script>
+
<?php
include('./includes/maps.php');
@@ -16,26 +49,57 @@ include('./includes/datas.php'); ?>
<div class="col2" style="text-align: center">
-<p>
-Place blocks where it says to...
+<br /> <br />
+<strong><p id='1,instructions'>
+Press GO!
+<br />
</p>
+</strong>
<br />
<?
-echo "<a href='#'>Previous</a> | <a href='#'>Next</a> ";
+echo "<a href='#'>Previous</a> | <a href='#' id='nextbtn'>Next</a> ";
-$challenge1[] = "soooraoof";
-$challenge1[] = "sooooroof";
+$challenge1[] = "sooraooof";
+$challenge1[] = "sooorooof";
$challenge1[] = "sooooooof";
$challenge1[] = "sooooooof";
$challenge1[] = "sooooooof";
-$myparams['checkpoints'] = 3;
-$myparams['teleports'] = 1;
+$myparams['checkpoints'] = 1;
+$myparams['teleports'] = 0;
$myparams['walls'] = 2;
$map1 = GenerateShapedMap($challenge1, $myparams);
+$challenge2[] = "soooraoof";
+$challenge2[] = "sooooroof";
+$challenge2[] = "sooooooof";
+$challenge2[] = "sooroooof";
+$challenge2[] = "soobrooof";
+
+$myparams['checkpoints'] = 2;
+$myparams['teleports'] = 0;
+$myparams['walls'] = 4;
+
+$map2 = GenerateShapedMap($challenge2, $myparams);
+
+$challenge3[] = "soooraoof";
+$challenge3[] = "sooooroof";
+$challenge3[] = "sooooooof";
+$challenge3[] = "sooroooof";
+$challenge3[] = "soobrooof";
+
+$myparams['checkpoints'] = 1;
+$myparams['teleports'] = 0;
+$myparams['walls'] = 4;
+
+$map3 = GenerateShapedMap($challenge3, $myparams);
+
echo DisplayMap($map1, 1);
+echo "<br />";
+echo "<br /><center>map2</center>";
+echo "<br />";
+//echo DisplayMap($map2, 2);
//$mysolution = getSolution($userID, $mapID);
//$solutiondiv .= "<div id='mapsol' style='visibility:hidden;display:none'>";
|