Sign in to follow this  
dinbrca

positioning a player in the map correctly

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
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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this