dchhetri Posted December 1, 2013 Share Posted December 1, 2013 I have a sprite sheet what I want todo is when I press left or right key I want the sprite to animate to dx distance. Can someone give me an example on how achieve this? Currently this is what I have//in preload//load in example sprite sheet this.game.load.spritesheet('ms', './res/assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);//in createsprite.animations.add('walk');//in update if (cursors.left.isDown){ sprite.scale.x = -1; //this inverts the image to face left //stuck here, basically want to animate sprite walking for dx distance sprite.body.velocity.x = -150;}hope its clear on what question I'm asking. Any help would be appreciated. Link to comment Share on other sites More sharing options...
owzim Posted December 4, 2013 Share Posted December 4, 2013 Have you seen the example?: http://gametest.mobi/phaser/examples/_site/view_full.html?d=animation&f=looped+animation.js&t=looped%20animation Link to comment Share on other sites More sharing options...
dchhetri Posted December 4, 2013 Author Share Posted December 4, 2013 Nice thanks, after playing around I figured out a decent solution which seems to work well. Link to comment Share on other sites More sharing options...
mblox Posted January 4, 2016 Share Posted January 4, 2016 can you share the solution? Link to comment Share on other sites More sharing options...
Recommended Posts