Public Group

# positioning a player in the map correctly

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

## Recommended Posts

i have a map and a player: 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 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 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 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 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.

1. 1
Rutin
48
2. 2
3. 3
4. 4
5. 5

• 11
• 16
• 9
• 10
• 13
• ### Forum Statistics

• Total Topics
633004
• Total Posts
3009851
• ### Who's Online (See full list)

There are no registered users currently online

×