diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2011-11-07 02:05:16 -0800 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2011-11-07 02:05:16 -0800 |
commit | 016f8cccd578b8f794021035ff8f516a44bcbda4 (patch) | |
tree | 3ea23e5b44718e68a15b3eeb4254b0fe939af4ac | |
parent | c128a5d15dba6f2715906e8a1a6714b942a6f886 (diff) | |
download | pathery-016f8cccd578b8f794021035ff8f516a44bcbda4.tar.xz |
Tutorial work
-rw-r--r-- | includes/header.php | 2 | ||||
-rw-r--r-- | includes/maps.php | 2 | ||||
-rw-r--r-- | pages/tutorial.php | 126 |
3 files changed, 108 insertions, 22 deletions
diff --git a/includes/header.php b/includes/header.php index a9d3538..3943238 100644 --- a/includes/header.php +++ b/includes/header.php @@ -1,6 +1,6 @@ <?php
-function htmlHeader($css) {
+function htmlHeader($css = array()) {
?>
<!DOCTYPE html>
<html xml:lang="en" lang="en">
diff --git a/includes/maps.php b/includes/maps.php index 901a946..ef1d6e0 100644 --- a/includes/maps.php +++ b/includes/maps.php @@ -389,7 +389,7 @@ function GenerateShapedMap($shape, $params) { else
$teleports = 0;
- if ($params['walls'])
+ if (is_int($params['walls']))
$walls = $params['walls'];
else
$walls = 13;
diff --git a/pages/tutorial.php b/pages/tutorial.php index a614173..3a12d32 100644 --- a/pages/tutorial.php +++ b/pages/tutorial.php @@ -1,9 +1,14 @@ <?PHP
-htmlHeader();
+htmlHeader(array('tutorial'));
?>
<body>
<?php
topbar($Links);
+
+
+
+
+
?>
<script type="text/javascript" src="sounds/script/soundmanager.js"></script>
@@ -15,19 +20,69 @@ $requiredmoves = '18'; <script type="text/javascript">
isChallenge = true;
+
+
function challengeGo(mapid) {
var moves = mapjson[mapid].moves;
+ var tiles = new Array();
+
+ switch (mapid) {
+ case '1':
+ if (moves == <? echo $requiredmoves; ?>) {
+ flashelement('nextbtn', 15, null, 400);
+ updateDsp(1, 'instructions', 'Great Job!<br />Lets move on to the next shall we?')
+ //Unlock next button.
+ } else {
+ //challengehint();
+ updateDsp(1, 'instructions', 'As you can see, the path travels from the Start to A to Finish.<hr />Place 2 walls where it\'s flashing to make the path longer')
+ //flashelement('1,instructions', 2, '#cce', 700);
+ //setTimeout('document.getElementById("1,3,5").style.backgroundColor = "#ccccdd"', 500);
+ //setTimeout('document.getElementById("1,4,6").style.backgroundColor = "#ccccdd"', 600);
+ tiles=["1,3,5","1,4,6"];
+ marktiles(tiles);
+ }
+ break;
+
+ case '2':
+ if (moves == 20) {
+ flashelement('nextbtn', 15, null, 400);
+ updateDsp(1, 'instructions', 'I almost confused you! hehe.<br />Next?')
+ //Unlock next button.
+ } else {
+ //challengehint();
+ updateDsp(1, 'instructions', 'The path can travel over the start and end tiles too.<br />')
+ //flashelement('1,instructions', 2, '#cce', 700);
+ //setTimeout('document.getElementById("1,3,5").style.backgroundColor = "#ccccdd"', 500);
+ //setTimeout('document.getElementById("1,4,6").style.backgroundColor = "#ccccdd"', 600);
+ tiles=["2,2,4","2,3,3","2,4,2","2,4,1"];
+ marktiles(tiles);
+ }
+ break;
+
+ case '3':
+ if (moves == 20) {
+ flashelement('nextbtn', 15, null, 400);
+ updateDsp(1, 'instructions', 'I almost confused you! hehe.<br />Next?')
+ //Unlock next button.
+ } else {
+ //challengehint();
+ updateDsp(1, 'instructions', 'The path can travel over the start and end tiles too.<br />')
+ //flashelement('1,instructions', 2, '#cce', 700);
+ //setTimeout('document.getElementById("1,3,5").style.backgroundColor = "#ccccdd"', 500);
+ //setTimeout('document.getElementById("1,4,6").style.backgroundColor = "#ccccdd"', 600);
+ tiles=["3,3,6","3,4,7","3,3,2","3,2,1"];
+ marktiles(tiles);
+ }
+ break;
+
+ }
+
+}
- if (moves == <? echo $requiredmoves; ?>) {
- flashelement('nextbtn', 15, null, 400);
- updateDsp(1, 'instructions', 'Great Job!<br />Lets move on to the next shall we?')
- //Unlock next button.
- } else {
- //challengehint();
- updateDsp(1, 'instructions', 'As you can see, the path travels from the Start to A to Finish.<hr />Place 2 walls where it\'s flashing to make the path longer')
- 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 marktiles(tiles) {
+ for(var i in tiles) {
+ tmp = tiles[i];
+ setTimeout('document.getElementById("'+tiles[i]+'").style.backgroundColor = "#ccccdd"', i*150 + 900);
}
}
@@ -108,6 +163,20 @@ The point of this game is to create the longest <i>path</i> between the start an <?
echo "<a href='#'>Previous</a> | <a href='#' id='nextbtn'>Next</a> ";
+
+
+$example1[] = "sraooroooof";
+$example1[] = "sorooroorof";
+$example1[] = "sooroooroof";
+$example1[] = "sooorrrooof";
+$example1[] = "sooooooooof";
+
+$myparams['teleports'] = 0;
+$myparams['walls'] = 0;
+
+$examplemap = GenerateShapedMap($example1, $myparams);
+
+
$challenge1[] = "sooraooof";
$challenge1[] = "sooorooof";
$challenge1[] = "sooooooof";
@@ -120,32 +189,49 @@ $myparams['walls'] = 2; $map1 = GenerateShapedMap($challenge1, $myparams);
-$challenge2[] = "soooraoof";
-$challenge2[] = "sooooroof";
+$challenge2[] = "soooaroof";
+$challenge2[] = "sooooooof";
+$challenge2[] = "sooooooof";
+$challenge2[] = "sooooooof";
$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['checkpoints'] = 2;
$myparams['teleports'] = 0;
$myparams['walls'] = 4;
-
$map3 = GenerateShapedMap($challenge3, $myparams);
+$challenge4[] = "suooooatoof";
+$challenge4[] = "sooooooooof";
+$challenge4[] = "sooooooooof";
+$challenge4[] = "sooooooooof";
+$challenge4[] = "sooooooooof";
+$challenge4[] = "sooooooooof";
+$myparams['checkpoints'] = 1;
+$myparams['teleports'] = 1;
+$myparams['walls'] = 5;
+$map4 = GenerateShapedMap($challenge4, $myparams);
+
+
+echo DisplayMap($examplemap, 0, 'puzzle');
+echo "<br />";
echo DisplayMap($map1, 1, 'puzzle');
echo "<br />";
+echo DisplayMap($map2, 2, 'puzzle');
+echo "<br />";
+echo DisplayMap($map3, 3, 'puzzle');
+echo "<br />";
+echo DisplayMap($map4, 4, 'puzzle');
+echo "<br />";
//echo "<br /><center>map2</center>";
echo "<br />";
//echo DisplayMap($map2, 2);
|