Jump to content

Problem with tween path animation


Recommended Posts

Hi, my name is Thiago


I'm very new with Phaser, i've completed the first game tutorial and as the tutorial proposed i'm trying to increment the other features,

but i'm having big trouble with the baddies.


I created them, set their postions and now i'm trying to make them move around so i make this basic tween


   baddie.x = 600;

   var tween = game.add.tween(baddie).to({x: 400}, 4000, Phaser.Easing.Linear.None, true,0,1000,true);
it makes him walk on the ledge, works ok but i cant find a way to add the animations, i set them like this
baddie.animations.add('right',[0,1],10, true);
I know its a very newbie question, and dont get me wrong, i have searched a lot before ask for help here, so if u can help it will
be really great


Link to comment
Share on other sites

Are you trying to play the animation? That's "baddie.play('right');".


Also, if you tween a Sprite instead of moving it with physics it won't collide with other sprites. If that's not what you want, try setting "baddie.body.velocity.x = 100;" and see what happens. Don't forget to enable physics on the sprite first like so (for Arcade physics, a good starter): "Phaser.Physics.Arcade.enable(baddie);"

Link to comment
Share on other sites


  • Recently Browsing   0 members

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