Vivek Agrawal Posted February 25, 2019 Share Posted February 25, 2019 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 More sharing options...
gonzos Posted February 25, 2019 Share Posted February 25, 2019 I was just thinking about this few days ago. This is the result: http://coffeebreakplayground.com/coffeegames/cdktest/ This is haxe implementation. I convert code from As3 https://code.google.com/archive/p/collisiondetectionkit/downloads. I believe you can adjust it to work with JS. Link to comment Share on other sites More sharing options...
AntonBel Posted February 25, 2019 Share Posted February 25, 2019 I did such game. Drawing line by finger. Just use physical circles and rectangles. Link to comment Share on other sites More sharing options...
Vivek Agrawal Posted February 26, 2019 Author Share Posted February 26, 2019 22 hours ago, AntonBel said: I did such game. Drawing line by finger. Just use physical circles and rectangles. 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 Link to comment Share on other sites More sharing options...
AntonBel Posted February 27, 2019 Share Posted February 27, 2019 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 More sharing options...
Vivek Agrawal Posted February 27, 2019 Author Share Posted February 27, 2019 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 More sharing options...
AntonBel Posted February 27, 2019 Share Posted February 27, 2019 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 More sharing options...
Recommended Posts