Commit 96c7fd59 authored by Jyrki's avatar Jyrki 🐾
Browse files

order matters

parent b345201e
......@@ -45,15 +45,6 @@ window.gameVars = {
# update all the counters and stop everything if the game was lost
updateCounters = ->
if window.gameVars.gold <= 0 || window.gameVars.wheat.count <= 0
$.growl {
title: "The Game"
message: "You lost it"
}
window.clearInterval evtim
$('span#valuables-gold').html 0 if window.gameVars.gold < 0
$('span#goods-wheat').html 0 if window.gameVars.wheat.count < 0
$('span#valuables-gold').html window.gameVars.gold
$('span#goods-wheat').html window.gameVars.wheat.count
$('span#goods-livestock').html window.gameVars.liveStock.count
......@@ -62,6 +53,15 @@ updateCounters = ->
$('span#people-shelter').html window.gameVars.people.shelter
$('span#builds-fields').html window.gameVars.fields.count
$('span#builds-cattle').html window.gameVars.cattleGrids.count
if window.gameVars.gold <= 0 || window.gameVars.wheat.count <= 0
$.growl {
title: "The Game"
message: "You lost it"
}
window.clearInterval evtim
$('span#valuables-gold').html 0 if window.gameVars.gold < 0
$('span#goods-wheat').html 0 if window.gameVars.wheat.count < 0
# random event
eventTimer = ->
......
......@@ -44,6 +44,14 @@
};
updateCounters = function() {
$('span#valuables-gold').html(window.gameVars.gold);
$('span#goods-wheat').html(window.gameVars.wheat.count);
$('span#goods-livestock').html(window.gameVars.liveStock.count);
$('span#people-home').html(window.gameVars.people.home);
$('span#people-war').html(window.gameVars.people.war);
$('span#people-shelter').html(window.gameVars.people.shelter);
$('span#builds-fields').html(window.gameVars.fields.count);
$('span#builds-cattle').html(window.gameVars.cattleGrids.count);
if (window.gameVars.gold <= 0 || window.gameVars.wheat.count <= 0) {
$.growl({
title: "The Game",
......@@ -54,17 +62,9 @@
$('span#valuables-gold').html(0);
}
if (window.gameVars.wheat.count < 0) {
$('span#goods-wheat').html(0);
return $('span#goods-wheat').html(0);
}
}
$('span#valuables-gold').html(window.gameVars.gold);
$('span#goods-wheat').html(window.gameVars.wheat.count);
$('span#goods-livestock').html(window.gameVars.liveStock.count);
$('span#people-home').html(window.gameVars.people.home);
$('span#people-war').html(window.gameVars.people.war);
$('span#people-shelter').html(window.gameVars.people.shelter);
$('span#builds-fields').html(window.gameVars.fields.count);
return $('span#builds-cattle').html(window.gameVars.cattleGrids.count);
};
eventTimer = function() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment