Search the Community
Showing results for tags 'xdk'.
-
I have built a game in phaser (html5) , and packed it using crosswalk because the webview kit on versions below kitkat are not able to run the app properly. So I used intel xdk and crosswalk to build my apk. It worked perfect for me. But this being my first android project I am not familiar with monetizing techniques. I tried admob integration using cordova plugin , but the ads dont show up. Needed help with that. heres my index.html <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>xyz</title> <script src="libs/phaser.min.js"></script> <meta name="mobile-web-app-capable" content="yes"> <meta name="viewport" content="width=device-width"> <script src="Boot.js"></script> <script src="MainMenu.js"></script> <script src="PlayGame.js"></script> <script src="PostGame.js"></script> <script src="HighScores.js"></script> <script src="Help.js"></script> <script src="about.js"></script> <script type="text/javascript" src="cordova.js"></script> <style type="text/css"> body { width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden; background-color: gray; color: white; } div#fullpage { width: 100%; height: 100%; margin: 0; padding: 0; border: 0px solid red; text-align: center; vertical-align: middle; } button { font-size: 18px; } </style> </head> <body onload="onLoad()" onresize="onResize()"> <script> function onLoad() { if(( /(ipad|iphone|ipod|android)/i.test(navigator.userAgent) )) { document.addEventListener('deviceready', initApp, false); } else { initApp(); } } var ad_units = { android : { banner: 'ca-app-pub-6128098175931507/1770967078', interstitial: 'ca-app-pub-6128098175931507/3097766271' } }; var admobid = ( /(android)/i.test(navigator.userAgent) ) ? ad_units.android : ad_units.android; function initApp() { if (! AdMob ) { alert( 'admob plugin not ready' ); return; } initAd(); // display the banner at startup AdMob.createBanner( admobid.banner, function(){}, function(data){alert(JSON.stringify(data));} ); } function initAd(){ var defaultOptions = { bannerId: admobid.banner, interstitialAdId: admobid.interstitial, adSize: 'SMART_BANNER', // width: integer, // valid when set adSize 'CUSTOM' // height: integer, // valid when set adSize 'CUSTOM' position: AdMob.AD_POSITION.BOTTOM_CENTER, // x: integer, // valid when set position to 0 / POS_XY // y: integer, // valid when set position to 0 / POS_XY isTesting: false, // set to true, to receiving test ad for testing purpose autoShow: true // auto show interstitial ad when loaded, set to false if prepare/show }; AdMob.setOptions( defaultOptions ); } </script> <style> body { padding: 0; margin: 0; background-color: #FFFFFF; } </style> </head> <body> <div id="Game container"></div> <script type="text/javascript"> window.onload = function() { var game = new Phaser.Game( 675, 1200, Phaser.Auto, "Game container"); game.state.add('Boot', xyz.Boot); game.state.start('Boot'); // Boots the game using the mainmenu.js method() which also calls the preloader() } </script> </body> </html>
-
I am doing some comparing of mobile application options. Thought maybe someone might mention if I am way off in the wrong direction (usually when I start these threads it is more of a conversation with myself ). As it relates to using either of the deviceorientation cameras in BJS, the environment must support the 2, orientationchange & deviceorientation, window events. I cannot seem to get any direct search hits for "WKWebView deviceorientation". WKWebView is the iOS class where your html5 is embedded. I am seeing crosswalk directly supports W3C DeviceOrientation Events, so Android looks good. I am wondering if using this plugin could be done? It's callback is just navigator.compass.getCurrentHeading, that can be done on a specified frequency. It does not look like I could sub-class babylon.freecamera.input.deviceorientation.ts, but thinking it could be replicated. Cameras like babylon.deviceOrientationCamera.ts could definitely be sub-classed by changing one line in the constructor, though. Is this completely insane, because of "..."?
-
<!doctype html> <html> <head> <meta charset="UTF-8" /> <title>M N B</title> <script src="js/phaser.js"></script> </head> <body> <script type="text/javascript"> window.onload = function() { var width = window.screen.width; var availwidth = window.screen.availWidth; var height = window.screen.height; var availheight = window.screen.availHeight; var textStyle = { font: "20px Arial", fill: "#ffffff"}; var game = new Phaser.Game(availwidth , availheight, Phaser.AUTO, '', { preload: preload, create: create, update: update }); function preload () { //game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; game.load.image('red','assets/red.png'); game.load.image('green','assets/green.png'); } function create () { game.stage.backgroundColor = "000000"; var graphics = game.add.graphics(0,0); graphics.lineStyle(1,0xffffff,1); var box_width = (availwidth/10)-5; var box_height = (availheight/10)-5; last_start = box_width*10; last_end = box_height*10; //draw vertical lines for(var i=0;i<=last_start;i+=box_width){ graphics.moveTo(i,0); graphics.lineTo(i,last_end); } //draw horizontal lines for(var j=0;j<=last_end;j+=box_height){ graphics.moveTo(0,j); graphics.lineTo(last_start,j); } } function update(){ } }; </script> </body> </html> When I run the above code, and emulate it in Google Nexus 7 using Intel XDK, it does not show the last horizontal line (image below) On the other hand, when I emulate it in Apple Ipad (image below), it shows the complete grid perfectly (even though I need to scroll down to see the last line) Ques 1: Why is the above difference coming? Ques 2: Why is there a scrollbar coming when I am scaling the content properly? Thanks in advance.
-
Hi, Just finished my first Phaser game - PixToy (now available for free in Play store and App store). My 10 year old daughter contributed with the artwork ;-) It has 3 game modes of which the 'gamer' mode could be challenging even for grown-ups.. it's a universal app but best played on a tablet Phaser really rocks ! Link to game site : http://n-vision.nl/pixtoy (has links to the app stores)