Jump to content
  • Advertisement
Sign in to follow this  
dinbrca

positioning a player in the map correctly

This topic is 3282 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i have a map and a player: Free Image Hosting at www.ImageShack.us and what i need to do is to place the player (the blue stick man) in the map correctly and i need to rotate the player correctly too.. i have an code i created but in order to use it i need to check the position of each pixel in the black border (my code uses a basic trigonometry in order to position the player).. can someone help me? or find me another way to pass this? thanks for the helpers

Share this post


Link to post
Share on other sites
Advertisement
Since your ground seems to be made up of simple straight line segments, just store information about the line segments and use it to determine the "height" of the ground at the player's horizontal position.

Share this post


Link to post
Share on other sites
how is the data stored right now for your level? You should be able to leverage this to figure out where you can/can't place the player in the map

Share this post


Link to post
Share on other sites
i dont think i understood u both very good but let me explain u again:
the black border and the brown map are a texture 2d and are combined together
what i need to do is to know each black pixel position on the map in order to position the player correctly on the map

+ zahlman
this map is only and example my real map will be made not only from straight lines
as u can see a little right from the center of the map there is something like a hill, this means i will need to rotate the player correctly on the map too

Share this post


Link to post
Share on other sites
So are you having problems with figuring out how to do the collision detection or what?

So far sounds like you just need to use pixel perfect collisions between the player and the terrain. It may be a little more inefficient than some other ways you could do it but that so far seems to be all I can suggest unless you already have that. I don't see what else the problem could be unless I misunderstood the question.

A simple way to detect the slope the player is standing on is check the height at one end and the height at the other end relative to the player. How you rotate the player is up to you.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!