Ejemplo n.º 1
0
int jump(int i, int random)
{
    readimagefile("Files//Images//game character//black.jpg", 25, 380, 175, 552);
    sprintf(img_game_chr, "Files//Images//game character//Untitled-%d.jpg", i);
    readimagefile(img_game_chr, 25, 270, 175, 442);
    for(jump_stay = 1; jump_stay < 14; ++jump_stay, r++ )
    {
        if(kbhit())
            a = getch();
        sprintf(img_obstacle, "Files//Images//obstacle//Obstacle %02d.jpg", obstacle);
        readimagefile(img_obstacle, random, 485, random + 130, 552);
        sprintf(road, "Files//Images//road//sidebar%d.jpg", r);
        readimagefile(road, 0, 553, 1000, 561);
        random -= 20;
        r %= 6;
        if( random == -80)
            scores += 500;
        else if((random == - 900))
        {
            random = 1000;
            obstacle = rand() % 11;
        }
        delay(dlay);
    }
    a = 0;
    return random + 20;

}
Ejemplo n.º 2
0
void menu()
{
    char img_dog[500], img_chr[500];
    int dog, chr;
    int cordinate = 1000;
    sndPlaySound("Files//Sound//Scream_04.wav", SND_FILENAME | SND_ASYNC);
    delay(1500);
    sndPlaySound("Files//Sound//07 Dog barking For ajaira intro.wav", SND_FILENAME | SND_ASYNC | SND_LOOP);

    for(dog = 1, chr = 1; cordinate > -350; dog++, chr++)
    {
        sprintf(img_chr, "Files//Images//Final R-L//Untitled-%d.jpg", chr);
        readimagefile(img_chr, cordinate - 300, 100, cordinate, 500);
        if(chr == 14)
        {
            chr %= 14;
        };
        delay(20);
        sprintf(img_dog, "Files//Images//Cropped Dog R-L//%d.jpg", dog);
        dog %= 9;
        readimagefile(img_dog, cordinate + 100, 320, cordinate + 300, 520);
        //delay(30);
        cordinate -= 5;
    }

    return;
}
Ejemplo n.º 3
0
void iniciaEntorno()
{
    int i;

    setfillstyle(1, COLOR(79, 182, 225));
    setbkcolor(COLOR(79, 182, 225));
    setcolor(WHITE);

    String nombres[NIMAGENES] = {
        "img/jungla.jpg",
        "img/jungla1.jpg",
        "img/jungla2.jpg",
        "img/jungla3.jpg",
        "img/jungla4.jpg",
        "img/jungla5.jpg",
        "img/creditos.jpg",
        "img/ayuda.jpg",
        "img/logotipo.gif"
    };

    // jungla
    for(i=0; i<6; i++)
    {
        bar(0,0,WIDTH,HEIGHT);
        readimagefile(nombres[i],0,0,WIDTH,300);
        imagenes[i]  = malloc(imagesize(0,0,WIDTH,300));
        getimage(0,0,WIDTH,300, imagenes[i]);
    }

    // Creditos
    bar(0,0,WIDTH,HEIGHT);
    readimagefile(nombres[i],0,0,1040,390);
    imagenes[i]  = malloc(imagesize(0,0,1040,390));
    getimage(0,0,1040,390, imagenes[i]);

    // Ayuda
    bar(0,0,WIDTH,HEIGHT);
    readimagefile(nombres[++i],0,0,1040,390);
    imagenes[i]  = malloc(imagesize(0,0,1040,390));
    getimage(0,0,1040,390, imagenes[i]);

    // logo
    bar(0,0,WIDTH,HEIGHT);
    readimagefile(nombres[++i],0,0,798,303);
    imagenes[i]  = malloc(imagesize(0,0,798,303));
    getimage(0,0,798,303, imagenes[i]);

    portada();
}
Ejemplo n.º 4
0
int main()
{
      
  initwindow(1000,700);
  top:
  int x(0),y(0);
  
  while (!ismouseclick(WM_LBUTTONDOWN))
        {
            setfillstyle(SOLID_FILL, RED);
            rectangle(0,0,1000,700);
            floodfill(0,0,RED);
            readimagefile("logo.bmp",0,0,80,80);
            settextstyle(9,HORIZ_DIR,6);
            setbkcolor(WHITE);
            setcolor(BLACK);
            outtextxy(400,10,"BILL");
            settextstyle(9,HORIZ_DIR,3);
            outtextxy(20,100,"Particulars");
            outtextxy(300,100,"Qty");
            outtextxy(500,100,"Rate(in Rs.)");
            outtextxy(800,100,"Amount");
            //if qty is >0,print the item name ......etc
            
        }   
}
Ejemplo n.º 5
0
void importaMascara(imagem_type *imagem, const char* nome){
	int tamanho = 0;
	readimagefile(nome, 0, 0,imagem->largura, imagem->altura);
	tamanho = imagesize(0, 0,imagem->largura, imagem->altura);
	imagem->mask=  malloc(tamanho);
	getimage(0, 0, imagem->largura,imagem->altura,imagem->mask);
}
Ejemplo n.º 6
0
void importaImagem(imagem_type *imagem, const char* nome){
	int tamanho = 0;
	readimagefile(nome, 0, 0,imagem->largura, imagem->altura);
	tamanho = imagesize(0, 0,imagem->largura, imagem->altura);
	imagem->img =  malloc(tamanho);
	getimage(0, 0, imagem->largura,imagem->altura,imagem->img);
	
	imagem->mask  = NULL;

}
Ejemplo n.º 7
0
void name_enter(long sc,int level)
{
	void load_record();
	char str[11] = "";
	int i,cur_page=0,count=0,lastindex;
	clock_t cur = clock();
	char *s[46]={"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9","0","1","2","3","4","5","6","7","8","9"};
	setfillstyle(0,WHITE);
	settextstyle(8,0,5);
	while(1)
    {
    	setvisualpage(cur_page);
    	cur_page=-cur_page+1;
    	setactivepage(cur_page);
	    cleardevice();
	    readimagefile(".\\img\\background3.jpg",0,0,getmaxx(),getmaxy());
		readimagefile(".\\img\\name.gif",getmaxx()/2-50,getmaxy()/2-50,getmaxx()/2+50,getmaxy()/2);
		outtextxy(getmaxx()/7,getmaxy()/2, "ENTER:");
	    i=button();
	    if(i<46)
	    {	
	    	if(strlen(str) < 10)
	   			strcat(str,s[i]);
	    }
	    else if(i==46)
	    {
	    	lastindex = strlen(str);
	    	if(lastindex >= 1)
	    		str[lastindex - 1] = '\0';
	    }
	    else if(i==47)
	    {
	    	save_record(str,sc,level);
	    	cal_record();
	    	break;
	    }
	    cur = clock();
	    outtextxy(getmaxx()/3,getmaxy()/2,str);
	    delay(80);
    }

}
Ejemplo n.º 8
0
void* load_image( const char* _imgFileName, int _imgWidth, int _imgHeight )
{
    readimagefile( _imgFileName, 0, 0, _imgWidth, _imgHeight );

    unsigned int img_size = imagesize( 0, 0, _imgWidth, _imgHeight );

    void* p_temp_img = malloc( img_size );

    getimage( 0, 0, _imgWidth, _imgHeight, p_temp_img );

    return p_temp_img;
}
Ejemplo n.º 9
0
int mainb()
{
     initwindow(1000,750);
     int x=0,y=0;
     while (!ismouseclick(WM_LBUTTONDOWN))
        {
            setfillstyle(SOLID_FILL, RED);
            rectangle(0,0,1000,1000);
            floodfill(0,0,RED);
            
            readimagefile("logo.bmp",0,0,100,100);
            readimagefile("french_fries.bmp",700,200,825,325);
            readimagefile("paneer_wrap.bmp",850,275,975,400);
            readimagefile("chicken_mcnuggets.bmp",850,425,975,550);
            readimagefile("potato_wedges.bmp",700,350,825,475);
            readimagefile("veg_pizza_mcpuff.bmp",700,500,825,625);
           
            settextstyle(9,HORIZ_DIR,6);
            outtextxy(400,10,"Add-ons");
            
            settextstyle(9,HORIZ_DIR,4);
            outtextxy(275,70,"(Click on the name to order)");
            
            settextstyle(9,HORIZ_DIR,3);
            outtextxy(445,150,"PRICE (in Rs.)");
            
            setfillstyle(SOLID_FILL, WHITE);
            rectangle(10,200,400,275);
            rectangle(500,200,575,275);
            floodfill(11,201,WHITE);     
            floodfill(501,201,WHITE);
            
            setfillstyle(SOLID_FILL, WHITE);
            rectangle(10,300,400,375);
            floodfill(11,301,WHITE);  
            rectangle(500,300,575,375);
            floodfill(501,301,WHITE);  
            
            setfillstyle(SOLID_FILL, WHITE);
            rectangle(10,400,400,475);
            floodfill(11,401,WHITE);   
            rectangle(500,400,575,475);
            floodfill(501,401,WHITE); 
            
            setfillstyle(SOLID_FILL, WHITE);
            rectangle(10,500,400,575);
            floodfill(11,501,WHITE);    
            rectangle(500,500,575,575);
            floodfill(501,501,WHITE);
            
            setfillstyle(SOLID_FILL, WHITE);
            rectangle(10,600,400,675);
            floodfill(11,601,WHITE);    
            rectangle(500,600,575,675);
            floodfill(501,601,WHITE);
            
            setfillstyle(SOLID_FILL, WHITE);
            rectangle(675,675,950,725);
            floodfill(676,676,WHITE);
            
            setbkcolor(WHITE);
            setcolor(BLACK);
            settextstyle(9,HORIZ_DIR,3);
            outtextxy(50,225,"BigSpicy Paneer Wrap");
            outtextxy(520,225,"50");
            outtextxy(75,325,"Veg Pizza McPuff");
            outtextxy(520,325,"50");
            outtextxy(120,425,"French Fries");
            outtextxy(520,425,"25");
            settextstyle(9,HORIZ_DIR,3);
            outtextxy(40,525,"BigSpicy Chicken Wrap");
            outtextxy(520,525,"65");
            settextstyle(9,HORIZ_DIR,3);
            outtextxy(65,625,"Chicken McNuggets");
            outtextxy(520,625,"55");
            settextstyle(9,HORIZ_DIR,2);
            outtextxy(685,690,"Return to main menu");
        }
                 

        tryagain:
        getmouseclick(WM_LBUTTONDOWN,x,y);
        
        if (x>10 && x<400 && y>200 && y<275);
                //ask for qty
        else if (x>10 && x<400 && y>300 && y<375);
                //ask for qty
        else if (x>10 && x<400 && y>200 && y<475);
                //ask for qty 
        else if (x>10 && x<400 && y>200 && y<575);  
                //ask for qty
        else if (x>10 && x<400 && y>200 && y<675);
                //ask for qty
        else if (x>675 && x<950 && y>675 && y<725)
        {     closegraph();
               mainx();
         }  
        else
            goto tryagain;
        
        return 0;
}
Ejemplo n.º 10
0
int game()
{
    scores = 0;
    int life = 3, obstacle_num = 1, life_bar = 800;
    //initwindow(1000, 600, "Man run cycle");
    cleardevice();
    outtextxy(50, 200, "Score:");
    //readimagefile("background//Road.jpg", 0, 553, 1000, 561);
    sndPlaySound("Files//Sound//Background.wav", SND_FILENAME | SND_ASYNC | SND_LOOP);
    readimagefile("Files//Images//background//aurora.jpg", 0, 0, 1000, 192);
    readimagefile("Files//Images//background//Life.jpg", 800, 200, 830, 225);
    readimagefile("Files//Images//background//Life.jpg", 860, 200, 890, 225);
    readimagefile("Files//Images//background//Life.jpg", 920, 200, 950, 225);
    for(i = 1; life; i++, r++)
    {
        sprintf(score, "%d", scores);
        outtextxy(100, 200, score);
        if((kbhit()))
        {
            a = getch();
            if(a == ' ')
            {
                random = jump(i, random);
                readimagefile("Files//Images//game character//black.jpg", 25, 270, 175, 442); // make jump image black
            }
        }

        else
        {
            if( random > -40 && random < 150)  // character er size
            {
                life--;
                readimagefile("Files//Images//obstacle//black.jpg", 175, 485, 305, 552);
                readimagefile("Files//Images//obstacle//black.jpg", 0, 485, 25, 552);
                readimagefile("Files//Images//game character//collided.jpg", 25, 380, 175, 552);
                readimagefile("Files//Images//background//Life end.jpg", life_bar, 200, life_bar + 30, 225);
                life_bar += 60;
                delay(700);
                random -= 300;
            }
            sprintf(img_obstacle, "Files//Images//obstacle//Obstacle %02d.jpg", obstacle);
            readimagefile(img_obstacle, random, 485, random + 130, 552);
            sprintf(img_game_chr, "Files//Images//game character//Untitled-%d.jpg", i);
            readimagefile(img_game_chr, 25, 380, 175, 552);
            sprintf(road, "Files//Images//road//sidebar%d.jpg", r);
            readimagefile(road, 0, 553, 1000, 561);
            i %= 14;
            r %= 6;
            random -= 20;
            if((random < - 600))
            {
                random = 1000;
                obstacle = rand() % 16;
                obstacle_num++;
                //printf("%d    %d\n", obstacle, dlay);
                if( !(obstacle_num % 3))
                {

                    if(obstacle_num == 6) // level up er jonno korsi.
                        break;
                    dlay -= 10;
                }
            }
            delay(dlay);
        }
    }
    // loop for walking the man from the screen
    if(life)
    {
        sndPlaySound("Files//Sound//Tada.wav", SND_FILENAME | SND_ASYNC);
        delay(1000);
        for(random = 25, i = 1; random < 1100; random += 10, i++)
        {
            sprintf(img_game_chr, "Files//Images//game character//Untitled-%d.jpg", i);
            readimagefile(img_game_chr, random, 380, random + 150, 552);
            readimagefile("Files//Images//game character//black.jpg",random - 151 , 380, random - 1, 552);
            i %= 14;
            delay(60);
        }
        return scores;
    }
    else
    {
        //scores = 0;
        sndPlaySound("Files//Sound//Game Over.wav", SND_FILENAME | SND_ASYNC);
        readimagefile("Files//Images//game character//collided.jpg", 25, 380, 175, 552);
        delay(1000);
        return 0;
    }
}
Ejemplo n.º 11
0
bool level4()
{
    char bname[25];
    coor player, enemy[3], pshot[25], enshot[3];
    int plife=3, enlife[3]={7,7, 7};
    int fb =0, input, bo=0;
    player.xl= 20, player.yt=200, player.xr=100, player.yb=300;
    enemy[0].xl=550, enemy[0].yt=50, enemy[0].xr=630, enemy[0].yb=150;
    enemy[1].xl=550, enemy[1].yt=400, enemy[1].xr=630, enemy[1].yb=500;
    enemy[2].xl=650, enemy[2].yt=200, enemy[2].xr=730, enemy[2].yb=300;
    readimagefile("background.jpg", 0, 0, 800, 600);
    readimagefile("player.jpg", player.xl, player.yt, player.xr, player.yb);
    readimagefile("enemy3.jpg", enemy[0].xl, enemy[0].yt, enemy[0].xr, enemy[0].yb);
    readimagefile("enemy4.jpg", enemy[1].xl, enemy[1].yt, enemy[1].xr, enemy[1].yb);
    while(1)
    {
       scoring(0);
     //  p_life(plife);
        for(int i=0; i<3; i++)
        {
            char name[30];
           if(enshot[i].xl<=0 || fb==i)
            {
                fb++;
                enshot[i].xl = enemy[i].xl - 30;
                enshot[i].xr = enemy[i].xl;
                enshot[i].yb = enemy[i].yb - 45;
                enshot[i].yt = enemy[i].yt + 45;
                readimagefile("background.jpg", 0, 0, 800, 600);
                sprintf(name, "enbullet%d.jpg", i);
                readimagefile(name, enshot[i].xl, enshot[i].yt, enshot[i].xr, enshot[i].yb);
            }
            enemy[i].yb += 4, enemy[i].yt += 4 ;
            if(enshot[i].xl > 0)
            {
                enshot[i].xl-= 5, enshot[i].xr -=5;
                sprintf(name, "enbullet%d.jpg", i);
                readimagefile(name, enshot[i].xl, enshot[i].yt, enshot[i].xr, enshot[i].yb);
            }
            if(enemy[i].yb> 600)
            {
                enemy[i].yt =0, enemy[i].yb = 100;
                readimagefile("background.jpg", 0, 0, 800, 600);
            }
            sprintf(name, "enemy%d.jpg", i+2);
            readimagefile(name, enemy[i].xl, enemy[i].yt, enemy[i].xr, enemy[i].yb);
        }
        if(kbhit())
        {
            input = getch();
            if(input == 32)
            {
                scoring(-5);
                readimagefile("background.jpg", 0, 0, 800, 600);
                PlaySound(TEXT("shoot.wav"), NULL, SND_ASYNC);
                for(int k=0; k<2; k++)
            {
                pshot[bo].xl = player.xr;
                pshot[bo].xr = player.xr + 30;
                if(k==0)
                {
                    pshot[bo].yb = player.yb - 40;
                    pshot[bo].yt = player.yt + 50;
                    sprintf(bname, "pbullet%d.jpg", bo);
                readimagefile(bname, pshot[bo].xl, pshot[bo].yt, pshot[bo].xr, pshot[bo].yb);
                bo++;
                }
               /* if(k==1)
               {
                    pshot[bo].yb = player.yb - 50;
                    pshot[bo].yt = player.yt + 40;
                    sprintf(bname, "pbullet%d.jpg", bo);
                readimagefile(bname, pshot[bo].xl, pshot[bo].yt, pshot[bo].xr, pshot[bo].yb);
                bo++;
                }*/

            }
            input =0;
            }
            else if(input == 72)
            {
            if(player.yt>= 0) player.yb-=5, player.yt-=5;
            input =0;
            }
            else if(input == 80)
            {
            if(player.yb <= 600) player.yb+=5, player.yt+=5;
            input =0;
            }
            else if(input == 75)
            {
            if(player.xl >=0) player.xl-=5, player.xr-=5;
            input =0;
            }
            else if(input == 77)
            {
            if(player.xr<=800) player.xl+=5, player.xr+=5;
            input =0;
            }
  /*           else if(input == 13)
            {
                system("pause");
                setcolor(5);
                settextstyle(8, HORIZ_DIR, 3);
                outtextxy(300, 350, "Game Paused");
                outtextxy(270, 380, "Press Any Key To Continue");
                getch();
            }*/
        }
        readimagefile("player.jpg", player.xl, player.yt, player.xr, player.yb);
        for(int i=0; i<bo; i++)
        {
            if(pshot[i].xr>0 && pshot[i].xr<800)
            {
                pshot[i].xl +=6, pshot[i].xr +=6;
                sprintf(bname, "pbullet%d.jpg", i);
                readimagefile(bname, pshot[i].xl, pshot[i].yt, pshot[i].xr, pshot[i].yb);
            }
            if(pshot[i].xr >= 800)
            {
                pshot[i].xl =-1, pshot[i].xr = -1, pshot[i].yb =-1, pshot[i].yt =-1;
                readimagefile("background.jpg", 0, 0, 800, 600);
            }
        }
        for(int j=0; j<3; j++)
        {
            if((enshot[j].yt>= player.yt && enshot[j].yb <= player.yb) && (enshot[j].xl>=player.xl && enshot[j].xl <player.xr))
            {
                PlaySound(TEXT("explosion.wav"), NULL, SND_ASYNC);
                readimagefile("Explosion.jpg" , player.xl, player.yt, player.xr , player.yb );
                delay(200);
                readimagefile("background.jpg", 0, 0, 800, 600);
                readimagefile("player.jpg", player.xl, player.yt, player.xr, player.yb);
                enshot[j].xl = 0, plife--;
            }
            if(((player.xl>=enemy[j].xl && player.xl<=enemy[j].xr) || (player.xr>=enemy[j].xl && player.xr<=enemy[j].xr)) &&
                 ((player.yt>=enemy[j].yt && player.yb<=enemy[j].yt) || (player.yb>=enemy[j].yb && player.yt<=enemy[j].yb))) plife=0, enlife[j] =0;
             for(int i=0; i<bo; i++) if((pshot[i].yt>= enemy[j].yt && pshot[i].yb<= enemy[j].yb) && (pshot[i].xl>= enemy[j].xl && pshot[i].xr<= enemy[j].xr))
            {
                PlaySound(TEXT("explosion.wav"), NULL, SND_ASYNC);
                readimagefile("Explosion.jpg" , enemy[j].xl , enemy[j].yt , enemy[j].xr , enemy[j].yb );
                delay(200);
                pshot[i].xl =-1, pshot[i].xr = -1, pshot[i].yb =-1, pshot[i].yt =-1, enlife[j]--;
                if(enlife[j]>0)
                {
                    char name[30];
                    sprintf(name, "enemy%d.jpg", j+2);
                    readimagefile(name, enemy[j].xl, enemy[j].yt, enemy[j].xr, enemy[j].yb);
                }
                scoring(20);
                readimagefile("background.jpg", 0, 0, 800, 600);
            }
        }

        if(plife ==0 || ptszero())

        {
            PlaySound(TEXT("over.wav"), NULL, SND_ASYNC);
            readimagefile("Game over.jpg", 0, 0, 800, 600);
            delay(2000);
            sethighscores();
            showscores();
            cleardevice();
            return 0;
        }
         if(enlife[0] ==0 && enlife[1] == 0)
        {
            PlaySound(TEXT("win.wav"), NULL, SND_ASYNC);
            readimagefile("win.jpg", 0, 0, 800, 600);
            cleardevice();
            return 1;
        }
    }
}