// on "init" you need to initialize your instance
bool GameLayer::init()
{
    if (!CCLayer::init())
        return false;

    // Create main loop
    this->schedule(schedule_selector(GameLayer::update));
    
    

    // COCOS2D TIP
    // Create Cocos2D objects here
    
    
    if (s3eAmazonAdsAvailable()) {
        
        g_AdId = 0;
        g_InterstatialId = 0;
        g_requestNewInterstatial = false;
        
        //
        //Use this for testing.
        //
        s3eAmazonAdsInit("your id here", true, true);
        
        //
        //Use this for production.
        //
        //s3eAmazonAdsInit("your id here", false, false);
        
        
        //Add the callbacks.
        s3eAmazonAdsRegister(S3E_AMAZONADS_CALLBACK_AD_ERROR,  onAdError,  this);
        s3eAmazonAdsRegister(S3E_AMAZONADS_CALLBACK_AD_LOADED, onAdLoad,  this);
        
        //Prepare the ads.
        s3eAmazonAdsPrepareAd(&g_AdId);
        s3eAmazonAdsPrepareAd(&g_InterstatialId);
        
        //
        //Use this for banner bottom
        //
        s3eAmazonAdsPrepareAdLayout(g_AdId, S3E_AMAZONADS_POSITION_BOTTOM, S3E_AMAZONADS_SIZE_AUTO);
        
        //
        //Use this for banner top
        //
        //s3eAmazonAdsPrepareAdLayout(adId, S3E_AMAZONADS_POSITION_TOP, S3E_AMAZONADS_SIZE_AUTO);
        
        //Load the ad.
        s3eAmazonAdsLoadAd(g_AdId);
        
        //Load the interstatial.
        s3eAmazonAdsLoadInterstitialAd(g_InterstatialId);
        
        //Banner ad change timer.
        s3eTimerSetTimer(30000, _adBanner, NULL);
        
        
    }

	// Create Box2D world
	world = new b2World(b2Vec2(0, 100));

    // BOX2D TIP
    // Create Box2D objects here

    return true;
}
bool isAvailable()
{
    return s3eAmazonAdsAvailable();
}