Jump to content

why cannot call function in button?


sinanqd10
 Share

Recommended Posts

var diff,

    increase_end_angle = 0,

    start_angle = 1.5 * Math.PI,end_angle = 2 * Math.PI,

    startTime = (new Date()).getTime(),

circleTimer;

create: function {

    button =  this.game.add.button(0,0,'btnNext', this.start,this);

},

circleTimer: function () {

            var graphics = game.add.graphics(0, 0);         

            diff = (new Date()).getTime() - startTime;

            diff = diff / 60000; //60000ms = 60s            

            increase_end_angle = start_angle + end_angle * diff + reduce;                     

            graphics = game.add.bitmapData(80,80);

            graphics.context.fillStyle = '#D24545';

            graphics.context.beginPath();             

            graphics.context.arc(x,y,radius,start_angle,increase_end_angle,false);

            graphics.context.lineTo(x,y);

            graphics.context.fill();       

            graphics.context.closePath();

            game.add.image(13, 8, graphics);

},

start: function () {

    circleTimer = setInterval(this.circleTimer, 200);

},

update: function() {

   if(diff > 1 ) {

        clearInterval(circleTimer);

   }

},

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...