eugenioclrc Posted May 21, 2014 Share Posted May 21, 2014 Hi i am trying to implement some simple half squares in my tilemap but only using the arcade physics. I have do it with the ninja physics, but they look a bit complex and inefficient, especially in big maps. Does anyone got a workaround?Do i have just to write a custom isColliding function for the slopes? Link to comment Share on other sites More sharing options...
valueerror Posted May 22, 2014 Share Posted May 22, 2014 arcade doesn't support anything else than aabb collision.. so yes - it looks like you would have to rewrite arcade physics on your own.. or just use the mighty "p2" engine.. you can create polygons in "physicseditor" or in "tiled" and automatically create objects that will collide out of it Link to comment Share on other sites More sharing options...
eugenioclrc Posted May 22, 2014 Author Share Posted May 22, 2014 Wow... seems a lot of work. Just another question, could the P2 system make my game slow?, here is the demo;http://msemelman.github.io/pirate-ninja-zombie-soldier/ Its a platform game, move around with WASD, you can aim an shoot with the mouse and pressing space bar you activate the turbo. Any code advice you give will be grateful welcome! Link to comment Share on other sites More sharing options...
lewster32 Posted May 22, 2014 Share Posted May 22, 2014 Correct me if I'm wrong, but I believe Ninja physics represents a half-way house between Arcade and P2, adding in slope handling. It certainly seems that way from the examples. Link to comment Share on other sites More sharing options...
valueerror Posted May 22, 2014 Share Posted May 22, 2014 p2 physics will definitely be more resource hungry IF you use all those expensive methods it provides.. your platformer example is a very simple one.. you will not see any performance issues when switching to p2 but there are very expensive features in p2 like impact-events for example .. you don't need them because you can always use onBeginContact instead.. and of course calculating the collision of a polygon body will be more expensive than a simple aabb calculation.. but you don't have to make extensive use of polygons.. you could just go with rectangles or circles for your player/enemies if that's good enough and use polygons only for the ground... i made this fully commented example where you can have a look at a tilemap created with tiled and polygons with p2 physics...http://www.html5gamedevs.com/topic/6556-how-to-export-from-tiled-and-integrate-into-phaser/?p=39495 Link to comment Share on other sites More sharing options...
eugenioclrc Posted May 26, 2014 Author Share Posted May 26, 2014 It had take me some time, but i think i got it! Proof When its ready i will upload the code. Link to comment Share on other sites More sharing options...
ZoomBox Posted May 26, 2014 Share Posted May 26, 2014 Nice work man. Link to comment Share on other sites More sharing options...
eugenioclrc Posted May 26, 2014 Author Share Posted May 26, 2014 Its not the final ver but you could see it working here;http://eugenioclrc.github.io/super-mean-boy/ Code:https://github.com/eugenioclrc/super-mean-boy Link to comment Share on other sites More sharing options...
eugenioclrc Posted May 29, 2014 Author Share Posted May 29, 2014 I have send the pull request to phaser dev branch; https://github.com/photonstorm/phaser/pull/856 All the feedback will be gratefully recibed! Link to comment Share on other sites More sharing options...
eugenioclrc Posted June 3, 2014 Author Share Posted June 3, 2014 More working code! I manage to add slope map in arcade physics with a simple "plugin";https://github.com/eugenioclrc/super-mean-boy/blob/master/js/Arcade.slopes.js Here is a working sandbox game;http://eugenioclrc.github.io/super-mean-boy/ Link to comment Share on other sites More sharing options...
wayfinder Posted June 3, 2014 Share Posted June 3, 2014 I'm looking to add slope functionality to my game as well (100% and 50% slopes), but I'm not sure I completely understand how your approach works. Could you do a quick walkthrough maybe, or comment the code? That would be super helpful. Thanks! Link to comment Share on other sites More sharing options...
renatodarrigo Posted July 3, 2014 Share Posted July 3, 2014 This is great. Thanks for sharing! Link to comment Share on other sites More sharing options...
Recommended Posts