Miezel Posted July 7, 2016 Share Posted July 7, 2016 Hello, I have been trying to use the build in tweening from phaser with a box2d Sprite but didn't have much luck with it. I used this box2d example , turned off gravity and added the tween line. blockSprite = game.add.sprite(400, 200, 'block'); game.physics.box2d.enable(blockSprite); blockSprite.body.angle = 30; game.add.tween(blockSprite).from( { y: -200 }, 2000, Phaser.Easing.Bounce.Out, true); Can anyone tell me what I'm doing wrong here ? Thanks. Link to comment Share on other sites More sharing options...
Tom Atom Posted July 7, 2016 Share Posted July 7, 2016 Hi, just change last line to: game.add.tween(blockSprite.body).from( { y: -200 }, 2000, Phaser.Easing.Bounce.Out, true); to tween body instead of sprite. But, be aware, that tween might fight with physics applied to your dynamic body. If you want to tween physical body, then better make it kinematic instead of dynamic: blockSprite.body.kinematic = true; Link to comment Share on other sites More sharing options...
Miezel Posted July 8, 2016 Author Share Posted July 8, 2016 (edited) great thanks it works apparently now it is should be kinetic instead of kinematic. blockSprite.body.kinetic = true; Edited July 9, 2016 by Miezel clarification Link to comment Share on other sites More sharing options...
Recommended Posts