Jump to content

How do you create a map from a set of verticies


rickbross
 Share

Recommended Posts

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 

post-9260-0-86515800-1427067204_thumb.pn

Link to comment
Share on other sites

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

 Share

  • Recently Browsing   0 members

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