program to make front view of pacman game
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm," ");
setcolor(BLUE);
/* for boundry lines */
{
line(101,30,540,30);
line(101,380,540,380);
line(101,30,101,145);
line(101,265,101,380);
line(540,30,540,145);
line(540,265,540,380);
line(150,265,101,265);
line(150,265,150,225);
line(101,225,150,225);
line(101,185,150,185);
line(150,185,150,145);
line(150,145,101,145);
line(540,145,490,145);
line(490,145,490,185);
line(490,185,540,185);
line(540,225,490,225);
line(490,225,490,265);
line(490,265,540,265);
}
/* for centre rectangle and three smileys */
{
rectangle(270,230,370,180);
rectangle(305,90,335,30);
rectangle(305,155,335,115);
rectangle(305,380,335,320);
rectangle(305,260,335,300);
}
/* for centre to right side portion */
{
line(415,185,435,185);
line(435,185,435,105);
line(415,105,435,105);
line(415,105,415,140);
line(415,150,415,185);
line(415,140,360,140);
line(415,150,360,150);
line(360,140,360,150);
line(495,283,495,297);
line(495,283,465,283);
line(465,283,465,362);
line(479,348,494,348);
line(494,348,494,362);
line(494,362,465,362);
line(479,348,479,297);
line(479,297,495,297);
line(435,322,435,362);
line(435,362,370,362);
line(370,362,370,344);
line(370,344,415,344);
line(415,344,415,322);
line(415,322,435,322);
rectangle(505,335,540,315);
rectangle(370,80,435,55);
rectangle(465,80,510,55);
rectangle(500,125,480,105);
rectangle(415,255,435,215);
rectangle(380,297,435,283);
}
/* for centre to left side position */
{
line(205,105,205,185);
line(205,105,225,105);
line(205,185,225,185);
line(225,185,225,150);
line(225,105,225,140);
line(225,140,280,140);
line(225,150,280,150);
line(280,140,280,150);
line(145,283,145,297);
line(145,283,175,283);
line(175,283,175,362);
line(161,348,161,297);
line(161,348,145,348);
line(145,348,145,362);
line(145,362,175,362);
line(161,297,145,297);
line(205,322,205,362);
line(205,362,270,362);
line(270,362,270,344);
line(270,344,225,344);
line(225,344,225,322);
line(205,322,225,322);
rectangle(101,335,135,315);
rectangle(205,80,270,55);
rectangle(130,80,175,55);
rectangle(150,125,170,105);
rectangle(205,255,225,215);
rectangle(205,297,255,283);
}
/* for text */
{
setcolor(RED);
outtextxy(290,400," PACMAN ");
outtextxy(40,50," GAME ");
outtextxy(35,60," SCORE ");
outtextxy(570,50," HIGH ");
outtextxy(565,60," SCORE ");
}
/* for pacman */
{
setcolor(BLUE);
setfillstyle(1,YELLOW);
line(50,360,56,360);
circle(50,360,6);
floodfill(52,357,BLUE);
circle(50,344,6);
floodfill(52,342,BLUE);
line(50,344,56,344);
circle(50,328,6);
floodfill(52,330,BLUE);
line(50,328,56,328);
}
/* for dots vertical */
{
for(int j=40;j<=375;j=j+25)
{
putpixel(190,j,RED);
putpixel(450,j,RED);
}
for(j=40;j<=170;j=j+25)
{
putpixel(290,j,RED);
putpixel(355,j,RED);
}
for(j=240;j<=370;j=j+25)
{
putpixel(290,j,RED);
putpixel(355,j,RED);
}
for(j=40;j<=150;j=j+25)
{
putpixel(115,j,RED);
putpixel(525,j,RED);
}
}
/* for dots horizontal */
{
for(int k=115;k<=290;k=k+25)
{
putpixel(k,375,RED);
putpixel(k,40,RED);
}
for(k=355;k<=525;k=k+25)
{
putpixel(k,375,RED);
putpixel(k,40,RED);
}
}
getch();
closegraph();
}
output:-