hugo Posted April 20, 2014 Share Posted April 20, 2014 how can i change the mummy direction on the mummy example http://examples.phaser.io/_site/view_full.html?d=sprites&f=add+several+sprites.js&t=add%20several%20sprites mummy walks right to left here's the code function create() { releaseMummy();}function releaseMummy() { var mummy = game.add.sprite(-(Math.random() * 800), game.world.randomY, 'mummy'); mummy.scale.setTo(2, 2); // If you prefer to work in degrees rather than radians then you can use Phaser.Sprite.angle // otherwise use Phaser.Sprite.rotation mummy.angle = game.rnd.angle(); mummy.animations.add('walk'); mummy.animations.play('walk', 20, true); game.add.tween(mummy).to({ x: game.width + (1600 + mummy.x) }, 20000, Phaser.Easing.Linear.None, true); total++; timer = game.time.now + 100;}function update() { if (total < 200 && game.time.now > timer) { releaseMummy(); }} Link to comment Share on other sites More sharing options...
adamyall Posted April 20, 2014 Share Posted April 20, 2014 You can flip a sprite horizontally by setting it's x scale to be negative.For instance, change this:mummy.scale.setTo(2, 2);To:mummy.scale.setTo(-2,2); Link to comment Share on other sites More sharing options...
hugo Posted April 21, 2014 Author Share Posted April 21, 2014 You can flip a sprite horizontally by setting it's x scale to be negative.For instance, change this:mummy.scale.setTo(2, 2);To:mummy.scale.setTo(-2,2);doesn't worki want the mummies to appear in the right side and disappear on the left side Link to comment Share on other sites More sharing options...
Recommended Posts