Sign in to follow this  
hugo

mummy exmple

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();    }}

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.