
"use strict";
var Game = function($) {
    return {
        config : {
            width : 480,
            height : 280,
        },

		
        initialize : function() {
            Crafty.init();  
            Crafty.canvas.init();

			Crafty.stage.fullscreen=true;
			Crafty.background('rgb(255,255,255)')

			screen.mozLockOrientation("landscape-primary");

            if(Crafty.mobile){
				//console.log("MOBILE VERSION");
			}
			else {
				//console.log("NOT MOBILE VERSION");
			}
			
		  	
            Crafty.sprite(160,110, "images/black_horse_sprite.png", {
                BlackHorse: [0,0]				   			   			   
            });	

            Crafty.sprite(160,110, "images/brown_horse_sprite.png", {
                BrownHorse: [0,0],
            });	
            
            Crafty.sprite(160,110, "images/white_horse_sprite.png", {
                WhiteHorse: [0,0],
            });
            
            Crafty.sprite(38,30, "images/nos.png", {
                nos1: [0,0],
                nos2: [1,0],
                nos3: [2,0],
                nos4: [3,0],
                nos5: [4,0],
                nos6: [5,0],
                nos7: [6,0],
                nos8: [7,0],
                nos9: [8,0],
                nos0: [9,0]				   			   			  
            });
    
            Crafty.load(["images/1st.png", "images/2nd.png", "images/about_us_button.png",
                         "images/about_us_button1.png", "images/aboutus_text.png", "images/ac_balance.png",
                         "images/back_bar.png", "images/back_bar1.png", "images/back_bar2.png",
                         "images/back_image.png", "images/back_image1.png", "images/begin_race.png",
                         "images/bet_amount.png", "images/bettingBg.png", "images/bg1.png", "images/bg2.png",
                         "images/bg3.png", "images/bg4.png", "images/black_horse.png", "images/black_horse_border.png",
                         "images/black_horse_sprite.png", "images/brown_horse.png", "images/brown_horse_border.png",
                         "images/brown_horse_sprite.png", "images/clear.png", "images/clear1.png", 
                         "images/error_msg1.png", "images/error_msg2.png", "images/exit.png", "images/exit1.png",
                         "images/exit_tab.png", "images/finish_line.png", "images/FRAME.png", "images/gameBg.png",
                         "images/header.png", "images/help.png", "images/help_text.png", "images/help1.png",
                         "images/logo.png", "images/lost.png", "images/mainmenu_msg.png", "images/newgame.png",
                         "images/newgame1.png", "images/nos.png", "images/off.png", "images/on.png",
                         "images/options.png", "images/pause.png", "images/pause1.png", "images/procced.png",
                         "images/quit_button.png", "images/quit_button1.png", "images/resume_button.png",
                         "images/resume_button1.png", "images/select.png", "images/select1.png",
                         "images/select_horse.png", "images/start_line.png", "images/start_race.png",
                         "images/status_tab.png", "images/tt_Logo.png", "images/white_ horse_border.png",
                         "images/white_horse.png", "images/white_horse_sprite.png", "images/won.png",
                         "images/bet_amount2.png", "images/menuBg.png", "images/3rd.png", 
                         "images/start_race2.png",],

		                
                        function() { 
                            console.log("***************************************")
                            loadAudio();
                            console.log(" all assets are loaded ")
                            console.log("***************************************")
                            Crafty.scene('TTSplash');
		                   
                        },
                         function(e) {
                             // console.log("progress ", e.total, e.loaded)
                         },

                         function(e) {
                             //console.log("")
                         }

                         ) 

         },
    
    };

}($);

