diff options
author | Felipe Lopez Toledo <zer.subzero@gmail.com> | 2009-09-04 02:51:32 (GMT) |
---|---|---|
committer | Felipe Lopez Toledo <zer.subzero@gmail.com> | 2009-09-04 02:51:32 (GMT) |
commit | c9c34fa6e3e133d71cf77846fdb656284cc86c5e (patch) | |
tree | 95c88a3a8b4d04fbbea36cb73f237130f2f75996 | |
parent | 31a73aea84a6687c64c7f9dfa6638e8a758b4a65 (diff) |
adding up multicanvasas "correct/incorrect" bug fixed
-rwxr-xr-x | examples/adding_up_to_10/index.html | 2 | ||||
-rw-r--r-- | examples/adding_up_to_10/js/lesson.js | 62 |
2 files changed, 32 insertions, 32 deletions
diff --git a/examples/adding_up_to_10/index.html b/examples/adding_up_to_10/index.html index 0eb8c8d..73a76c2 100755 --- a/examples/adding_up_to_10/index.html +++ b/examples/adding_up_to_10/index.html @@ -9,7 +9,7 @@ <script type="text/javascript" src="../../js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="../../js/karma.Gettext.js"></script> <script type="text/javascript" src="../../js/jquery.karma.js"></script> - <script type="text/javascript" src="js/lesson1.js"></script> + <script type="text/javascript" src="js/lesson.js"></script> diff --git a/examples/adding_up_to_10/js/lesson.js b/examples/adding_up_to_10/js/lesson.js index f7c39fd..349098d 100644 --- a/examples/adding_up_to_10/js/lesson.js +++ b/examples/adding_up_to_10/js/lesson.js @@ -1,25 +1,25 @@ $(document).ready(function(){ -var k = $.karma ({container: "#karma-main"/*, lang: "es-MX"*/}); - k.init({ +var k = $.karma ({container: "#karma-main", lang: "es-MX"}); +k.init({ images: [ - {id: "ball", file: "ball.png", localized : false }, - {id: "ballon", file: "ballon.png", localized : false }, - {id: "banana", file: "banana.png", localized : false }, - {id: "chilli", file: "chilli.png", localized : false }, - {id: "fish" , file: "fish.png", localized : false }, - {id: "flower", file: "flower.png", localized : false }, - {id: "happyMonkey", file: "happyMonkey.jpg", localized : false }, - {id: "scorebox", file: "scorebox.png", localized : false } + {id: "ball", file: "ball.png", localized : false }, + {id: "ballon", file: "ballon.png", localized : false }, + {id: "banana", file: "banana.png", localized : false }, + {id: "chilli", file: "chilli.png", localized : false }, + {id: "fish" , file: "fish.png", localized : false }, + {id: "flower", file: "flower.png", localized : false }, + {id: "happyMonkey", file: "happyMonkey.jpg", localized : false }, + {id: "scorebox", file: "scorebox.png", localized : false } ] , sounds: [ - {id: "correct", file: "correct.ogg" }, - {id: "incorrect",file: "incorrect.ogg" } + {id: "correct", file: "correct.ogg" }, + {id: "incorrect",file: "incorrect.ogg" } ] - }); +}); - k.main(function() { +k.main(function() { var topLtCanvas = document.getElementById("topLtCanvas") var topLtCtx = topLtCanvas.getContext('2d'); var topRtCanvas = document.getElementById("topRtCanvas") @@ -165,7 +165,7 @@ var k = $.karma ({container: "#karma-main"/*, lang: "es-MX"*/}); // if (!timerId){ // timerId = setInterval (timerFn, 500); // } else { clearInterval(timerId); resetTimer();} - + } //put the buttons @@ -173,22 +173,22 @@ var k = $.karma ({container: "#karma-main"/*, lang: "es-MX"*/}); buttons[ 0 ] = { "canvas": bottomLtCanvas, "id": 0}; buttons[ 1 ] = { "canvas": bottomMdCanvas, "id": 1}; buttons[ 2 ] = { "canvas": bottomRtCanvas, "id": 2}; - $.each(buttons, function() { - this["canvas"].addEventListener('click', function() { - if ( choices[ this["id"] ] === total){ - score = score + 1; - k.library.sounds[ "correct" ].play(); - level = (level+1)% imgNames.length; - game(); - }else { - k.library.sounds[ "incorrect" ].play(); - game(); - } - }, true);}); + $.each(buttons, function( key, item ) { + this["canvas"].addEventListener('click', function( ev ) { + if ( choices[ item.id ] === total){ + score = score + 1; + k.library.sounds[ "correct" ].play(); + level = (level+1)% imgNames.length; + + }else { + k.library.sounds[ "incorrect" ].play(); + } + game(); + }, true); + }); game(); - - }); - - +//end of Karma.main +}); +//end of ready });
\ No newline at end of file |