-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjavascriptRPSI.js
168 lines (116 loc) · 4.51 KB
/
javascriptRPSI.js
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
var x=0;
var slides=[];
function setReady(){
document.getElementById("winner").style.display="none";
document.getElementById("tie").style.display="none";
document.getElementById("looser").style.display="none";
document.getElementById("again").style.pointerEvents="none";
startTimer();
}
function startTimer(){
document.getElementById("ready").style.pointerEvents="none";
var three= document.getElementById('3');
var two= document.getElementById('2');
var one= document.getElementById('1');
var go= document.getElementById('0');
document.getElementById("basicRules").style.display="none";
var rock= document.getElementById("rockSlide");
var paper= document.getElementById("paperSlide");
var seasor= document.getElementById("seasorsSlide");
slides.push(rock,paper,seasor);
var i=0;
myVar = setInterval(showSlides, 70);
var countDown=[];
countDown.push(three,two,one,go);
console.log("kool by far");
var i=1;
countDown[0].style.display="block";
CountLoop();
function CountLoop(){
setTimeout(function () {
countDown[i-1].style.display="none";
countDown[i].style.display="block";
if(i==3 ){
clearInterval(myVar);
document.getElementById("ques").style.display="block";
var k=0
for(k=0;k<slides.length ;k++){
slides[k].style.display="none";
}
//mainKHela
document.getElementById("rock").style.pointerEvents="auto";
document.getElementById("paper").style.pointerEvents="auto";
document.getElementById("seasors").style.pointerEvents="auto";
document.getElementById("rock").onclick = function() {rockBottom()};
document.getElementById("paper").onclick = function() {paperBottom()};
document.getElementById("seasors").onclick = function() {seasorBottom()};
}
i++;
if (i < 4) {
CountLoop();
}
}, 800)
}
}
var i=0;
function showSlides()
{
if(i==0)
{
slides[0].style.display="block";
slides[1].style.display="none";
slides[2].style.display="none";
i=1;
}
else if(i==1)
{
slides[0].style.display="none";
slides[1].style.display="block";
slides[2].style.display="none";
i=2;
}
else if(i==2)
{
slides[0].style.display="none";
slides[1].style.display="none";
slides[2].style.display="block";
i=0;
}
}
function rockBottom(result){
document.getElementById("ques").style.display="none";
document.getElementById("0").style.display="none";
document.getElementById("ready").style.display="none";
document.getElementById("again").style.display="block";
document.getElementById("again").style.pointerEvents="auto";
slides[1].style.display="block";
//var result=Math.floor(Math.random() * 2) + 1;
document.getElementById("looser").style.display="block";
document.getElementById("rock").style.pointerEvents="none";
document.getElementById("paper").style.pointerEvents="none";
document.getElementById("seasors").style.pointerEvents="none";
}
function paperBottom(){
document.getElementById("ques").style.display="none";
document.getElementById("0").style.display="none";
document.getElementById("ready").style.display="none";
document.getElementById("again").style.display="block";
slides[2].style.display="block";
document.getElementById("looser").style.display="block";
document.getElementById("rock").style.pointerEvents="none";
document.getElementById("paper").style.pointerEvents="none";
document.getElementById("seasors").style.pointerEvents="none";
document.getElementById("again").style.pointerEvents="auto";
}
function seasorBottom(result){
document.getElementById("ques").style.display="none";
document.getElementById("0").style.display="none";
document.getElementById("ready").style.display="none";
document.getElementById("again").style.display="block";
slides[0].style.display="block";
document.getElementById("looser").style.display="block";
document.getElementById("rock").style.pointerEvents="none";
document.getElementById("paper").style.pointerEvents="none";
document.getElementById("seasors").style.pointerEvents="none";
document.getElementById("again").style.pointerEvents="auto";
}