intel xdk - Phaser Game Development XDK -


i using xdk phaser html 5 game development. using sample click counter website not working. can me?
here code below:

/* globals phaser:false */ // create basicgame class basicgame = {  };  // create game function in basicgame basicgame.game = function (game) { };  var counter = 0; // set game function prototype basicgame.game.prototype = {      init: function () {         // set input max pointers         this.input.maxpointers = 1;         // set stage disable visibility change         this.stage.disablevisibilitychange = true;         // set scaling method used scalemanager         // valid values scalemode are:         // * exact_fit         // * no_scale         // * show_all         // * resize         // see http://docs.phaser.io/phaser.scalemanager.html full document         this.scale.scalemode = phaser.scalemanager.show_all;         // if wish align game in middle of page can         // set value true. place re-calculated margin-left         // pixel value onto canvas element updated on orientation /         // resizing events. doesn't care other dom element may         // on page, literally sets margin.         this.scale.pagealignhorizontally = true;         this.scale.pagealignvertically = true;         // force orientation in landscape or portrait.         // * set first true force landscape.          // * set second true force portrait.         this.scale.forceorientation(false, true);         // sets callback called when window resize event         // occurs, or if set parent container changes dimensions. use          // handle responsive game layout options. note callback         // called if scalemanager.scalemode set resize.         this.scale.setresizecallback(this.gameresized, this);         // set screen size automatically based on scalemode.         // needed if scalemode not set resize.         this.scale.updatelayout(true);         // re-calculate scale mode , update screen size. applies if         // scalemode not set resize.         this.scale.refresh();      },      preload: function () {          // here load assets required our preloader (in case          // background , loading bar)         this.load.image('logo', 'asset/phaser.png');     },      create: function () {         // add logo center of stage         this.logo = this.add.sprite(             this.world.centerx, // (centerx, centery) center coordination             this.world.centery,             'logo');         // set anchor center of sprite         this.logo.anchor.setto(0.5, 0.5);         this.logo.inputenabled = true;         this.logo.events.oninputdown.add(onclicklistener, this);          //no add text on screen check click counter         this.counterlabel = this.add.text(250, 16, '' , {fill:'ffffff'});       },      onclicklistener: function() {         counter++;     this.counterlabel.text = "you clicked " + counter + " times!";     },      gameresized: function (width, height) {          // handy if need processing if          // game resizes. resize happen if example swapping          // orientation on device or resizing browser window. note          // callback useful if use scalemode of resize          // , place inside main game state.      }  }; 

it throwing exception:

this.logo.events.oninputdown.add(onclicklistener, this);

as onclicklistener sitting in basicgame.game.prototype should this:

this.logo.events.oninputdown.add(this.onclicklistener, this); 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -