JamesJam Posted January 24, 2015 Share Posted January 24, 2015 What is the best approach to reset sprite to original frame 0 after the "dude" sprite leave the "step" sprite?As far as I tried, the "dude" left the steps sprite to other frame numbers which feel like a glitch.function preload() { game.load.spritesheet('steps', 'steps.png', 100, 100);}function create() {game.world.setBounds(0, 0, 20000, 580)game.physics.startSystem(Phaser.Physics.ARCADE)cursors = game.input.keyboard.createCursorKeys()for(...){group.create(i*100, 150, 'steps')}}function overlapDetect(o,o1){ console.log("overlap",o1)}function update(){ game.physics.arcade.overlap(dude, group, overlapDetect, null, this);}if (cursors.up.isDown){} else if (cursors.down.isDown){}if (cursors.left.isDown){ dude.body.velocity.copyFrom(game.physics.arcade.velocityFromAngle(dude.angle, -300));}else if (cursors.right.isDown){ dude.body.velocity.copyFrom(game.physics.arcade.velocityFromAngle(dude.angle, 300));} Link to comment Share on other sites More sharing options...
Recommended Posts