-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjavascriptTest.html
180 lines (151 loc) · 7.43 KB
/
javascriptTest.html
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
169
170
171
172
173
174
175
176
177
178
179
180
<!DOCTYPE html>
<html>
<title>Super Extreme Ordinary Webpage</title>
<head>
<link href='http://fonts.googleapis.com/css?family=Kavoon' rel='stylesheet' type='text/css'>
<style>p {font-family: Verdana, sans-serif}</style>
<style>h2 {font-family:'Kavoon', Calbiri, sans-serif;color:#FEFEFE;text-align:center;text-shadow:0px 0px 6px #000}</style>
<style>h3 {font-family: Verdana, Calbiri, sans-serif;color:black;text-align:center}</style>
<style>.basicdiv {border:1px solid #000000;padding: 20px 20px;height: 400px;overflow:scroll}</style>
<style>.grey {color:grey}</style>
<style>.basicbtn {width:150px;}</style>
<script src="jquery-2.1.1.min.js"></script>
<script>
var productivity = 0;
var clickPower = 1;
var workPower = 1;
var assets = 0;
var currency = 0;
var income = 0;
var efficiency = 0.3;
//stats
var stat_a1 = 0;
var stat_a2 = 0;
var stat_a3 = 0;
var stat_a4 = 0;
var stat_asset = 0;
var stat_buyasset = 0;
var stat_money = 0;
var stat_employees = 0;
function startJS() {
setInterval("intervalGain()", 100);
setInterval("updateText()", 100);
$("#btn_click").html("<img src='checkbox-tree.svg' alt='assets' width='32' height='32'><br><b>Create Assets</b><br>Assets/Click: " + clickPower);
}
function aclick() {
assets += clickPower;
stat_asset += clickPower;
}
function description(desc) {
$("#DescriptionText").html("<b>Description: </b>" + desc);
}
function upgrade(a, t, c) {
if (currency >= c) {
var upg_btn = document.getElementById("upg_" + a);
var path = upg_btn.parentNode;
path.removeChild(upg_btn);
if(t === "u1") {
efficiency *= 1.5;
}
currency -= c;
}
}
function stat_increase(s) {
if (s === "a1" && assets >= 10) {
stat_a1 += 1;
currency += 10;
assets -= 10;
} if (s === "a2" && assets >= 100) {
stat_a2 += 1;
currency += 120;
assets -= 10;
} if (s === "a3" && assets >= 2000) {
stat_a3 += 1;
income += 2;
assets -= 2000;
} if (s === "e" && currency >= 200) {
stat_employees += 1;
} if (s === "ba" && currency >= 100) {
stat_buyasset += 70;
assets += 70;
}
}
function intervalGain() {
productivity = stat_employees * efficiency;
currency += income / 10;
assets += productivity / 10;
stat_money += income / 10;
stat_asset += productivity / 10;
}
function updateText() {
$("#resources_currency").html("<b>Currency: </b>$" + Math.round(currency * 10) / 10);
$("#resources_income").html("<b>Income: </b>" + Math.round(income * 10) / 10);
$("#resources_assets").html("<b>Assets: </b>" + Math.round(assets * 10) / 10);
$("#resources_productivity").html("<b>Productivity: </b>" + Math.round(productivity * 10) / 10);
$("#statscreen").html("Logos Designed: " + stat_a1 +
"<br>Websites Created: " + stat_a2 +
"<br>Total Assets Produced: " + Math.round(stat_asset * 10) / 10 +
"<br>Total Money Acquired: $" + Math.round(stat_money * 10) / 10 +
"<br>Employees Hired: " + stat_employees +
"<br>Employee Efficiency: " + Math.round(efficiency * 10) / 10 +
"<br>Assets Bought: " + stat_buyasset);
}
function updateBTNText() {
//document.getElementById("btn_logo").innerHTML = "" + ;
//document.getElementById("btn_hire").innerHTML = "" + ;
//document.getElementById("btn_website").innerHTML = "" + ;
//document.getElementById("btn_purchase").innerHTML = "" + ;
//document.getElementById("btn_applet").innerHTML = "" + ;
}
</script>
</head>
<body onload="startJS()">
<div style="background-color:#11AAFF;border:5px solid #0000CC;border-radius:20px;padding: 20px 20px">
<h1 style="font-family:Kavoon, Verdana, sans-serif;color:#77DDFF;text-shadow:1px 1px 2px #0000CC;text-align: center">Start-up Business Simulator <sup style="color:#77DDFF;font-family:Calbiri, sans-serif;font-size:10px;text-align: center">Alpha</sup> </h1>
</div>
<div style="position = fixed;bottom:0px; background-color:white; height = 150px;border-radius">
<p id="DescriptionText" style="text-align:center;">Description:</p>
</div>
<div class="basicdiv" style="float:left;">
<h2>-Resource Buttons-<br></h2>
<div class="center">
<button id="btn_click" type="button" onclick="aclick()" onmouseover="description('Create some assets for your next project.')"><b>Create Assets</b><br>Assets/Click: 1</button>
</div>
</div>
<div class="basicdiv" style="float:right;">
<h2>-Actions-<br></h2>
<div class="center">
<table><tr>
<td><button class="basicbtn" id="btn_logo" type="button" onclick="stat_increase('a1')" onmouseover="description('Design a logo for money.')"><img src="omega.svg" width=32px height=32px><br><b>Design Logo</b><br>10 Assets, +$10</button></td>
<td><button class="basicbtn" id="btn_hire" type="button" onclick="stat_increase('e')" onmouseover="description('Hire an employee to create assets for you.')"><img src="back-up.svg" width=32px height=32px><br><b>Hire Employee</b><br>$200, +0.3 Productivity</button></td>
<tr>
<td><button class="basicbtn" id="btn_website" type="button" onclick="stat_increase('a2')" onmouseover="description('Design a website for money.')"><img src="web.svg" width=32px height=32px><br><b>Design Website</b><br>100 Assets, +$120</button></td>
<td><button class="basicbtn" id="btn_purchase" type="button" onclick="stat_increase('ba')" onmouseover="description('Pay someone to supply assets for your next project.')"><img src="cash.svg" width=32px height=32px><br><b>Purchase Assets</b><br>$100, +70 Assets</button></td>
<tr>
<td><button class="basicbtn" id="btn_applet" type="button" onclick="stat_increase('a3')" onmouseover="description('Program a mobile game as a source of regular income.')"><img src="smartphone.svg" width=32px height=32px><br><b>Program Mobile Game</b><br>2000 Assets, +$2/s</button></td>
</table>
</div>
</div>
<div class="basicdiv" style="float:right;">
<h2>-Upgrades-<br></h2>
<div class="center">
<button class="basicbtn" id="upg_1" type="button" onclick="upgrade(1, 'u1', 500); updateBTNText()" onmouseover="description('Increases effectiveness of all employees by 50%')"><img src="radar-dish.svg" width=32px height=32px><br><b>Improved Office</b><br>$500</button>
<br>
<button class="basicbtn" id="upg_2" type="button" onclick="upgrade(2, 'u2', 1000); updateBTNText()" onmouseover="description('-7% to assets required for all actions')"><img src="nodular.svg" width=32px height=32px><br><b>Efficient workspace</b><br>$1000</button>
<br>
<button class="basicbtn" id="upg_3" type="button" onclick="" onmouseover="description('')"><img src="smartphone.svg" width=32px height=32px><br><b></b><br></button>
</div>
</div>
<div class="basicdiv">
<h2>-Resources-</h2>
<p id="resources_assets">Assets: </p>
<p id="resources_productivity">Productivity: </p>
<p id="resources_currency">Currency: </p>
<p id="resources_income">Income: </p>
<h2>-Stats-</h2>
<p id="statscreen"></p>
</div>
</body>
<footer><p>Most of the icons used are modified versions of originals from <a href="http://game-icons.net/">game-icons.net<a/>, under the CC-BY license. More information on the authors can be found <a href="http://game-icons.net/about.html#authors">here.</a>
</p>
</html>