Sakthivadivel Posted October 13, 2017 Share Posted October 13, 2017 Hi All, I have developed a game using phaser JS. In which I want to move sprites from right to left .I done it with sprite.body.velocity.x (Decrease sprite's x value in update() also works fine).It moves fine. But while moving it is not smooth , the sprites look shaking How to overcome this. Please anyone help me. Thanks, Sakthi Link to comment Share on other sites More sharing options...
WiLD11 Posted October 14, 2017 Share Posted October 14, 2017 I'm assuming you're doing spritesheet animation along with the movement. 99% of the times a sprite would shake if it's part of a spritesheet is the way it is positioned in the spritesheet, maybe the frame is offset by a few pixels in the spritesheet making it look shaky. Otherwise I would encourage you to make bodies visible and see if it has anything to do with your movement code. Sakthivadivel 1 Link to comment Share on other sites More sharing options...
Sakthivadivel Posted October 16, 2017 Author Share Posted October 16, 2017 Hi WiLD11 , Thanks for your reply.But I'm not doing any spritesheet animation with that particular sprite. I just loaded a png image and created group of sprites as follows. game.load.image('enemy', 'assets/images/enemies.png'); enemies = game.add.group(); enemies.enableBody = true; enemies.physicsBodyType = Phaser.Physics.ARCADE; enemies.setAll('checkWorldBounds', true); enemies.setAll('outOfBoundsKill', true); var enemy=enemies.create(1220,game.rnd.realInRange((50),(game.world.height-350)), 'enemy', 0); enemy.body.velocity.x = -1000; Thanks, Sakthi. Link to comment Share on other sites More sharing options...
WiLD11 Posted October 16, 2017 Share Posted October 16, 2017 15 hours ago, Sakthivadivel said: Hi WiLD11 , Thanks for your reply.But I'm not doing any spritesheet animation with that particular sprite. I just loaded a png image and created group of sprites as follows. game.load.image('enemy', 'assets/images/enemies.png'); enemies = game.add.group(); enemies.enableBody = true; enemies.physicsBodyType = Phaser.Physics.ARCADE; enemies.setAll('checkWorldBounds', true); enemies.setAll('outOfBoundsKill', true); var enemy=enemies.create(1220,game.rnd.realInRange((50),(game.world.height-350)), 'enemy', 0); enemy.body.velocity.x = -1000; Thanks, Sakthi. Could you post a gif/video of whats happening? Sakthivadivel 1 Link to comment Share on other sites More sharing options...
Sakthivadivel Posted October 20, 2017 Author Share Posted October 20, 2017 Hi WiLD11 , Thanks. I'm Sorry for the late reply. I have added a recording video of the game. You can see the shake on all the sprites while moving , including tilesprites (Changing tile position) Thanks, Sakthi. sprite_shake.mp4 Link to comment Share on other sites More sharing options...
Sakthivadivel Posted October 27, 2017 Author Share Posted October 27, 2017 Hi WiLD11 , Have you looked into this?. Thanks, Sakthi. Link to comment Share on other sites More sharing options...
Recommended Posts