Sign in to follow this  
rickbross

How do you create a map from a set of verticies

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.