Jump to content

mummy exmple


hugo
 Share

Recommended Posts

how can i change the mummy direction on the mummy example
 
 
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

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 work
i want the mummies to appear in the right side and disappear on the left side
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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