I am new to this list, so hello to everyone. I am quite inexpeienced with regards to c++ programming, so please bear with me, and if you have any suggestions or advice please don’t hesitate to let me know.
I am having a problem, in that I don’t know how to achieve pixel perfect sprite collisions. I have irregular shape images stored as bmp files with a background colour, which is set at Alpha using the RGB values and the relevent SDL function. The sprite system I am using is from the cone3d tutorials, located at http://cone3d.gamedev.net/cgi-bin/index.pl?page=tutorials/gfxsdl/tut3 . I think I understand the code I am using, so in that respect I am OK. The .bmp sprite frames are loaded into an array an of sdl surfaces and accessed through references to the struct they are stored in. There is a class for the sprite base, which holds the frames of the images and their associated times to pause between frames. There is also a class for each sprite, holding various data.
I have read examples of other sprite collisions using pixel perfect detection, and I understand that they access the pixel data of the overlap of the image RECTs and loop through every pixel in the overlapping rectangle, comparing pixel data each time to check for 2 non-alpha pixels. I do not know how to access the pixel data of the image files, or in this case I suppose it would be the relevent surface. I do not know how to tell whether the pixel being accessed has the same RGB values as the alpha channel for that surface.
I hope I have made myself clear, please feel free to email me privately if you have any questions.
Can anyone help me? Would I be better of using opengl for this, or is it unneccesary? The style of game I am making is a third-person 1v1 combat game, similar to mortal kombat. Thanks in advance for any help, advice, links, or code examples you show me.
Regards,
James