TimTation Posted August 8, 2014 Share Posted August 8, 2014 Hello all!I am currently working on modifying source-code for a tutorial by this fine fellow.I am working to make the example game he has created into an idle clicking game… like Cookie Clicker etc.I took the phaser example number 2 (Clicking an image) and attempted to re-write it accounting for my game using states…I have not been successful Code:Candy.Game = function(game){// define needed variables for Candy.Game};Candy.Game.prototype = {create: function(){this.stage.backgroundColor = '#fff';this.image1 = this.add.image((Candy.GAME_WIDTH)/2, (Candy.GAME_HEIGHT)/2, 'monster-cover');this.image1.anchor.set(0.5);this.image1.inputEnabled = true;this.text = this.add.text(250, 16, '', { fill: '#B4D9E7' });//this.image1.events.onInputDown.add(listener, this); //This line is where the game stops working},listener: function(){counter++;text.text = "You clicked " + counter + " times!";},update: function(){},};Any help / tips are greatly appreciated Thanks in advance! - TimTation Link to comment Share on other sites More sharing options...
Dumtard Posted August 9, 2014 Share Posted August 9, 2014 this.image1.events.onInputDown.add(this.listener, this);You will run into a similar issue in your listener function. Link to comment Share on other sites More sharing options...
TimTation Posted August 11, 2014 Author Share Posted August 11, 2014 Thanks Dumtard you wonderfull person you Link to comment Share on other sites More sharing options...
Recommended Posts