diff --git a/.idea/idle-build-up.iml b/.idea/idle-build-up.iml index 1a5cf9a..a2f0531 100644 --- a/.idea/idle-build-up.iml +++ b/.idea/idle-build-up.iml @@ -5,5 +5,6 @@ + \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml index d3f1dd9..2aebe75 100644 --- a/.idea/jsLibraryMappings.xml +++ b/.idea/jsLibraryMappings.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/img/corn.png b/img/corn.png new file mode 100644 index 0000000..79db6dc Binary files /dev/null and b/img/corn.png differ diff --git a/img/medieval_farm.png b/img/medieval_farm.png new file mode 100644 index 0000000..3eb4b28 Binary files /dev/null and b/img/medieval_farm.png differ diff --git a/index.html b/index.html index d2ed71e..bbd9e65 100644 --- a/index.html +++ b/index.html @@ -13,73 +13,73 @@
-
-

Resources

-
-
-

{{ this.getAmount() }}

+ +

Resources

+
+
+

{{ this.getAmount() }}


-

{{ resources.wood }}


-

{{ resources.stone }}


-

{{ resources.iron }}


-

{{ resources.bricks }}


+

{{ resources.wood }}

+

{{ resources.stone }}

+

{{ resources.iron }}

+

{{ resources.bricks }}

- +
-
-

Owned buildings

-
-
-
    +
    +

    Owned buildings

    +
    +
    +
    • -
      - -
      - {{ building.name }} (Level {{ building.level }})
      - {{ building.amount }} / {{ building.intervalInSeconds }}s
      +
    +
    + +
    + {{ building.name }} (Level {{ building.level }})
    + {{ building.amount }} / {{ building.intervalInSeconds }}s
    - {{ building.loader }} % + {{ building.loader }} %
+
+ + +
+
+

Available buildings

- - - -
-
-

Available buildings

-
-
-
    -
  • - -
    - -
    - {{ building.name }}
    - {{ building.amount }} / {{ building.intervalInSeconds }}s
    - -
  • -
-
-
+
+
    +
  • + +
    + +
    + {{ building.name }}
    + {{ building.amount }} / {{ building.intervalInSeconds }}s
    +
  • +
+
+
+ + + - \ No newline at end of file diff --git a/js/app.js b/js/app.js index 5178b87..0691dab 100644 --- a/js/app.js +++ b/js/app.js @@ -4,52 +4,74 @@ let game = new Vue({ money: 0, resources: { wood: 0, - stone: 0 + stone: 0, + iron: 0, + bricks: 0, + corn: 0 }, buildings: [ { name: 'Bank', - intervalInSeconds: 15, - amount: 100, - level: 1, - price: 1000, resource: 'gold', + icon: 'medieval_largeCastle', + level: 1, + maxLevel: 20, isOwned: true, isUpgradeable: true, - maxLevel: 20, + amount: 100, + amountMultiplicator: 1.5, + intervalInSeconds: 30, + intervalMultiplicator: 1, + price: 1000, priceMultiplicator: 10, - intervalMultiplicator: 0.95, - icon: 'medieval_largeCastle' }, { name: 'Lumberjack', - intervalInSeconds: 10, - amount: 2, - level: 0, - price: 100, resource: 'wood', + icon: 'medieval_lumber', + level: 0, + maxLevel: 15, isOwned: false, isUpgradeable: true, - maxLevel: 15, - priceMultiplicator: 2, + amount: 2, + amountMultiplicator: 1, + intervalInSeconds: 10, intervalMultiplicator: 0.95, - icon: 'medieval_lumber' + price: 100, + priceMultiplicator: 2 }, { name: 'Quarry', - intervalInSeconds: 20, - amount: 2, + resource: 'stone', + icon: 'medieval_mine', level: 0, + maxLevel: 15, + isOwned: false, + isUpgradeable: true, + amount: 2, + amountMultiplicator: 1, + intervalInSeconds: 20, + intervalMultiplicator: 0.95, price: 250, - resource: 'stone', + priceMultiplicator: 2 + }, + { + name: 'Farm', + resource: 'corn', + icon: 'medieval_farm', + level: 0, + maxLevel: 25, isOwned: false, isUpgradeable: true, - maxLevel: 15, + amount: 5, + amountMultiplicator: 2, + price: 500, priceMultiplicator: 2, - intervalMultiplicator: 0.95, - icon: 'medieval_mine' + intervalInSeconds: 60, + intervalMultiplicator: 1 }, ], + currentQuest: null, loadedIntervals: [] }, created() { @@ -72,16 +94,19 @@ let game = new Vue({ add(amount = 0, resource = 'gold') { switch (resource) { case 'wood': - this.resources.wood += amount; - break; + this.resources.wood += amount; + break; case 'stone': - this.resources.stone += amount; - break; + this.resources.stone += amount; + break; + case 'corn': + this.resources.corn += amount; + break; case 'gold': - this.money += amount; - break; + this.money += amount; + break; } - + return this.saveMoney(); }, @@ -91,7 +116,7 @@ let game = new Vue({ }, getAmount() { - return this.money; + return this.money.toFixed(0); }, getAmountFormatted() { @@ -108,24 +133,24 @@ let game = new Vue({ } }); }, - + initiateIntervals(building) { building.intervalEarnID = setInterval(() => { - game.add(building.amount, building.resource); - }, building.intervalInSeconds * 1000); - - building.intervalLoadingID = setInterval(() => { - if (building.loader < 100) { - building.loader += 10; - } else { - building.loader = 10; - } - - game.$forceUpdate() - }, building.intervalInSeconds / 10 * 1000) - - - this.loadedIntervals.push(building.intervalEarnID, building.intervalLoadingID); + game.add(building.amount, building.resource); + }, building.intervalInSeconds * 1000); + + building.intervalLoadingID = setInterval(() => { + if (building.loader < 100) { + building.loader += 10; + } else { + building.loader = 10; + } + + game.$forceUpdate() + }, building.intervalInSeconds / 10 * 1000) + + + this.loadedIntervals.push(building.intervalEarnID, building.intervalLoadingID); }, killIntervals() { @@ -184,12 +209,12 @@ let game = new Vue({ this.reloadSingleBuilding(building); this.saveBuildings(); }, - + reloadSingleBuilding(building) { clearInterval(building.intervalEarnID); clearInterval(building.intervalLoadingID); building.loader = 10; - + this.initiateIntervals(building); },