-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
77 lines (73 loc) · 3.15 KB
/
main.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
let x
document.getElementById("prompt").style.pointerEvents="none"
function change(x)
{
switch(x){
case 1:document.getElementById("playercircle").innerHTML=x
break
case 2:document.getElementById("playercircle").innerHTML=x
break
case 3:document.getElementById("playercircle").innerHTML=x
break
case 4:document.getElementById("playercircle").innerHTML=x
break
case 5:document.getElementById("playercircle").innerHTML=x
break
case 6:document.getElementById("playercircle").innerHTML=x
break
}
}
let enscore=0, plscore=0
function updatescore(x){
let sco = Math.floor(Math.random()*6+1)
enscore+=sco
plscore+=x
document.getElementById("enemycircle").innerHTML=sco
if(sco!=x)
{document.getElementById("scoree").innerHTML=enscore
document.getElementById("scorep").innerHTML=plscore}
else
{ var ad=addEventListener("click",nothing())
document.getElementById("scor").innerHTML=plscore
document.getElementById("containergame").style.filter="blur(3px)"
document.getElementById("container").style.filter="blur(3px)"
document.getElementById("scores").style.filter="blur(3px)"
document.getElementById("overlay1").style.filter="blur(3px)"
document.getElementById("prompt").style.opacity="1"
document.getElementById("prompt").style.pointerEvents="auto"
if(enscore<plscore)
document.getElementById("alerts").innerHTML="You Won!"
if(enscore>plscore)
document.getElementById("alerts").innerHTML="You Lost!"
if(enscore==plscore)
document.getElementById("alerts").innerHTML="It's a Draw!"
}
function nothing(){
document.getElementById("one").style.pointerEvents="none"
document.getElementById("two").style.pointerEvents="none"
document.getElementById("three").style.pointerEvents="none"
document.getElementById("four").style.pointerEvents="none"
document.getElementById("five").style.pointerEvents="none"
document.getElementById("six").style.pointerEvents="none"
}
}
function res(){
document.getElementById("one").style.pointerEvents="auto"
document.getElementById("two").style.pointerEvents="auto"
document.getElementById("three").style.pointerEvents="auto"
document.getElementById("four").style.pointerEvents="auto"
document.getElementById("five").style.pointerEvents="auto"
document.getElementById("six").style.pointerEvents="auto"
document.getElementById("playercircle").innerHTML="0"
document.getElementById("enemycircle").innerHTML="0"
document.getElementById("scoree").innerHTML="0"
document.getElementById("scorep").innerHTML="0"
document.getElementById("alerts").innerHTML=""
enscore=0, plscore=0
document.getElementById("prompt").style.pointerEvents="none"
document.getElementById("containergame").style.filter="blur(0px)"
document.getElementById("container").style.filter="blur(0px)"
document.getElementById("scores").style.filter="blur(0px)"
document.getElementById("overlay1").style.filter="blur(0px)"
document.getElementById("prompt").style.opacity="0"
}