rickbross Posted March 22, 2015 Share Posted March 22, 2015 I need to draw a map, export as an array of vertices, and then have a sprite that can jump around in the map. So far I have tried Box2D, but have not been able to figure out how to detect whether or not my sprite is currently touching the map. How do you create a map is p2 physics? Can it be done with vertices like this example in Box2D: http://phaser.io/examples/v2/box2d/car-on-terrain What do you suggest? Thanks,Rick Link to comment Share on other sites More sharing options...
rickbross Posted March 22, 2015 Author Share Posted March 22, 2015 Which physics engine should I use for the map? Which should I use for the character? NOTE: I will eventually want to convert him from a rectangle, to vertices. Link to comment Share on other sites More sharing options...
rickbross Posted March 23, 2015 Author Share Posted March 23, 2015 I think, mainly, I need to figure out how to determine at any moment whether or not the sprite is touching the map. Link to comment Share on other sites More sharing options...
GBeebe Posted March 23, 2015 Share Posted March 23, 2015 Can I ask, real quick, how experienced are you with programming and JavaScript? Link to comment Share on other sites More sharing options...
valueerror Posted March 24, 2015 Share Posted March 24, 2015 first of all.. if you want your player to collide with the map they have to use the same physics system.. you can of course paint such a map in "tiled" editor (using polylines) and then use p2 physics to make an object with physicsbody out of it. you could then use a custom function to determine if the player is touching the ground (i can provide this function for p2 only) BUT the better answer to your first question would probably be.. use directional sensors to figure out if you are touching the ground and where http://phaser.io/examples/v2/box2d/directional-sensors Link to comment Share on other sites More sharing options...
Recommended Posts