RBrNx Posted March 31, 2015 Share Posted March 31, 2015 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 Link to comment Share on other sites More sharing options...
OscarBraindeaD Posted March 31, 2015 Share Posted March 31, 2015 Hi RBrNx,to create more detailed collision shapes you will need use another physics library, like Box2d. Here is an example of Phaser + Box2d to create a terrain:http://phaser.io/examples/v2/box2d/car-on-terrainMaybe you can use something like it.Hope it helps.Best regards. Link to comment Share on other sites More sharing options...
Lomaz Posted March 31, 2015 Share Posted March 31, 2015 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 More sharing options...
RBrNx Posted March 31, 2015 Author Share Posted March 31, 2015 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.onloadI 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 More sharing options...
RBrNx Posted March 31, 2015 Author Share Posted March 31, 2015 Anyone seen this before? I tried usingthis.game.physics.startSystem(Phaser.Physics.P2JS);And it doesn't give me any errors, not yet anyway. Link to comment Share on other sites More sharing options...
Recommended Posts