Sign in to follow this  
Vivek Agrawal

Add Pixel Perfect Collision to something users can draw

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

Share this post


Link to post
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.  

Share this post


Link to post
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

Share this post


Link to post
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. 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.