Jump to content

Add Pixel Perfect Collision to something users can draw


Vivek Agrawal
 Share

Recommended Posts

Hi, 

So guys I am trying to understand how this game, https://play.google.com/store/apps/details?id=com.game5mobile.lineandwater can be done in Phaser. In this game, you can draw a line (can be curved) and once you finish drawing, it gets a physics body which has a perfect collision. I dont think I can do this in arcade physics but in p2 physics also its seems impossible because there is no way to do a predetermined shape.

What else can be done to implement such feature?

Thanks

Vivek

Link to comment
Share on other sites

4 hours ago, Vivek Agrawal said:

Hi, is the game live, can I see it please? Also if its okay with you, can you please share your code where you use physical circles and rectangles.

Thanks

 http://antongames.com/games/dunk/
 

It uses Box2D physic engine.  If you know this engine you will no need help to make circles and rectangles.  

Link to comment
Share on other sites

3 hours ago, AntonBel said:

 http://antongames.com/games/dunk/
 

It uses Box2D physic engine.  If you know this engine you will no need help to make circles and rectangles.  

oh very nicely done, so if it the concept works with Box2D, then it should work with p2 as well right? Please correct me if I am wrong, but as player moves mouse you spawning circles to create your line, and since its just a circle you can just have a collider to it.

While it works great in your scenario since you are only using them as collider, but what if like the happy glass game you have to give other effects like gravity, let it move because of a collision etc. Can you please suggest something that we can do to make it work that way?

Thanks a lot for your help

Link to comment
Share on other sites

4 hours ago, Vivek Agrawal said:

oh very nicely done, so if it the concept works with Box2D, then it should work with p2 as well right? Please correct me if I am wrong, but as player moves mouse you spawning circles to create your line, and since its just a circle you can just have a collider to it.

While it works great in your scenario since you are only using them as collider, but what if like the happy glass game you have to give other effects like gravity, let it move because of a collision etc. Can you please suggest something that we can do to make it work that way?

Thanks a lot for your help

I create circles and rectangles. Do not know p2 engine.  I suggest you to learn physic engine much better to make such type of game. 

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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