ptotheaul Posted November 27, 2017 Share Posted November 27, 2017 I have a sprite that's affected by velocity and gravity. After that sprite is hit I want to swap it with two different sprite but keep the velocity and gravity of the original. The effect I'm going for is like in Fruit Ninja when a fruit is slices and it breaks into two pieces. What is the best way to achieve this? Link to comment Share on other sites More sharing options...
samid737 Posted November 27, 2017 Share Posted November 27, 2017 You could use P2 lockConstraints and break the link of two (half) sprites : Link to comment Share on other sites More sharing options...
ptotheaul Posted November 28, 2017 Author Share Posted November 28, 2017 What I'm doing is really going to be one sprite image that turns into two sprite images. I know there is this: sprite.body.bounce.setTo(1, 1); but I'm wondering if there's already a solution for transferring that bounce energy into two sprites. Link to comment Share on other sites More sharing options...
samme Posted November 28, 2017 Share Posted November 28, 2017 var v = sprite1.body.velocity; sprite2.body.velocity.copyFrom(v); sprite3.body.velocity.copyFrom(v); sprite1.kill(); Link to comment Share on other sites More sharing options...
Recommended Posts