$(document).ready( function(){ //preloads assets into karma 'collections' var k = Karma({ audio: [{'name':'correct','file':'correct.ogg'}, {'name':'incorrect','file':'incorrect.ogg'} ]}); //this command will scale down the lesson if the user's browser window //is smaller than 950px X 600px k.scaleWindow(); //sets locale, otherwise defaults to English $.i18n.setLocale('en'); k.ready( function(){ //put your main lesson code inside this callback //This attaches the Karma Header widget to the div w/ the id #kHeader //and initializes it w/ values $('#kHeader').kHeader({'title': 'My First Karma Lesson', lessonPlan: true, teachersNote: true}); //set up the footer and initialize it with a winning score var kFooter = $('#kFooter').kFooter({'winningScore': 6, pauseButton: true, startButton: true}); //Set up feedback widget, this shows the user a correct or incorrect //icon and sound when triggered programmatically var $feedback = $('#feedback').feedback(); /* Here are examples of using the feedback widget $feedback.feedback('correct'); $feedback.feedback('incorrect'); $feedback.feedback('win'); $feedback.feedback('lose'); */ //here are examples of binding behavior to events kFooter.bind('kFooterWinGame', function(){ $('.optImg').hide(); $('.imageBox').hide(); $('#gameOver').show(); }); kFooter.bind('kFooterRestart', function() { object_counter = 1; imgNameRand = []; optPosition = []; optOtherPos = []; imageObject = []; score = 0; wrong_selected = 0; //wrong option selected so don't score up load_images(); game(); } ); }); //end of games }); //end of DOM