Advice needed for 2D explosions
I am learning game programming and am working on my first game - 2D using Direct3D8. I''m wondering about producing an explosion on screen when a collision occurs between 2 of my game objects.
I thought I''d try using a single bitmap with a number of different explosion images and render them frame by frame in sequence. So far I''ve only used single image files - loading the whole bitmap on a texture quad. I''m not sure how I''d go about loading each little cell.
This is how I''m gonna try it but I''d like to know if anyone could advise me if I''ve missed the point of how to load lots of images in sequence off one bitmap or if there''s a better way.
Initialisation:
1.work out the position of each image on the bitmap so that I have appropriate u and v coordinates for each one.
2.Create an array of vertex buffers, one for each explosion image in the sequence.
3. Loop through each vertex buffer - lock, set vertices, increment u and v values as appropriate for required image, unlock, fill buffer.
Main Game Loop:
1.If collision true render first vertex buffer in the array of vertex buffers.
2.In each subsequent frame render next vertex buffer etc.
Any advice or a pointer to how to info would be welcome, thanks
GZ
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement