diff options
author | hitman <bryan@olenepal.org> | 2009-09-11 06:34:05 (GMT) |
---|---|---|
committer | hitman <bryan@olenepal.org> | 2009-09-11 06:34:05 (GMT) |
commit | 4d6f1cba9c115a88b0351192f87227b400486503 (patch) | |
tree | c95b53b1db1b0c6179ae6b4907b3bd3240a85a76 | |
parent | 4dd9173b0c9cd14f01bbb8582aaa96930180ddb9 (diff) |
changed voice for correct and incorrect
added start, stop, and reset buttons
still need to test functionality
-rwxr-xr-x | examples/adding_up_to_10/assets/en/sounds/en_correct.ogg | bin | 12359 -> 12811 bytes | |||
-rwxr-xr-x | examples/adding_up_to_10/assets/en/sounds/en_incorrect.ogg | bin | 15542 -> 12683 bytes | |||
-rwxr-xr-x | examples/adding_up_to_10/assets/en/sounds/en_trigger.ogg | bin | 10771 -> 0 bytes | |||
-rwxr-xr-x | examples/adding_up_to_10/css/lesson.css | 3 | ||||
-rwxr-xr-x | examples/adding_up_to_10/index.html | 6 | ||||
-rwxr-xr-x | examples/adding_up_to_10/js/lesson.js | 68 |
6 files changed, 61 insertions, 16 deletions
diff --git a/examples/adding_up_to_10/assets/en/sounds/en_correct.ogg b/examples/adding_up_to_10/assets/en/sounds/en_correct.ogg Binary files differindex c89ce57..a0d9e3a 100755 --- a/examples/adding_up_to_10/assets/en/sounds/en_correct.ogg +++ b/examples/adding_up_to_10/assets/en/sounds/en_correct.ogg diff --git a/examples/adding_up_to_10/assets/en/sounds/en_incorrect.ogg b/examples/adding_up_to_10/assets/en/sounds/en_incorrect.ogg Binary files differindex 2306562..4805e55 100755 --- a/examples/adding_up_to_10/assets/en/sounds/en_incorrect.ogg +++ b/examples/adding_up_to_10/assets/en/sounds/en_incorrect.ogg diff --git a/examples/adding_up_to_10/assets/en/sounds/en_trigger.ogg b/examples/adding_up_to_10/assets/en/sounds/en_trigger.ogg Binary files differdeleted file mode 100755 index f22512a..0000000 --- a/examples/adding_up_to_10/assets/en/sounds/en_trigger.ogg +++ /dev/null diff --git a/examples/adding_up_to_10/css/lesson.css b/examples/adding_up_to_10/css/lesson.css index 4b86d07..5147cfa 100755 --- a/examples/adding_up_to_10/css/lesson.css +++ b/examples/adding_up_to_10/css/lesson.css @@ -166,9 +166,8 @@ left:25px; } -#reset { +#buttons { position:absolute; top:80%; -left:20%; } diff --git a/examples/adding_up_to_10/index.html b/examples/adding_up_to_10/index.html index ac27b7d..ea752d9 100755 --- a/examples/adding_up_to_10/index.html +++ b/examples/adding_up_to_10/index.html @@ -65,7 +65,11 @@ </div> <div class="sidebarItem"> <canvas id="chimpCanvas" width="120px" height="125px"> </canvas> - <button id="reset">Start Over</button> + <div id="buttons"> + <button id="start">Start</button> + <button id="stop">Stop</button> + <button id="reset">Restart</button> + </div> </div> diff --git a/examples/adding_up_to_10/js/lesson.js b/examples/adding_up_to_10/js/lesson.js index c67dbb1..b96c10f 100755 --- a/examples/adding_up_to_10/js/lesson.js +++ b/examples/adding_up_to_10/js/lesson.js @@ -1,5 +1,6 @@ $(document).ready(function(){ + var k = $.karma ({container: "#karma-main", lang: "en"}); k.init({ @@ -18,7 +19,7 @@ $(document).ready(function(){ sounds: [ {id: "correct", file: "correct.ogg"}, {id: "incorrect", file: "incorrect.ogg"}, - {id: "trigger", file: "trigger.ogg"} + {id: "trigger", file: "trigger.ogg", localized: false} ], surfaces: [ @@ -51,8 +52,8 @@ k.main(function() { var endTimerX = 80; var startTimerY = 10; var endTimerY = 100; - var offsetTimerY = 20; - var timerId; + var offsetTimerY = 5; + var timerId; var timerFn = function () { k.surfaces['timer'].clear(); @@ -189,6 +190,8 @@ k.main(function() { }; var animateChimp = function (answer) { + var timerChimp; + k.surfaces["chimp"].clear(); if( answer === true){ k.library.images["happyChimp"].draw(k.surfaces["chimp"], 0, 0); @@ -201,12 +204,12 @@ k.main(function() { k.library.images["normalChimp"].draw(k.surfaces["chimp"], 0, 0); }; - timerId = setTimeout(restoreChimp, 800); + timerChimp = setTimeout(restoreChimp, 800); }; - var reset = function () { + var startStop = function (start) { score = level = 0; startTimerY = 10; $.each(k.surfaces, function () { @@ -214,13 +217,36 @@ k.main(function() { this.clear(); } }); - + + if (typeof timerId === 'number' ) { + clearInterval(timerId); + } + + timerId = setInterval (timerFn, 500); game(); + }; - document.getElementById('reset'). - addEventListener('click', reset, true); + var start = function () { + startStop(true); + }; + + + var stop = function () { + startTimerY = 10; + for (var i = 0; i < 50; i++){ + clearInterval(i); + } + k.surfaces["timer"].clear(); + }; + + var reset = function () { + startStop(true); + }; + + + //put the buttons @@ -233,13 +259,29 @@ k.main(function() { item.surface.canvas.addEventListener('click', function( ev ) { if ( choices[ item.id ] === total){ answer(true); - }else { answer(false); } - game(); - }, true); + game(); + }else { + answer(false); + game(); + } + + }, false); }); - timerId = setInterval (timerFn, 2000); + + document.getElementById('start'). + addEventListener('click', start, false); + + + document.getElementById('stop'). + addEventListener('click', stop, false); + + document.getElementById('reset'). + addEventListener('click', reset, false); + k.library.images["normalChimp"].draw(k.surfaces["chimp"], 0, 0); - game(); + + + //end of Karma.main }); //end of ready |