I have read somewhere that sprites can detect the background color, but I don't remember where and how it's working. What I'm trying to do is just a function to detect if the sprite is on a special surface, that has a special color, instead of using collision dedection between objects. Help is preciated! Thanks!
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.
|
You can render your entire scene to a render target instead of directly to screen. A render target is also a texture and you can query the color of each pixel by getting the data from the texture. See this StackOverflow answer on how to get the color of a pixel in a texture. Notes:
Other resources: You can find a tutorial for XNA here that uses a texture as a color key for collision detection. A lot of the techniques you need are explained there in detail so be sure to check it out! |
|||||
|