-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjavascript_petrobowl.js
More file actions
82 lines (71 loc) · 1.85 KB
/
javascript_petrobowl.js
File metadata and controls
82 lines (71 loc) · 1.85 KB
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
//-------------------------------------------
// TIMER FUNCTIONS RELATED
//-------------------------------------------
var minutes = 8;
var seconds = 0;
var tick = false;
var timeout;
function PlayBox() {
if (minutes >= 0 && seconds >= 0)
{
tick = true;
if (tick == true)
{
seconds -= 1;
if (seconds < 0 && minutes != 0)
{
minutes -= 1;
seconds = 59;
}
}
document.getElementById("play_butt").innerHTML = "Playing";
if (seconds < 10)
{
document.getElementById("timer_slot").innerHTML = minutes + ":" + "0" + seconds;
}
else
{
document.getElementById("timer_slot").innerHTML = minutes + ":" + seconds;
}
if (seconds == -1)
{
document.getElementById("timer_slot").innerHTML = minutes + ": 00";
}
}
tick = false;
}
function time_trigger() {
timeout = setInterval("PlayBox()", 1000);
}
function StopBox() {
document.getElementById("play_butt").innerHTML = "Play";
clearInterval(timeout);
}
function ClearBox(){
document.getElementById("play_butt").innerHTML = "Play";
minutes = 8;
seconds = 0;
clearInterval(timeout);
document.getElementById("timer_slot").innerHTML = "0" + minutes + ":" + "0" + seconds;
}
//-------------------------------------------
// SCORING FUNCTIONS RELATED
//-------------------------------------------
var t1_points = 0;
var t2_points = 0;
function t1_score_add() {
t1_points = t1_points + 10;
document.getElementById("t1_score").innerHTML = t1_points;
}
function t1_score_sub() {
t1_points = t1_points - 5;
document.getElementById("t1_score").innerHTML = t1_points;
}
function t2_score_add() {
t2_points = t2_points + 10;
document.getElementById("t2_score").innerHTML = t2_points;
}
function t2_score_sub() {
t2_points = t2_points - 5;
document.getElementById("t2_score").innerHTML = t2_points;
}