positioning a player in the map correctly

Started by
3 comments, last by ill 14 years, 9 months ago
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
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.
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
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
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.

This topic is closed to new replies.

Advertisement