Spaces:
Running
Running
Upload 14 files
Browse files- .floo +3 -0
- .flooignore +8 -0
- .gitattributes +1 -0
- css/.subl952.tmp +85 -0
- css/styles.css +131 -0
- css/styles.css~RF230c85d.TMP +0 -0
- img/Thumbs.db +0 -0
- img/background.png +3 -0
- img/logo.png +0 -0
- img/nuclear.png +0 -0
- img/oil.png +0 -0
- img/solar.png +0 -0
- img/wind.png +0 -0
- js/main.js +356 -0
- links +1 -0
.floo
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"url": "https://floobits.com/bradman/Solar-Farmville"
|
3 |
+
}
|
.flooignore
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#*
|
2 |
+
*.o
|
3 |
+
*.pyc
|
4 |
+
*~
|
5 |
+
extern/
|
6 |
+
node_modules/
|
7 |
+
tmp
|
8 |
+
vendor/
|
.gitattributes
CHANGED
@@ -34,3 +34,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
solar-farmville-master/img/background.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
solar-farmville-master/img/background.png filter=lfs diff=lfs merge=lfs -text
|
37 |
+
img/background.png filter=lfs diff=lfs merge=lfs -text
|
css/.subl952.tmp
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.game-container {
|
2 |
+
position: relative;
|
3 |
+
max-width: 1200px;
|
4 |
+
height: 900px;
|
5 |
+
border: 2px solid #ddd;
|
6 |
+
}
|
7 |
+
|
8 |
+
.grid {
|
9 |
+
margin-top: 40%;
|
10 |
+
width: 45%;
|
11 |
+
margin: 0 auto;
|
12 |
+
}
|
13 |
+
|
14 |
+
.block {
|
15 |
+
height: 100px;
|
16 |
+
border: 2px solid #ddd;
|
17 |
+
background-image: url(http://previewcf.turbosquid.com/Preview/2014/08/01__17_56_46/grass_tex.jpgb91b8892-a3aa-4b03-bde2-0be3478eae61Larger.jpg);
|
18 |
+
}
|
19 |
+
|
20 |
+
.block:hover {
|
21 |
+
cursor: pointer;
|
22 |
+
}
|
23 |
+
|
24 |
+
.status {
|
25 |
+
position: absolute;
|
26 |
+
top: 0;
|
27 |
+
right: 0;
|
28 |
+
width: 30%;
|
29 |
+
border: 2px solid #000;
|
30 |
+
}
|
31 |
+
|
32 |
+
.progress {
|
33 |
+
margin-bottom: 10px;
|
34 |
+
}
|
35 |
+
|
36 |
+
.money-amount {
|
37 |
+
margin-bottom: 10px;
|
38 |
+
}
|
39 |
+
|
40 |
+
.popup {
|
41 |
+
display: none;
|
42 |
+
position: absolute;
|
43 |
+
width: 50%;
|
44 |
+
top: 20%;
|
45 |
+
left:0;
|
46 |
+
right:0;
|
47 |
+
margin-left:auto;
|
48 |
+
margin-right:auto;
|
49 |
+
padding: 20px;
|
50 |
+
z-index: 5;
|
51 |
+
background: #fff;
|
52 |
+
border: 2px solid #ddd;
|
53 |
+
box-shadow: 0 5px 15px rgba(0,0,0,.5);
|
54 |
+
}
|
55 |
+
|
56 |
+
.popup .escape-container {
|
57 |
+
float: left;
|
58 |
+
cursor: pointer;
|
59 |
+
}
|
60 |
+
|
61 |
+
.btn-buy {
|
62 |
+
display: block;
|
63 |
+
margin: 0 auto;
|
64 |
+
}
|
65 |
+
|
66 |
+
.img-block-type {
|
67 |
+
|
68 |
+
}
|
69 |
+
|
70 |
+
.energy-img {
|
71 |
+
height: 100%;
|
72 |
+
}
|
73 |
+
|
74 |
+
.btn-nextMonth {
|
75 |
+
display:block;
|
76 |
+
margin: 0 auto;
|
77 |
+
}
|
78 |
+
|
79 |
+
.logo {
|
80 |
+
margin-top:2%;
|
81 |
+
margin-left:5%;
|
82 |
+
max-height: 20%;
|
83 |
+
max-width: 20%;
|
84 |
+
margin-bottom: 10%;
|
85 |
+
}
|
css/styles.css
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
body{
|
2 |
+
background-image: url('../img/background.png');
|
3 |
+
font-family: 'Roboto', sans-serif;
|
4 |
+
}
|
5 |
+
.game-container {
|
6 |
+
position: relative;
|
7 |
+
max-width: 1200px;
|
8 |
+
max-height: 900px;
|
9 |
+
}
|
10 |
+
|
11 |
+
.grid {
|
12 |
+
margin-top: 40%;
|
13 |
+
width: 45%;
|
14 |
+
margin: 0 auto;
|
15 |
+
transition: webkit-transform .5s, transform .5s;
|
16 |
+
/*-webkit-transform: matrix3d(0.981576352, 0.0274439393, 0.1890891206, 0, -0.1703885647, 0.5735455435, 0.8012572908, 0, -0.0864615659, -0.8187138325, 0.5676548759, 0, 0, 0, 0, 1);
|
17 |
+
-webkit-transform-style: preserve-3d;*/
|
18 |
+
}
|
19 |
+
|
20 |
+
.block {
|
21 |
+
height: 160px;
|
22 |
+
border: 2px solid #ddd;
|
23 |
+
background-image: url(http://previewcf.turbosquid.com/Preview/2014/08/01__17_56_46/grass_tex.jpgb91b8892-a3aa-4b03-bde2-0be3478eae61Larger.jpg);
|
24 |
+
}
|
25 |
+
|
26 |
+
.block:hover {
|
27 |
+
cursor: pointer;
|
28 |
+
}
|
29 |
+
|
30 |
+
.status {
|
31 |
+
position: absolute;
|
32 |
+
top: 0;
|
33 |
+
right: 0;
|
34 |
+
width: 30%;
|
35 |
+
border: 2px solid #000;
|
36 |
+
background-color:rgba(33,33,33,0.3);
|
37 |
+
}
|
38 |
+
|
39 |
+
.progress {
|
40 |
+
margin-bottom: 10px;
|
41 |
+
}
|
42 |
+
|
43 |
+
.waste-bar {
|
44 |
+
text-align: center;
|
45 |
+
color: #000;
|
46 |
+
}
|
47 |
+
|
48 |
+
.money-amount {
|
49 |
+
margin-bottom: 10px;
|
50 |
+
}
|
51 |
+
|
52 |
+
.popup {
|
53 |
+
display: none;
|
54 |
+
position: absolute;
|
55 |
+
width: 50%;
|
56 |
+
top: 20%;
|
57 |
+
left:0;
|
58 |
+
right:0;
|
59 |
+
margin-left:auto;
|
60 |
+
margin-right:auto;
|
61 |
+
padding: 20px;
|
62 |
+
z-index: 5;
|
63 |
+
background: #fff;
|
64 |
+
border: 2px solid #ddd;
|
65 |
+
box-shadow: 0 5px 15px rgba(0,0,0,.5);
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
.popup .escape-container {
|
70 |
+
float: left;
|
71 |
+
cursor: pointer;
|
72 |
+
}
|
73 |
+
|
74 |
+
.btn-buy {
|
75 |
+
display: block;
|
76 |
+
margin: 0 auto;
|
77 |
+
}
|
78 |
+
|
79 |
+
.img-block-type {
|
80 |
+
|
81 |
+
}
|
82 |
+
|
83 |
+
.energy-img {
|
84 |
+
max-height: 100%;
|
85 |
+
}
|
86 |
+
|
87 |
+
.btn-next-year {
|
88 |
+
display:block;
|
89 |
+
margin: 0 auto;
|
90 |
+
margin-top: 40px;
|
91 |
+
}
|
92 |
+
|
93 |
+
.logo {
|
94 |
+
margin-top:2%;
|
95 |
+
margin-left:5%;
|
96 |
+
max-height: 20%;
|
97 |
+
max-width: 20%;
|
98 |
+
margin-bottom: 10%;
|
99 |
+
}
|
100 |
+
/*.top{
|
101 |
+
background-color:rgba(33,33,33,0.7);
|
102 |
+
}*/
|
103 |
+
.money-title, .green{
|
104 |
+
color:#1AED3A;
|
105 |
+
}
|
106 |
+
.waste-title, .red{
|
107 |
+
color:#ED1A4B;
|
108 |
+
}
|
109 |
+
.orange{
|
110 |
+
color:#E78624;
|
111 |
+
}
|
112 |
+
.blue{
|
113 |
+
color:#3BBDEE;
|
114 |
+
}
|
115 |
+
.year-title,.year-number{
|
116 |
+
color:#38BFEF;
|
117 |
+
}
|
118 |
+
.titlescreen .col-centered {
|
119 |
+
float: none;
|
120 |
+
text-align: center;
|
121 |
+
margin: 0 auto;
|
122 |
+
}
|
123 |
+
.btn-start {
|
124 |
+
margin-top: 20px;
|
125 |
+
}
|
126 |
+
.version-text {
|
127 |
+
display: none;
|
128 |
+
position: absolute;
|
129 |
+
font-weight: bold;
|
130 |
+
font-size: 1.2em;
|
131 |
+
}
|
css/styles.css~RF230c85d.TMP
ADDED
File without changes
|
img/Thumbs.db
ADDED
Binary file (86 kB). View file
|
|
img/background.png
ADDED
Git LFS Details
|
img/logo.png
ADDED
img/nuclear.png
ADDED
img/oil.png
ADDED
img/solar.png
ADDED
img/wind.png
ADDED
js/main.js
ADDED
@@ -0,0 +1,356 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var money = 1000;
|
2 |
+
var waste = 0;
|
3 |
+
var selected = 0;
|
4 |
+
var rateMoney = 0;
|
5 |
+
var rateWaste = 0;
|
6 |
+
var year = 2014;
|
7 |
+
var blocks = [{"bType":"", "bVersion":""},
|
8 |
+
{"bType":"", "bVersion":""},
|
9 |
+
{"bType":"", "bVersion":""},
|
10 |
+
{"bType":"", "bVersion":""},
|
11 |
+
{"bType":"", "bVersion":""},
|
12 |
+
{"bType":"", "bVersion":""}];
|
13 |
+
var firstBlock = false;
|
14 |
+
var smudFacts = ["SMUD's headquarters building, built in the late 1950s on the edge of the East Sacramento neighborhood, is notable for its mural by Wayne Thiebaud.",
|
15 |
+
"SMUD is one of the ten largest publicly owned utilities in the United States, generating the bulk of its power through natural gas.",
|
16 |
+
"SMUD houses large hydroelectric generation plants that account for 22% of its power.",
|
17 |
+
"SMUD's green power (renewable) energy output was estimated as 19% in 2009."];
|
18 |
+
|
19 |
+
$(document).ready(function(){
|
20 |
+
refreshMoney();
|
21 |
+
$('.titlescreen').fadeIn();
|
22 |
+
$('.year-number').text(year);
|
23 |
+
$('.block').click(function(){
|
24 |
+
if (blocks[$(this).data('block')].bType == "") {
|
25 |
+
$('.buy-menu').fadeIn();
|
26 |
+
} else {
|
27 |
+
upgradeImgRefresh();
|
28 |
+
$('.upgrade-menu').slideDown();
|
29 |
+
}
|
30 |
+
selected = $(this).data('block');
|
31 |
+
});
|
32 |
+
$('.escape-container').click(function(){
|
33 |
+
$('.popup').fadeOut();
|
34 |
+
});
|
35 |
+
$('.btn-next').click(function()
|
36 |
+
{
|
37 |
+
$('.year-report').fadeOut();
|
38 |
+
});
|
39 |
+
$('.btn-start').click(function(){
|
40 |
+
$('.popup').fadeOut();
|
41 |
+
});
|
42 |
+
$('.btn-buy').click(function(){
|
43 |
+
addBuilding(selected, $(this).data('buy'), 1);
|
44 |
+
refreshMoney();
|
45 |
+
$('.popup').fadeOut();
|
46 |
+
});
|
47 |
+
$('.btn-upgrade').click(function(){
|
48 |
+
upgrade(selected, blocks[selected].bType, $(this).data('upgrade'));
|
49 |
+
refreshMoney();
|
50 |
+
refreshVersion(selected);
|
51 |
+
$('.popup').fadeOut();
|
52 |
+
});
|
53 |
+
$('.btn-remove').click(function () {
|
54 |
+
var remove = blocks[selected];
|
55 |
+
remove.bType = "";
|
56 |
+
remove.bVersion = "";
|
57 |
+
refresh(selected);
|
58 |
+
$('.block[data-block=' + selected + '] .version-text').fadeOut();
|
59 |
+
$('.popup').fadeOut();
|
60 |
+
});
|
61 |
+
$('.btn-next-year').click(function(){
|
62 |
+
if (firstBlock) {
|
63 |
+
nextYear();
|
64 |
+
} else {
|
65 |
+
alert("You need to purchase your first energy source.");
|
66 |
+
}
|
67 |
+
});
|
68 |
+
$('.remove-waste-25-btn').click(function(){
|
69 |
+
if(money >= 200)
|
70 |
+
{
|
71 |
+
money = money - 200;
|
72 |
+
if(waste - 25 <= 0)
|
73 |
+
{
|
74 |
+
waste = 0;
|
75 |
+
}
|
76 |
+
else{
|
77 |
+
waste = waste - 25;
|
78 |
+
}
|
79 |
+
refreshMoney();
|
80 |
+
refreshWaste();
|
81 |
+
}
|
82 |
+
else{
|
83 |
+
alert('You do not have enough money');
|
84 |
+
}
|
85 |
+
refreshMoney();
|
86 |
+
refreshWaste();
|
87 |
+
});
|
88 |
+
$('.remove-waste-50-btn').click(function(){
|
89 |
+
if(money >= 400)
|
90 |
+
{
|
91 |
+
money = money - 400;
|
92 |
+
if(waste - 50 <= 0)
|
93 |
+
{
|
94 |
+
waste = 0;
|
95 |
+
}
|
96 |
+
else{
|
97 |
+
waste = waste - 50;
|
98 |
+
}
|
99 |
+
refreshMoney();
|
100 |
+
refreshWaste();
|
101 |
+
}
|
102 |
+
else{
|
103 |
+
alert('You do not have enough money');
|
104 |
+
}
|
105 |
+
refreshMoney();
|
106 |
+
refreshWaste();
|
107 |
+
});
|
108 |
+
});
|
109 |
+
|
110 |
+
function addBuilding (blockId, buildingType, buildingVersion){
|
111 |
+
switch(buildingType){
|
112 |
+
case 'oil':
|
113 |
+
if (firstBlock == false) {
|
114 |
+
firstBlock = true;
|
115 |
+
}
|
116 |
+
if (money >= 100) {
|
117 |
+
blocks[blockId].bType = "oil";
|
118 |
+
blocks[blockId].bVersion = buildingVersion;
|
119 |
+
money = money - 100;
|
120 |
+
rateMoney = rateMoney + 100;
|
121 |
+
rateWaste = rateWaste + 15;
|
122 |
+
refresh(selected);
|
123 |
+
} else {
|
124 |
+
alert("Need mas money!");
|
125 |
+
}
|
126 |
+
break;
|
127 |
+
case 'solar':
|
128 |
+
if (money >= 500) {
|
129 |
+
blocks[blockId].bType = "solar";
|
130 |
+
blocks[blockId].bVersion = buildingVersion;
|
131 |
+
money = money - 500;
|
132 |
+
rateMoney = rateMoney + 250;
|
133 |
+
rateWaste = rateWaste + 5;
|
134 |
+
refresh(selected);
|
135 |
+
} else {
|
136 |
+
alert("Need mas money!");
|
137 |
+
}
|
138 |
+
break;
|
139 |
+
case 'nuclear':
|
140 |
+
if (money >= 2500) {
|
141 |
+
blocks[blockId].bType = "nuclear";
|
142 |
+
blocks[blockId].bVersion = buildingVersion;
|
143 |
+
money = money - 2500;
|
144 |
+
rateMoney = rateMoney + 1500;
|
145 |
+
rateWaste = rateWaste + 15;
|
146 |
+
refresh(selected);
|
147 |
+
} else {
|
148 |
+
alert("Need mas money!");
|
149 |
+
}
|
150 |
+
break;
|
151 |
+
case 'wind':
|
152 |
+
if (money >= 1500) {
|
153 |
+
blocks[blockId].bType = "wind";
|
154 |
+
blocks[blockId].bVersion = buildingVersion;
|
155 |
+
money = money - 1500;
|
156 |
+
rateMoney = rateMoney + 500;
|
157 |
+
rateWaste = rateWaste + 5;
|
158 |
+
refresh(selected);
|
159 |
+
} else {
|
160 |
+
alert("Need mas money!");
|
161 |
+
}
|
162 |
+
break;
|
163 |
+
default:
|
164 |
+
blocks[blockId].bType = null;
|
165 |
+
blocks[blockId].bVersion = null;
|
166 |
+
break;
|
167 |
+
}
|
168 |
+
}
|
169 |
+
|
170 |
+
function upgrade(blockId, buildingType, buildingVersion) {
|
171 |
+
switch(buildingVersion){
|
172 |
+
case 1:
|
173 |
+
if (blocks[blockId].bVersion == 1) {
|
174 |
+
alert('This is already your version.');
|
175 |
+
} else {
|
176 |
+
|
177 |
+
}
|
178 |
+
break;
|
179 |
+
case 2:
|
180 |
+
if (blocks[blockId].bVersion == 2) {
|
181 |
+
alert('This is already your version.');
|
182 |
+
} else {
|
183 |
+
if (money >= 1000){
|
184 |
+
blocks[blockId].bVersion = buildingVersion;
|
185 |
+
money = money - 1000;
|
186 |
+
rateMoney = rateMoney + 100 * 1.5;
|
187 |
+
rateWaste = rateWaste + 5;
|
188 |
+
} else {
|
189 |
+
alert("Need mas money!");
|
190 |
+
}
|
191 |
+
}
|
192 |
+
break;
|
193 |
+
case 3:
|
194 |
+
if (blocks[blockId].bVersion == 3000) {
|
195 |
+
alert('This is already your version.');
|
196 |
+
} else {
|
197 |
+
if (money >= 3000){
|
198 |
+
blocks[blockId].bVersion = buildingVersion;
|
199 |
+
money = money - 3000;
|
200 |
+
rateMoney = rateMoney + 100 * 2;
|
201 |
+
rateWaste = rateWaste + 5;
|
202 |
+
} else {
|
203 |
+
alert("Need mas money!");
|
204 |
+
}
|
205 |
+
}
|
206 |
+
break;
|
207 |
+
case '':
|
208 |
+
|
209 |
+
break;
|
210 |
+
default:
|
211 |
+
break;
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
function upgradeImgRefresh() {
|
216 |
+
var type = blocks[selected].bType;
|
217 |
+
var imgUrl;
|
218 |
+
switch(type){
|
219 |
+
case 'oil':
|
220 |
+
imgUrl = "img/oil.png";
|
221 |
+
break;
|
222 |
+
case 'solar':
|
223 |
+
imgUrl = "img/solar.png";
|
224 |
+
break;
|
225 |
+
case 'nuclear':
|
226 |
+
imgUrl = "img/nuclear.png";
|
227 |
+
break;
|
228 |
+
case 'wind':
|
229 |
+
imgUrl = "img/wind.png";
|
230 |
+
break;
|
231 |
+
case '':
|
232 |
+
imgUrl = null;
|
233 |
+
break;
|
234 |
+
default:
|
235 |
+
imgUrl = null;
|
236 |
+
break;
|
237 |
+
}
|
238 |
+
$('.upgrade-menu img').attr('src', imgUrl);
|
239 |
+
}
|
240 |
+
|
241 |
+
function refresh (blockId){
|
242 |
+
var type = blocks[blockId].bType;
|
243 |
+
var version = blocks[blockId].bVersion;
|
244 |
+
var imgUrl;
|
245 |
+
switch(type){
|
246 |
+
case 'oil':
|
247 |
+
imgUrl = "img/oil.png";
|
248 |
+
break;
|
249 |
+
case 'solar':
|
250 |
+
imgUrl = "img/solar.png";
|
251 |
+
break;
|
252 |
+
case 'nuclear':
|
253 |
+
imgUrl = "img/nuclear.png";
|
254 |
+
break;
|
255 |
+
case 'wind':
|
256 |
+
imgUrl = "img/wind.png";
|
257 |
+
break;
|
258 |
+
case '':
|
259 |
+
imgUrl = null;
|
260 |
+
break;
|
261 |
+
default:
|
262 |
+
imgUrl = null;
|
263 |
+
break;
|
264 |
+
}
|
265 |
+
$('.block[data-block=' + blockId + '] img').attr('src', imgUrl);
|
266 |
+
$('.block[data-block=' + blockId + '] .version-text').text('Version ' + version);
|
267 |
+
$('.block[data-block=' + blockId + '] .version-text').data('version', version);
|
268 |
+
$('.block[data-block=' + blockId + '] .version-text').fadeIn();
|
269 |
+
}
|
270 |
+
|
271 |
+
function refreshVersion(blockId){
|
272 |
+
var type = blocks[blockId].bType;
|
273 |
+
var version = blocks[blockId].bVersion;
|
274 |
+
$('.block[data-block=' + blockId + '] .version-text').text('Version ' + version);
|
275 |
+
$('.block[data-block=' + blockId + '] .version-text').data('version', version);
|
276 |
+
}
|
277 |
+
|
278 |
+
function refreshMoney (){
|
279 |
+
$('.money-amount').text('$' + money);
|
280 |
+
}
|
281 |
+
|
282 |
+
function refreshWaste (){
|
283 |
+
var wasteBar = $('.waste-bar');
|
284 |
+
wasteBar.text(waste + '%');
|
285 |
+
wasteBar.css('width', waste + '%');
|
286 |
+
}
|
287 |
+
|
288 |
+
function nextYear(){
|
289 |
+
$('.year-report').fadeIn();
|
290 |
+
$('.year-gain').text(rateMoney);
|
291 |
+
$('.year-waste').text(rateWaste + '%');
|
292 |
+
money = money + rateMoney;
|
293 |
+
waste = waste + rateWaste;
|
294 |
+
$('.fact-text').text(smudFacts[Math.floor(Math.random()*smudFacts.length)]);
|
295 |
+
$('.remove-waste-25').text('$200');
|
296 |
+
$('.remove-waste-50').text('$400');
|
297 |
+
if (waste >= "100"){
|
298 |
+
gameOver();
|
299 |
+
var wasteBar = $('.waste-bar');
|
300 |
+
wasteBar.text('100%');
|
301 |
+
wasteBar.css('width', '100%');
|
302 |
+
} else {
|
303 |
+
refreshMoney();
|
304 |
+
refreshWaste();
|
305 |
+
year++;
|
306 |
+
$('.year-number').text(year);
|
307 |
+
}
|
308 |
+
}
|
309 |
+
|
310 |
+
function wipeGrid(){
|
311 |
+
for (var i = blocks.length - 1; i >= 0; i--) {
|
312 |
+
refresh(i);
|
313 |
+
};
|
314 |
+
}
|
315 |
+
|
316 |
+
function gameOver(){
|
317 |
+
$('.yearnum').text(year - 2014);
|
318 |
+
$('.btn-next-year').fadeOut('fast');
|
319 |
+
$('.gameover').fadeIn();
|
320 |
+
$('.btn-again').click(function(){
|
321 |
+
money = 1000;
|
322 |
+
refreshMoney();
|
323 |
+
waste = 0;
|
324 |
+
refreshWaste();
|
325 |
+
selected = 0;
|
326 |
+
rateMoney = 0;
|
327 |
+
rateWaste = 0;
|
328 |
+
year = 2014;
|
329 |
+
$('.year-number').text(year);
|
330 |
+
blocks = [{"bType":"", "bVersion":""},
|
331 |
+
{"bType":"", "bVersion":""},
|
332 |
+
{"bType":"", "bVersion":""},
|
333 |
+
{"bType":"", "bVersion":""},
|
334 |
+
{"bType":"", "bVersion":""},
|
335 |
+
{"bType":"", "bVersion":""}];
|
336 |
+
wipeGrid();
|
337 |
+
$('.gameover').fadeOut();
|
338 |
+
$('.version-text').fadeOut();
|
339 |
+
$('.btn-next-year').fadeIn();
|
340 |
+
year = 0;
|
341 |
+
firstBlock = false;
|
342 |
+
});
|
343 |
+
$('.btn-menu').click(function(){
|
344 |
+
|
345 |
+
});
|
346 |
+
|
347 |
+
}
|
348 |
+
|
349 |
+
//Add next year if buildings exist done
|
350 |
+
//add title screen done
|
351 |
+
//fix image sizes done
|
352 |
+
//change year to year done
|
353 |
+
|
354 |
+
//add versions
|
355 |
+
//show benefits
|
356 |
+
//upgrade all same + percentage differences
|
links
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
http://previewcf.turbosquid.com/Preview/2014/08/01__17_56_46/grass_tex.jpgb91b8892-a3aa-4b03-bde2-0be3478eae61Larger.jpg
|