Jump to content

Best Way to Implement These Physics?


RBrNx
 Share

Recommended Posts

Hi there, I am currently making a 2D Mini Golf Game with the help of Phaser. I have uploaded a copy of the image I am using for the "Fairway" so that you can see. I tried using the Arcade Physics so that the ball would roll down the hill and such but I didn't realise that the arcade Physics System only used AABB collision. What would be the easiest way for me to implement collisions with a ball and the attached image?

 

Is there a way for Phaser to ignore the transparent pixels when checking for collision?

 

Thanks, Conor

post-13814-0-03870800-1427810536_thumb.p

Link to comment
Share on other sites

I am in no way an expert, but the best way I can see to get the effect you're aiming for would be using polylines in Tiled, or somthing to that effect.

 

http://www.html5gamedevs.com/topic/5919-how-to-collide-with-a-polygon-created-in-tiled-p2-physics/

 

I personally have always had way more luck with P2 physics then arcade style.

 

Hope this helps! sorry if it doesn't!

Link to comment
Share on other sites

Thank you for your helps guys. I was interested in using the Ninja Physics to solve my problems (With a few tweaks to my image I think I can do it), however I can't seem to get Ninja Physics to work.

 

Whenever I use

 this.game.physics.startSystem(Phaser.Physics.NINJA);

I get the following error 

Uncaught TypeError: undefined is not a function        phaser.js:61692 c.Physics.startSystemgamestate.js:35 gameState.createphaser.js:18360 c.StateManager.loadCompletephaser.js:55951 c.Loader.finishedLoadingphaser.js:55906 c.Loader.processLoadQueuephaser.js:55979 c.Loader.asyncCompletephaser.js:56625 c.Loader.fileCompletephaser.js:56190 c.Loader.loadImageTag.a.data.onload

I have downloaded the Latest Phaser.js and Phaser.min.js from the Download page, should these not have the Ninja Physics Module already included in the code?

 

Thanks, Conor

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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