Jump to content

create sprite stuck


vincent.tulip
 Share

Recommended Posts

when i click to create new sprite,it stuck may be 500(ms),

how can i fix it?

 i use Phaser v2.2.2

var names = ["snow1", "snow2", "snow3"];        this.game.input.onDown.add(function () {            var x = this.game.input.mousePointer.x;            var y = this.game.input.mousePointer.y;            console.log("x:" + x);            console.log("y:" + x);            var name=names[Math.floor(Math.random()*3)];            var tmpImage = this.game.add.sprite(x, y,name );            snowsGroup.add(tmpImage);            this.game.physics.arcade.enable([tmpImage]);            tmpImage.body.gravity.y = 200;            tmpImage.checkWorldBounds = true;            tmpImage.outOfBoundsKill = true;        }, this);
Link to comment
Share on other sites

var names = ["snow1", "snow2", "snow3"];        this.game.input.onDown.add(function () {            var x = this.game.input.mousePointer.x;            var y = this.game.input.mousePointer.y;            console.log("x:" + x);            console.log("y:" + x);            var name=names[Math.floor(Math.random()*3)];            var tmpImage = this.game.add.sprite(x, y,name );            //snowsGroup.add(tmpImage);            //this.game.physics.arcade.enable([tmpImage]);           // tmpImage.body.gravity.y = 200;            //tmpImage.checkWorldBounds = true;           // tmpImage.outOfBoundsKill = true;        }, this);

i change this,but the result is no change

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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