How To Explode A Sprite In C

May 20, 2020 at 06:43:49
Specs: Windows 10
Hi,

As I am programming a paratrooper style game in Turbo C Ver, i need a code to explode the helicopters when hit by a bullet in a realistic way. I am looking for the similar simulation as programmed by Mr. Greg Kuperberg in his game ‘paratrooper’ in 70s!. I have almost completed all other graphic routines but stuck up in this rendering. I am confused with all details available in the net for ‘particle explosion’ as they are either too complex to understand or have written in other languages which i am not comfortable with.

I have given an extract of sample code for illustration purpose. The purpose is to explode this array “SPRITE_IMAGE”. This image consists of three colours, Blue, Yellow and White. I know how to animate the sprite to different locations of screen but not sure how to code for exploding this spite so that it falls down with velocity and gravity. Any simple method to do this since its a 2D game?

//Mode 13h programming in C
//Particle Explosure / Sprite Explosion
//This is not a complete code.
#define SCREEN_WIDTH 320
#define"> SCREEN_HEIGHT 200
#define SCREEN_SEGMENT 0xA000

char SPRITE_IMAGE[] =
//A Simple Array Image of Blue(11), Yellow(14) and White(15)
{
//6 x 6 array.
11,11,11,11,11,11,
11,14,14,14,14,11,
11,14,15,15,14,11,
11,14,15,15,14,11,
11,14,14,14,14,11,
11,11,11,11,11,11,
};

*MySpriteImage = SPRITE_IMAGE; // pointer to sprite image.

typedef struct
{
int x, y, velocity, gravity etc.......;
} Sprite;

// Please help to complete with code or suggest some idea.


See More: How To Explode A Sprite In C

Reply ↓  Report •
Related Solutions


Ask Question