excuse me, i want to make explosion in c++.
n i got trouble..
i really dont know the psudocode after i try to make it in paper a whole day.

anybody can help me? i will specially give a thank you if can give me the real program of explosion in c++ because i need it now. urgent..

thx before..

Recommended Answers

All 7 Replies

Huh?

printf( "Boom!!!!!\n" );
playSound("boom.wav");
shellExecute(NULL,"open","boom.mpg",0,0,SW_SHOW);

Or do you want to clarify your requirement, as opposed to clarifying your urgency

Explosion is a rather notorious word these days...
Could you please elaborate on your meanings and intentions?
Oh, Salem, you forgot something...post him your avatar...

mm.. i mean like when a bomb explosion, it has a effect rite? all i want is the effect... sorry my english is not very good.. i'm still pratice.

I'm pretty sure you are going to need some kind of graphic library (sdl probably will do) in order to do what you are talking about.

edit: maybe you'll need a physics engine too.... I vote newton.

I'm pretty sure you are going to need some kind of graphic library (sdl probably will do) in order to do what you are talking about.

first time i'm also think to use graphic library. and i ask my lecture.. but he wont let me use it.. just use #include <constream>

i will gave a example.. i'm already write this program n run succesfully.

# include <constream>
#define MAXSUMBU 43
using namespace std;
using namespace conio;

class SUMBU {
   public :
    int x, y;//, cursumbu;
    
    SUMBU () {
       x = 0; y = 0;
       
    }
};
SUMBU sumbu[MAXSUMBU]; int cur = -1;char c = 249;
void fuse() {
    sumbu[0].x=70;sumbu[0].y=22;
    sumbu[1].x=68;sumbu[1].y=21;
    sumbu[2].x=69;sumbu[2].y=20;
    sumbu[3].x=71;sumbu[3].y=18;
    sumbu[4].x=72;sumbu[4].y=16;  
    sumbu[5].x=71;sumbu[5].y=14; 
    sumbu[6].x=70;sumbu[6].y=13;   
    sumbu[7].x=68;sumbu[7].y=12; 
    sumbu[8].x=67;sumbu[8].y=12; 
    sumbu[9].x=65;sumbu[9].y=13; 
    sumbu[10].x=63;sumbu[10].y=16; 
    sumbu[11].x=61;sumbu[11].y=17; 
    sumbu[12].x=58;sumbu[12].y=16; 
    sumbu[13].x=56;sumbu[13].y=15; 
    sumbu[14].x=55;sumbu[14].y=12; 
    sumbu[15].x=54;sumbu[15].y=9; 
    sumbu[16].x=53;sumbu[16].y=7; 
    sumbu[17].x=51;sumbu[17].y=6; 
    sumbu[18].x=48;sumbu[18].y=5; 
    sumbu[19].x=46;sumbu[19].y=6; 
    sumbu[20].x=44;sumbu[20].y=8; 
    sumbu[21].x=41;sumbu[21].y=9; 
    sumbu[22].x=39;sumbu[22].y=8; 
    sumbu[23].x=38;sumbu[23].y=6; 
    sumbu[24].x=36;sumbu[24].y=5; 
    sumbu[25].x=33;sumbu[25].y=6; 
    sumbu[26].x=31;sumbu[26].y=5; 
    sumbu[27].x=30;sumbu[27].y=4; 
    sumbu[28].x=28;sumbu[28].y=3; 
    sumbu[29].x=27;sumbu[29].y=3; 
    sumbu[30].x=25;sumbu[30].y=4; 
    sumbu[31].x=23;sumbu[31].y=6; 
    sumbu[32].x=20;sumbu[32].y=7; 
    sumbu[33].x=19;sumbu[33].y=6; 
    sumbu[34].x=17;sumbu[34].y=5; 
    sumbu[35].x=14;sumbu[35].y=6; 
    sumbu[36].x=11;sumbu[36].y=5; 
    sumbu[37].x=10;sumbu[37].y=4; 
    sumbu[38].x=8;sumbu[38].y=3; 
    sumbu[39].x=7;sumbu[39].y=3; 
    sumbu[40].x=5;sumbu[40].y=4; 
    sumbu[41].x=4;sumbu[41].y=5; 
    sumbu[42].x=3;sumbu[42].y=7; 
    for (int i=0; i<MAXSUMBU;i++){
      gotoxy(sumbu[i].x,sumbu[i].y); cout<<c;
    };
}
void show_BOM () {
     textcolor(rand()%15 + 1);
     textbackground(0);
     cout << setxy(12,10) << "#######x++++++xX##" << endl 
              << setxy(9,11) << "  .xXXX#=======+x###x####" << endl 
              << setxy(8,12) << "#####XXX###x+x#####x==+=+###" << endl 
              << setxy(7,13) << "X###XXX#X#####XxXXxx##x+++++X#" << endl
              << setxy(6,14) << "XXXXxxxx+-,.,-+xxXx==xXX##x+x++#" << endl
              << setxy(5,15) << "XXXXXxxx+-    ;=xxxx##x=xXX##xxxx" << endl 
              << setxy(5,16) << "XXXXXXxxxxxxxxXxxxXxXX##x=++Xxxxx" << endl
              << setxy(4,17) << "XXXXXXXXXXX#####X#XXXXXX#X####x##x" << endl 
              << setxy(5,18) << "xxXXXxxxxxxxXXXXXXXXXXX####XXX#+" << endl
              << setxy(6,19) << "#XxxXX###XXXXXXXXXX##XXXX+=x#" << endl
              << setxy(7,20) << "#XXXXXXxXX#####XXXXXXxXXX##" << endl 
              << setxy(8,21) << "##X+XXxXxxXXxXXxXXXX####" << endl 
              << setxy(11,22) << "#####xXX+#X#X#####" << endl;     
     
}
int main () {
    fuse(); 
    int flag = 0, color = 14, a; 
    char tombol;
    gotoxy(1,8);
    cout << "    #x##" << endl                
         << "    ,#=Xx  ####X.x#########x" << endl   
         << "       ,###                  ###" << endl // 18 SPACE x = 12, y = 10   
         << "    =###                         ##" << endl // 23 space
         << "   ####                            ##" << endl // 28 space
         << "    ##                              ##" << endl // 30 space y = 13
         << "   ##                                ##" << endl // 32 space
         << "  ##                                 X#" << endl // 33 space
         << " ;##                                 ##" << endl // 33 space y = 16
         << " -#                                  ##" << endl // 34 space
         << "  ##                                ##" << endl // 32 space
         << "  ,##                             ###" << endl // 30 space y = 19
         << "   .##                           ##x" << endl  // 27 space
         << "     X#                        ##x" << endl // 24 space   
         << "       .##                  ##X" << endl //18 space      
         << "             x#############;" << endl;
    do {
       for (a = 1; a <= 15, flag != 1; a++) {
         textcolor(a);
         show_BOM();
         if (a == 9) a = 10;
           _sleep(1);          
         textbackground(0); textcolor(WHITE); cout << setxy(65,23) << "HIT THE SPACE"; _sleep(100);
         textbackground(15); textcolor(BLACK); cout << setxy(65,23) << "HIT THE SPACE";_sleep(100);  
         if (kbhit()) {
            tombol = getch();
            if (tombol == 13) {
               do {
                 show_BOM();
                 textcolor(color);
                 if (color == 4) color = 14;
                 else color = 4;        
                 textbackground(0);
                 cout << setxy(65,23) << "                "; 
                 if ((cur>=0)&&(cur<MAXSUMBU+0)) {  
                    gotoxy(sumbu[cur].x,sumbu[cur].y); cout<<"*"; 
                 } 
                 if ((cur>=1)&&(cur<MAXSUMBU+1)) { 
                    gotoxy(sumbu[cur-1].x,sumbu[cur-1].y); cout<<"."; 
                 }
                 if ((cur>=2)&&(cur<MAXSUMBU+2)) { 
                    gotoxy(sumbu[cur-2].x,sumbu[cur-2].y); cout<<" "; 
                 }
                 if (cur>MAXSUMBU+1) { flag=1; clrscr(); cout<<"Dor....."; getch(); };
                 _sleep(100); cur++;
                 if (kbhit()) { 
                    tombol=getch(); if (tombol==0) tombol=getch();
                    if (tombol==27) flag=1; 
                 };
               }while(!flag);
               //sumbu(0,0); 
               //flag = 1; //getchar();
            }
         }else if (tombol==0) tombol=getch();
            if (tombol==27) flag=1;
       }if (a == 15) a = 1;
         //a++;
    }while(!flag);
    getchar(); 
}

try to look n run it.. all i need is the animation after this program.
this program will show the bom, fuse, n button.. when you press enter, the fuse will moving until it end. n show EXPLOSION..

the problem is, i cant make the animation of EXPLOSION. anyone can help me? thx before..

Have you learned about practical use of loops to shorten(even speed up) code, or passing parameters instead of leaving things out in the global nowhere.

Have you learned about practical use of loops to shorten(even speed up) code, or passing parameters instead of leaving things out in the global nowhere.

already.. whats up with that? ^^

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.