Jump to content

Phaser what physics for ...?


PhasedEvolution
 Share

Recommended Posts

3 hours ago, Tom Atom said:

Hi, if the effect is not part of gameplay, but visual effect only, then do not use physics for it and do it with tweens.

Look at this game: http://sbc.littlecolor.com/goblinrun/ - it has play button on menu screen, that wobbles every two seconds. Do you need something like this?

 

I am not sure. I want the body of (in this case) a circular sprite to be shaped according to the wobble. The phyisics body would be resized when the wobble happened... Would that happen?

Link to comment
Share on other sites

I haven't used any of the physics in Phaser, but I have done some game physics in the past. If you want to build a physics game that uses soft bodies like the one that tips4design linked to, it looks like you will need to use the P2 physics in Phaser. Each of those circles in that demo are circle rigid bodies, and each of the lines that connect them are springs. Once you have created all the bodies and connected them with springs, you can try changing the springs' stiffness and damping properties to change how stiff or squishy they are.

Link to comment
Share on other sites

13 minutes ago, lumoludo said:

I haven't used any of the physics in Phaser, but I have done some game physics in the past. If you want to build a physics game that uses soft bodies like the one that tips4design linked to, it looks like you will need to use the P2 physics in Phaser. Each of those circles in that demo are circle rigid bodies, and each of the lines that connect them are springs. Once you have created all the bodies and connected them with springs, you can try changing the springs' stiffness and damping properties to change how stiff or squishy they are.

Is it something like this? http://www.emanueleferonato.com/2012/09/21/step-by-step-creation-of-a-box2d-soft-body-blob/

Link to comment
Share on other sites

4 minutes ago, PhasedEvolution said:

Yes, that's pretty much it! You can see that the soft body is build a little differently in Emanuele's tutorial: there is a lot more space than in that Matter.js demo. But, they should both give you squishy things. The important thing is the usage of springs to connect several rigid bodies. In that tutorial they are called joints, but a joint that has the ability to compress or stretch like that can also be called a spring.

Link to comment
Share on other sites

Matter.js is agnostic of the rendering engine you attach to it so it should be possible, however, does it have features you don't have with P2? If your answer to that is no then just use the P2 instance that is already integrated with phaser and save yourself some complexity. Unless you want to fiddle with that complexity of course.

Link to comment
Share on other sites

41 minutes ago, mattstyles said:

Matter.js is agnostic of the rendering engine you attach to it so it should be possible, however, does it have features you don't have with P2? If your answer to that is no then just use the P2 instance that is already integrated with phaser and save yourself some complexity. Unless you want to fiddle with that complexity of course.

I am not really sure... I would like to implement soft bodies, that kind of jelly effect. I was told it could be done with something similar to this   http://www.emanueleferonato.com/2012/09/21/step-by-step-creation-of-a-box2d-soft-body-blob/ ... I didn't find any specific phaser tutorial for that... What do you think?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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