totallybueno Posted August 4, 2017 Share Posted August 4, 2017 Hi there, I have a basic game where the player jumps from a building and must fall into different platforms during the falling to avoid crashing directly with the ground. The thing is that those platforms should have some bounce, I mean, when the player falls into those platforms, it should rebound like if they were some kind of elastic stuff... the problem is that as the platform has body.immovable = true it seems that body.bounce is not working at all, and I can´t apply body.bounce to the player because he should rebound only on those platforms, not on every single object. I have the world with a global gravity and those platforms immovable and with their gravity.y = -that global gravity, is this the best way to to this? Any other way to create purely static objects? Link to comment Share on other sites More sharing options...
Milton Posted August 4, 2017 Share Posted August 4, 2017 body.kinematic = true; ? Link to comment Share on other sites More sharing options...
totallybueno Posted August 4, 2017 Author Share Posted August 4, 2017 With Arcade Physics? I don´t see that on the docs... Link to comment Share on other sites More sharing options...
Milton Posted August 4, 2017 Share Posted August 4, 2017 That's why I added a question mark I don't use Phaser, so I was just guessing. Link to comment Share on other sites More sharing options...
totallybueno Posted August 4, 2017 Author Share Posted August 4, 2017 Hahahaha, ok, well, I thought you knew Phaser as this is on the Phaser forum Link to comment Share on other sites More sharing options...
Milton Posted August 4, 2017 Share Posted August 4, 2017 Yeah, I just look at all unread topics. Would be nice if I could filter forums, I'm not interested in Babylon for instance, while that one does take up most space... Link to comment Share on other sites More sharing options...
samme Posted August 4, 2017 Share Posted August 4, 2017 In Arcade Physics immovable means it can't be moved by collisions. So no bounce. For platforms, remove immovable and gravity and use instead: platforms.setAll('body.allowGravity', false); platforms.setAll('body.bounce.y', 0.5); But if you want an elastic effect that returns the platform into place, you should lock all movement and use a tween instead of body.bounce: platforms.setAll('body.moves', false); totallybueno 1 Link to comment Share on other sites More sharing options...
totallybueno Posted August 7, 2017 Author Share Posted August 7, 2017 On 4/8/2017 at 5:25 PM, samme said: In Arcade Physics immovable means it can't be moved by collisions. So no bounce. For platforms, remove immovable and gravity and use instead: platforms.setAll('body.allowGravity', false); platforms.setAll('body.bounce.y', 0.5); But if you want an elastic effect that returns the platform into place, you should lock all movement and use a tween instead of body.bounce: platforms.setAll('body.moves', false); @samme thanks, that´s what I needed! The bounce is now working properly, even with a bouce.y = 1 I can see a tiny tiny movement, I guess something else is affecting this, but anyway, the platform thing is working and with a player.body.velocity.y =-500 y can make that rebound effect... so, fixed, thanks for your help Link to comment Share on other sites More sharing options...
Recommended Posts