Modify a texture by pixels

Started by
3 comments, last by Servant of the Lord 16 years, 1 month ago
Hi! I want to implement explosives weapons in my game like C4. To draw my map, I'm using the ID3DXSprite interface with one texture (which contains tiles : grass, wall etc). To be more realistic, I want that the wall could be destructible by pixels not by tiles (not like bomberman). So, for destructible objects in the game, I will create a class which contains a texture (LPDIRECT3DTEXTURE9) and others properties. But I want to know how to modify a texture by pixels. Or if my method is wrong, how can I proceed ? Thanks for all !
Advertisement
You can read this SDL tutorial, which does simular to what you want.
I don't know anything about DirectX, and so I can't help in that regard.
Printing an explosion decal over the terrain would actually be way faster than changing the color of the pixels one by one.
Ok, but I don't see how to draw the decal only on the destructible objects. I mean, if there are others tiles around.



Thanks for the help :)
Don't draw it over the object when on the screen. Draw it over the object in memory itself. Draw it over the texture, or the texture's alpha layer. (Or create a mask for it, and draw onto the mask)

This topic is closed to new replies.

Advertisement