Hi Gio, thanks for the reply. I am now using intel xdk with cordova to compile source and ad AdMob. I have added the correct plugins and edited my index.html file. My problem is I want to open an interstitial ad everytime that hiddenobjects.js is called, or alternativly at the end of hiddenobjects.js. So here is what I've done:
HiddenObject = function()
{
this.targetObject = '';
this.targetSprite = '';
this.movementSpeed = 1000;
this.rotationSpeed = 10;
this.onMouseDown = function()
{
var t = wade.getSceneObject(this.targetObject);
if (t && this.movementSpeed)
{
var ts = t.getSpriteByName(this.targetSprite);
if (ts)
{
this.owner.moveTo(ts.getPosition().x, ts.getPosition().y, this.movementSpeed);
if (this.rotationSpeed)
{
this.owner.setAngularVelocity(this.rotationSpeed);
}
this.owner.getSprite(0).setVisible(false);
var s = this.owner.getSprite(1);
s.setVisible(true);
s.bringToFront();
var time = wade.vec2.length(wade.vec2.sub(this.owner.getPosition(), ts.getPosition())) / this.movementSpeed;
s.setDrawFunction(wade.drawFunctions.fadeOpacity_(1, 0, time, s.getDrawFunction()));
}
}
};
this.onMoveComplete = function()
{
var t = wade.getSceneObject(this.targetObject);
if (t)
{
var ts = t.getSpriteByName(this.targetSprite);
if (ts)
{
ts.setImageFile && ts.setImageFile(this.owner.getSprite(1).getImageName());
}
}
wade.removeSceneObject(this.owner);
wade.playAudioIfAvailable("woosh.ogg");
if (!wade.getSceneObjects('objectToFind', true).length)
{
// game is over, do something here
wade.getSceneObject('greatjob').setVisible(true);
wade.getSceneObject('nextbutton').setVisible(true);
wade.playAudioIfAvailable("tada.ogg");
// This is where I want an AdMob ad
AdMob.isInterstitialReady(function(isready){
if(isready) AdMob.showInterstitial();
});
}
};
};
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0, minimal-ui"/>
<link rel="stylesheet" type="text/css" href="style.css" />
<title>Curious George: Hidden Objects</title>
<script>
//********************
// Start of Admob code
//********************
var admobid = {};
if( /(android)/i.test(navigator.userAgent) ) {
admobid = { // for Android
interstitial: 'ca-app-pub-4291367490811031/7059221702'
};
} else if(/(ipod|iphone|ipad)/i.test(navigator.userAgent)) {
admobid = { // for iOS
interstitial: 'your iOS admob ad unit id'
};
} else {
admobid = { // for Windows Phone
interstitial: 'your windows phone admob ad unit id'
};
}
//
function initApp() {
if (AdMob) {
AdMob.createinterstitial({
adId : admobid.interstitial,
autoShow : false
});
}
}
</script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="AdMob.js"></script>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="wade.js"></script>
<script>
$(document).ready(function()
{
wade.init('app.js');
});
</script>
</head>
<body>
<div id="container" style="border:0; width:800px; height:600px;">
<div id="wade_main_div" width="800" height="600" tabindex="1">
</div>
</div>
</body>
</html>
App = function()
{
// this is where the WADE app is initialized
this.init = function()
{
// load a scene
wade.loadScene('menu.wsc', true, function()
{
function onAppReady() {
if( navigator.splashscreen && navigator.splashscreen.hide ) { // Cordova API detected
navigator.splashscreen.hide() ;
}
// init admob
initAdMob();
}
document.addEventListener("app.Ready", onAppReady, false) ;
});
};
};
This is where I got most my info: https://github.com/floatinghotpot/cordova-admob-pro/wiki/02.-How-to-Use-with-Intel-XDK
Its not working, not sure where I went wrong.