Jump to content

Get restitution (or bounce) impact


PeterBuju
 Share

Recommended Posts

Hello Phaser people,

 

I'm currently working on a game where the player flies around and gets damaged by touching obstacles. What I want to do is damage the player according to the speed that the player crashed into the obstacle with. I see that the restitution (bounce) effect moves the player in the opposite direction according to the "impact". 

 

Is there any way I could get hold of this "impact" value and use it to deal a certain damage to my player ?

 

Best regards

Link to comment
Share on other sites

If you're using Arcade physics, I'm *pretty* sure you want the "sprite.body.overlapX" and "sprite.body.overlapY" properties. I *think* they're set by the time your collision handler runs, not sure how long the value stick around after that though.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...