updated man walking in rain (included polymorphism concept)

This commit is contained in:
Tanmay 2023-12-09 10:50:11 +05:30
parent bfa1ff6da8
commit 10ac660676

View File

@ -9,7 +9,7 @@
int ldisp=0; int ldisp=0;
void DrawManAndUmbrella(int x,int ldisp) void umb(int x,int ldisp)
{ {
circle(x,GroundY-90,10);//head circle(x,GroundY-90,10);//head
line(x,GroundY-80,x,GroundY-30); //neck to legs joint line(x,GroundY-80,x,GroundY-30); //neck to legs joint
@ -27,7 +27,7 @@ void DrawManAndUmbrella(int x,int ldisp)
} }
void Rain(int x) void umb(int x)
{ {
int i,rx,ry; int i,rx,ry;
for(int i=0;i<400;i++) for(int i=0;i<400;i++)
@ -50,9 +50,9 @@ int main(){
while(!kbhit()) while(!kbhit())
{ {
line(0,GroundY,ScreenWdith,GroundY); line(0,GroundY,ScreenWdith,GroundY);
Rain(x); umb(x);
ldisp = (ldisp+2)%20; ldisp = (ldisp+2)%20;
DrawManAndUmbrella(x,ldisp); umb(x,ldisp);
delay(25); delay(25);
cleardevice(); cleardevice();
x=(x+2)%ScreenWdith; x=(x+2)%ScreenWdith;