In my game, every tile is a 32x32 texture. All the slopes are a 0 - 45 degree angle. I would like to determine, at the time I load the tile, if the is sloped by examining its texture/bitmap data. How can I do this?
Tell me more
×
Game Development Stack Exchange is a question and answer site for
professional and independent game developers. It's 100% free, no registration required.
|
Under this assumption, and that other non-slope tiles won't have strange variations, the simplest solution I can think of is the following.
If you're using alpha transparency on your tiles, you can check if a pixel is empty by seeing if its alpha value is 0. In pseudocode:
As for getting the color at specific pixel on a texture, check the OpenGL API. |
|||||
|
