From 08005f801b1ba123e9152eff8f55f8cf4af3de43 Mon Sep 17 00:00:00 2001 From: hitman Date: Wed, 30 Sep 2009 07:10:03 +0000 Subject: You now get a congratulations message if you complete all 6 stages --- diff --git a/examples/adding_up_to_10/css/lesson.css b/examples/adding_up_to_10/css/lesson.css index ec5bfc6..f96d0ba 100755 --- a/examples/adding_up_to_10/css/lesson.css +++ b/examples/adding_up_to_10/css/lesson.css @@ -1,8 +1,9 @@ -#main { +#karma-main { width:800px; height:600px; position:absolute; +opacity: 1; } #action { float:left; diff --git a/examples/adding_up_to_10/index.html b/examples/adding_up_to_10/index.html index 464d6fb..69dcfc7 100755 --- a/examples/adding_up_to_10/index.html +++ b/examples/adding_up_to_10/index.html @@ -76,7 +76,7 @@ - +
diff --git a/examples/adding_up_to_10/js/lesson.js b/examples/adding_up_to_10/js/lesson.js index 8e2c84d..e2870c0 100755 --- a/examples/adding_up_to_10/js/lesson.js +++ b/examples/adding_up_to_10/js/lesson.js @@ -32,29 +32,37 @@ k.main(function() { //game logic var total, time, n0, n1, correct; var level = 0, d=160; - var choices=[], score = 0, speed = 4000; + var choices=[], score = 0, speed = 12000; var playerCorrect = 0, endTimerX = 80, startTimerY = 25, endTimerY = 100, offsetTimerY = 5; - var timerPaper, timerRect, + var overlayPaper, timerPaper, timerRect, chimpPaper, normalChimp, sadChimp, happyChimp, - topLtBox, topRtBox, bottomLtBox, bottomMdBox, bottomRtBox; + overlayBox, topLtBox, topRtBox, bottomLtBox, bottomMdBox, bottomRtBox; var buttons=[]; var stopTimer = false; var chooseMe; - var createBox = function (paperName) { + var createBox = function (paperName, width, height) { var set, paper, box; - paper = Raphael(paperName+"Paper", 200, 200); + if(!width || !height){ + paper = Raphael(paperName+"Paper", 200, 200); + } + else { + paper = Raphael(paperName+"Paper", width, height); + } set = paper.set(); return { "paper": paper, "prefix": paperName, "set": set}; }; + + overlayBox = createBox("overlay", 800, 600); topLtBox = createBox("topLt"); topRtBox = createBox("topRt"); bottomLtBox = createBox("bottomLt"); bottomMdBox = createBox("bottomMd"); bottomRtBox = createBox("bottomRt"); + boxes = [ topLtBox, topRtBox, bottomLtBox, bottomMdBox, bottomRtBox]; @@ -67,7 +75,7 @@ k.main(function() { box.set.remove(); }); - total = k.math.rand( 2, 10 ); //the total + total = k.math.rand( 2, 5 + level ); //the total n0 = total - k.math.rand(1, total - 1 ); //first number n1 = total - n0; //second number @@ -109,7 +117,7 @@ k.main(function() { y = k.math.rand( 0, d ); for ( var j=0; j