-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.js
More file actions
82 lines (72 loc) · 1.7 KB
/
Copy pathcode.js
File metadata and controls
82 lines (72 loc) · 1.7 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
onEvent("twoToNine", "click", function () {
flip("twoToSeven");
});
onEvent("twoToEight", "click", function () {
flip("twoToSeven");
});
onEvent("twoToSeven", "click", function () {
flip("twoToSeven");
});
onEvent("twoToSix", "click", function () {
flip("twoToSix");
});
onEvent("twoToFive", "click", function () {
flip("twoToFive");
});
onEvent("twoToFour", "click", function () {
flip("twoToFour");
});
onEvent("twoToThree", "click", function () {
flip("twoToThree");
});
onEvent("twoToTwo", "click", function () {
flip("twoToTwo");
});
onEvent("twoToOne", "click", function () {
flip("twoToOne");
});
onEvent("twoToZero", "click", function () {
flip("twoToZero");
});
function flip(element) {
if (getText(element) == 0) {
playSound("assets/category_app/app_button_3.mp3");
setText(element, 1);
setProperty(element, "background-color", "#ffffff");
setProperty(element, "text-color", "#ffa400");
} else {
playSound("assets/category_app/app_button_2.mp3");
setText(element, 0);
setProperty(element, "background-color", "#ffa400");
setProperty(element, "text-color", "#ffffff");
}
setText("output", calculate());
}
function calculate() {
var total = 0;
if (getText("twoToSeven") == 1) {
total = total + 128;
}
if (getText("twoToSix") == 1) {
total = total + 64;
}
if (getText("twoToFive") == 1) {
total = total + 32;
}
if (getText("twoToFour") == 1) {
total = total + 16;
}
if (getText("twoToThree") == 1) {
total = total + 8;
}
if (getText("twoToTwo") == 1) {
total = total + 4;
}
if (getText("twoToOne") == 1) {
total = total + 2;
}
if (getText("twoToZero") == 1) {
total = total + 1;
}
return total;
}