In this Animation I make a car running on a road , and a children coming from a school is also in it. The children stops at the traffic signal and wait untill the signal becomes red. And when the signal becomes Red the walk through zebra crossing. And then again traffic signal turns into yellow and then green on the green signal the car again start moving on the road.


#include<dos.h>
#include<iostream.h>
#include <conio.h>
#include<stdlib.h>
#include<graphics.h>


void main()
{

int d=DETECT,g;

int i,x;
initgraph(&d,&g,"c://tc//bgi");


   settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
   outtextxy(125,240,"ANIMATION");

   getch();
//CARs

for(i=0;i<=330;i++)
{
delay(50);
cleardevice();



//parking

outtextxy(130, 180, "PARKING");

line(0,250,35,200);
line(1,250,36,200);
line(2,250,37,200);
line(3,250,38,200);
line(4,250,39,200);
line(5,250,40,200);
line(6,250,41,200);
line(7,250,42,200);
line(8,250,43,200);
line(9,250,44,200);

line(40,250,75,200);
line(41,250,76,200);
line(42,250,77,200);
line(43,250,78,200);
line(44,250,79,200);
line(45,250,80,200);
line(46,250,81,200);
line(47,250,82,200);
line(48,250,83,200);
line(49,250,84,200);

line(80,250,115,200);
line(81,250,116,200);
line(82,250,117,200);
line(83,250,118,200);
line(84,250,119,200);
line(85,250,120,200);
line(86,250,121,200);
line(87,250,122,200);
line(88,250,123,200);
line(89,250,124,200);

line(120,250,155,200);
line(121,250,156,200);
line(122,250,157,200);
line(123,250,158,200);
line(124,250,159,200);
line(125,250,160,200);
line(126,250,161,200);
line(127,250,162,200);
line(128,250,163,200);
line(129,250,164,200);

line(160,250,195,200);
line(161,250,196,200);
line(162,250,197,200);
line(163,250,198,200);
line(164,250,199,200);
line(165,250,200,200);
line(166,250,201,200);
line(167,250,202,200);
line(168,250,203,200);
line(169,250,204,200);

line(200,250,235,200);
line(201,250,236,200);
line(202,250,237,200);
line(203,250,238,200);
line(204,250,239,200);
line(205,250,240,200);
line(206,250,241,200);
line(207,250,242,200);
line(208,250,243,200);
line(209,250,244,200);

line(240,250,275,200);
line(241,250,276,200);
line(242,250,277,200);
line(243,250,278,200);
line(244,250,279,200);
line(245,250,280,200);
line(246,250,281,200);
line(247,250,282,200);
line(248,250,283,200);
line(249,250,284,200);

line(0,200,284,200);

//school
outtextxy(430, 130, "SCHOOL");

rectangle(420,180,490,210);//1st
rectangle(435,160,475,180);//2nd
rectangle(445,150,465,160);//3rd
rectangle(445,190,465,210);//gate

//road

outtextxy(330, 330, "ROAD");

rectangle(0,250,700,350);

bar(0,299,30,301);

bar(60,299,90,301);

bar(120,299,150,301);

bar(180,299,210,301);

bar(240,299,270,301);

bar(300,299,330,301);

bar(360,299,390,301);

bar(420,299,490,301);

//childrens

//child1
circle(500,226,7);
line(500,233,500,243); //legs
line(500,243,493,249);
line(500,243,507,249);
line(500,235,495,240); //hands
line(500,235,505,240);

//child2
circle(515,226,7);
line(515,233,515,243); //legs
line(515,243,508,249);
line(515,243,522,249);
line(515,235,510,240); //hands
line(515,235,520,240);

//child3
circle(530,226,7);
line(530,233,530,243); //legs
line(530,243,523,249);
line(530,243,537,249);
line(530,235,525,240); //hands
line(530,235,535,240);

//Zebracrossing

outtextxy(437, 360, "ZEBRA CROSSING");

rectangle(490,250,550,350);


bar(490,251,550,261);

bar(490,272,550,280);

bar(490,289,550,297);

bar(490,307,550,315);

bar(490,323,550,331);

bar(490,341,550,349);

//TRAFIc SIGNAL

outtextxy(540, 160, "TRAFIC LIGHT");

bar(550,350,600,365);
bar(565,340,585,350);
bar(570,200,580,350);
bar(530,190,570,200);
setfillstyle(SOLID_FILL,WHITE);
circle(575,195,6);
floodfill(575,195,WHITE);



rectangle(500,160,530,230);
rectangle(500,160,531,231);
rectangle(500,160,532,232);
if(i==325)
{

setfillstyle(SOLID_FILL,RED);
circle(515,172,9);
floodfill(515,172, WHITE);

}
if(i<270)
{
setfillstyle(SOLID_FILL,GREEN);
circle(515,217,9);
floodfill(515,217, WHITE);
}

//car3
line(111+i,312,150+i,334);
line(62+i,312,111+i,312);
line(62+i,312,62+i,340);
line(62+i,340,69+i,340);
arc(80+i,340,0,180,10);
circle(80+i,340,7);//back tyre
line(91+i,340,116+i,340);
arc(127+i,340,0,180,10);
circle(127+i,340,7);//front tyre
line(138+i,340,150+i,340);
line(150+i,340,150+i,334);

i=i+5;

}
for(x=0;x<=110;x++)
{
delay(50);
cleardevice();


//parking

outtextxy(130, 180, "PARKING");

line(0,250,35,200);
line(1,250,36,200);
line(2,250,37,200);
line(3,250,38,200);
line(4,250,39,200);
line(5,250,40,200);
line(6,250,41,200);
line(7,250,42,200);
line(8,250,43,200);
line(9,250,44,200);

line(40,250,75,200);
line(41,250,76,200);
line(42,250,77,200);
line(43,250,78,200);
line(44,250,79,200);
line(45,250,80,200);
line(46,250,81,200);
line(47,250,82,200);
line(48,250,83,200);
line(49,250,84,200);

line(80,250,115,200);
line(81,250,116,200);
line(82,250,117,200);
line(83,250,118,200);
line(84,250,119,200);
line(85,250,120,200);
line(86,250,121,200);
line(87,250,122,200);
line(88,250,123,200);
line(89,250,124,200);

line(120,250,155,200);
line(121,250,156,200);
line(122,250,157,200);
line(123,250,158,200);
line(124,250,159,200);
line(125,250,160,200);
line(126,250,161,200);
line(127,250,162,200);
line(128,250,163,200);
line(129,250,164,200);

line(160,250,195,200);
line(161,250,196,200);
line(162,250,197,200);
line(163,250,198,200);
line(164,250,199,200);
line(165,250,200,200);
line(166,250,201,200);
line(167,250,202,200);
line(168,250,203,200);
line(169,250,204,200);

line(200,250,235,200);
line(201,250,236,200);
line(202,250,237,200);
line(203,250,238,200);
line(204,250,239,200);
line(205,250,240,200);
line(206,250,241,200);
line(207,250,242,200);
line(208,250,243,200);
line(209,250,244,200);

line(240,250,275,200);
line(241,250,276,200);
line(242,250,277,200);
line(243,250,278,200);
line(244,250,279,200);
line(245,250,280,200);
line(246,250,281,200);
line(247,250,282,200);
line(248,250,283,200);
line(249,250,284,200);

line(0,200,284,200);

//school
outtextxy(430, 130, "SCHOOL");

rectangle(420,180,490,210);//1st
rectangle(435,160,475,180);//2nd
rectangle(445,150,465,160);//3rd
rectangle(445,190,465,210);//gate

//road

outtextxy(330, 330, "ROAD");

rectangle(0,250,700,350);

bar(0,299,30,301);

bar(60,299,90,301);

bar(120,299,150,301);

bar(180,299,210,301);

bar(240,299,270,301);

bar(300,299,330,301);

bar(360,299,390,301);

bar(420,299,490,301);
//car

line(111+i,312,150+i,334);
line(62+i,312,111+i,312);
line(62+i,312,62+i,340);
line(62+i,340,69+i,340);
arc(80+i,340,0,180,10);
circle(80+i,340,7);//back tyre
line(91+i,340,116+i,340);
arc(127+i,340,0,180,10);
circle(127+i,340,7);//front tyre
line(138+i,340,150+i,340);
line(150+i,340,150+i,334);

//childrens

//child1
circle(500,226+x,7);
line(500,233+x,500,243+x); //legs
line(500,243+x,493,249+x);
line(500,243+x,507,249+x);
line(500,235+x,495,240+x); //hands
line(500,235+x,505,240+x);

//child2
circle(515,226+x,7);
line(515,233+x,515,243+x); //legs
line(515,243+x,508,249+x);
line(515,243+x,522,249+x);
line(515,235+x,510,240+x); //hands
line(515,235+x,520,240+x);

//child3
circle(530,226+x,7);
line(530,233+x,530,243+x); //legs
line(530,243+x,523,249+x);
line(530,243+x,537,249+x);
line(530,235+x,525,240+x); //hands
line(530,235+x,535,240+x);
x=x+2;

//Zebracrossing

outtextxy(437, 360, "ZEBRA CROSSING");

rectangle(490,250,550,350);


bar(490,251,550,261);

bar(490,272,550,280);

bar(490,289,550,297);

bar(490,307,550,315);

bar(490,323,550,331);

bar(490,341,550,349);


//TRAFIc SIGNAL


outtextxy(540, 160, "TRAFIC LIGHT");

bar(550,350,600,365);
bar(565,340,585,350);
bar(570,200,580,350);
bar(530,190,570,200);

setfillstyle(SOLID_FILL,RED);
circle(575,195,6);
floodfill(575,195,WHITE);

rectangle(500,160,530,230);
rectangle(500,160,531,231);
rectangle(500,160,532,232);



setfillstyle(SOLID_FILL,RED);
circle(515,172,9);
floodfill(515,172, WHITE);




}

for(int y=0;y<=110;y++)
{
delay(50);
cleardevice();


//parking

outtextxy(130, 180, "PARKING");

line(0,250,35,200);
line(1,250,36,200);
line(2,250,37,200);
line(3,250,38,200);
line(4,250,39,200);
line(5,250,40,200);
line(6,250,41,200);
line(7,250,42,200);
line(8,250,43,200);
line(9,250,44,200);

line(40,250,75,200);
line(41,250,76,200);
line(42,250,77,200);
line(43,250,78,200);
line(44,250,79,200);
line(45,250,80,200);
line(46,250,81,200);
line(47,250,82,200);
line(48,250,83,200);
line(49,250,84,200);

line(80,250,115,200);
line(81,250,116,200);
line(82,250,117,200);
line(83,250,118,200);
line(84,250,119,200);
line(85,250,120,200);
line(86,250,121,200);
line(87,250,122,200);
line(88,250,123,200);
line(89,250,124,200);

line(120,250,155,200);
line(121,250,156,200);
line(122,250,157,200);
line(123,250,158,200);
line(124,250,159,200);
line(125,250,160,200);
line(126,250,161,200);
line(127,250,162,200);
line(128,250,163,200);
line(129,250,164,200);

line(160,250,195,200);
line(161,250,196,200);
line(162,250,197,200);
line(163,250,198,200);
line(164,250,199,200);
line(165,250,200,200);
line(166,250,201,200);
line(167,250,202,200);
line(168,250,203,200);
line(169,250,204,200);

line(200,250,235,200);
line(201,250,236,200);
line(202,250,237,200);
line(203,250,238,200);
line(204,250,239,200);
line(205,250,240,200);
line(206,250,241,200);
line(207,250,242,200);
line(208,250,243,200);
line(209,250,244,200);

line(240,250,275,200);
line(241,250,276,200);
line(242,250,277,200);
line(243,250,278,200);
line(244,250,279,200);
line(245,250,280,200);
line(246,250,281,200);
line(247,250,282,200);
line(248,250,283,200);
line(249,250,284,200);

line(0,200,284,200);

//school
outtextxy(430, 130, "SCHOOL");

rectangle(420,180,490,210);//1st
rectangle(435,160,475,180);//2nd
rectangle(445,150,465,160);//3rd
rectangle(445,190,465,210);//gate

//road

outtextxy(330, 330, "ROAD");

rectangle(0,250,700,350);

bar(0,299,30,301);

bar(60,299,90,301);

bar(120,299,150,301);

bar(180,299,210,301);

bar(240,299,270,301);

bar(300,299,330,301);

bar(360,299,390,301);

bar(420,299,490,301);
//car

line(111+i+y,312,150+i+y,334);
line(62+i+y,312,111+i+y,312);
line(62+i+y,312,62+i+y,340);
line(62+i+y,340,69+i+y,340);
arc(80+i+y,340,0,180,10);
circle(80+i+y,340,7);//back tyre
line(91+i+y,340,116+i+y,340);
arc(127+i+y,340,0,180,10);
circle(127+i+y,340,7);//front tyre
line(138+i+y,340,150+i+y,340);
line(150+i+y,340,150+i+y,334);

//childrens

//child1
circle(500,226+x,7);
line(500,233+x,500,243+x); //legs
line(500,243+x,493,249+x);
line(500,243+x,507,249+x);
line(500,235+x,495,240+x); //hands
line(500,235+x,505,240+x);

//child2
circle(515,226+x,7);
line(515,233+x,515,243+x); //legs
line(515,243+x,508,249+x);
line(515,243+x,522,249+x);
line(515,235+x,510,240+x); //hands
line(515,235+x,520,240+x);

//child3
circle(530,226+x,7);
line(530,233+x,530,243+x); //legs
line(530,243+x,523,249+x);
line(530,243+x,537,249+x);
line(530,235+x,525,240+x); //hands
line(530,235+x,535,240+x);
x=x+2;

//Zebracrossing

outtextxy(437, 360, "ZEBRA CROSSING");

rectangle(490,250,550,350);


bar(490,251,550,261);

bar(490,272,550,280);

bar(490,289,550,297);

bar(490,307,550,315);

bar(490,323,550,331);

bar(490,341,550,349);


//TRAFIc SIGNAL


outtextxy(540, 160, "TRAFIC LIGHT");

bar(550,350,600,365);
bar(565,340,585,350);
bar(570,200,580,350);
bar(530,190,570,200);

setfillstyle(SOLID_FILL,GREEN);
circle(575,195,6);
floodfill(575,195,WHITE);

rectangle(500,160,530,230);
rectangle(500,160,531,231);
rectangle(500,160,532,232);



setfillstyle(SOLID_FILL,RED);
circle(515,217,9);
floodfill(515,217, WHITE);
}
closegraph();
getch();
}
Posted by Unknown On Tuesday, May 14, 2013 No comments

0 comments:

Post a Comment

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube

Like us

    as

    Contact Form

    Name

    Email *

    Message *