-
Notifications
You must be signed in to change notification settings - Fork 0
/
ladder_funtion.cpp
110 lines (110 loc) · 2.83 KB
/
ladder_funtion.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
void ladder(int score,int i)
{
int x,y,j;
j=score1;
while(j<=score-1)
{
paint(chance,i);
score1++;
if(score2!=0)
{
if((player2posY==332)||(player2posY==256)||(player2posY==180)||(player2posY==104)||(player2posY==28))
drawcircle1(player2posX+61,player2posY,1);
else
drawcircle(player2posX-61,player2posY,1);
}
if((player1posX>590)||(player1posX<40))
{
player1posY=player1posY-38;
if(player1posX>590)
player1posX=589;
else
player1posX=40;
}
if(score1==score2)
{
y=player2posY;
if((player2posY==332)||(player2posY==256)||(player2posY==180)||(player2posY==104)||(player2posY==28))
x=player2posX+61;
else
x=player2posX-61;
paint(chance,i);
setcolor(1);
circle(player1posX-15,player1posY,10);
setfillstyle(SOLID_FILL,GREEN);
floodfill(player1posX-15,player1posY,1);
setcolor(1);
circle(x+15,y,10);
setfillstyle(SOLID_FILL,RED);
floodfill(x+15,y,1);
if((player1posY==332)||(player1posY==256)||(player1posY==180)||(player1posY==104)||(player1posY==28))
player1posX=player1posX-61;
else
player1posX=player1posX+61;
}
else
{
if((player1posY==332)||(player1posY==256)||(player1posY==180)||(player1posY==104)||(player1posY==28))
drawcircle1(player1posX,player1posY,0);
else
drawcircle(player1posX,player1posY,0);
}
j++;
delay(200);
}
}
void ladder1(int score,int i)
{
int x,y,j;
j=score2;
while(j<=score-1)
{
paint(chance,i);
score2++;
if(score1!=0)
{
if((player1posY==332)||(player1posY==256)||(player1posY==180)||(player1posY==104)||(player1posY==28))
drawcircle1(player1posX+61,player1posY,0);
else
drawcircle(player1posX-61,player1posY,0);
}
if((player2posX>590)||(player2posX<40))
{
player2posY=player2posY-38;
if(player2posX>590)
player2posX=589;
else
player2posX=40;
}
if(score1==score2)
{
y=player1posY;
if((player1posY==332)||(player1posY==256)||(player1posY==180)||(player1posY==104)||(player1posY==28))
x=player1posX+61;
else
x=player1posX-61;
paint(chance,i);
setcolor(1);
circle(x-15,y,10);
setfillstyle(SOLID_FILL,GREEN);
floodfill(x-15,y,1);
setcolor(1);
circle(player2posX+15,player2posY,10);
setfillstyle(SOLID_FILL,RED);
floodfill(player2posX+15,player2posY,1);
if((player2posY==332)||(player2posY==256)||(player2posY==180)||(player2posY==104)||(player2posY==28))
player2posX=player2posX-61;
else
player2posX=player2posX+61;
}
else
{
if((player2posY==332)||(player2posY==256)||(player2posY==180)||(player2posY==104)||(player2posY==28))
drawcircle1(player2posX,player2posY,1);
else
drawcircle(player2posX,player2posY,1);
}
j++;
delay(200);
}
}