Browse Source

WIP

poc/map
Nero Ignis 4 years ago
parent
commit
b7265dc48f
  1. 22
      css/app.css
  2. 0
      img/tiles/environment/birch_1.png
  3. 0
      img/tiles/environment/birch_2.png
  4. 0
      img/tiles/environment/birch_3.png
  5. 0
      img/tiles/environment/birch_4.png
  6. BIN
      img/tiles/environment/birch_large.png
  7. BIN
      img/tiles/environment/birch_small.png
  8. BIN
      img/tiles/environment/bush.png
  9. BIN
      img/tiles/environment/bush_berries.png
  10. BIN
      img/tiles/environment/fire.png
  11. BIN
      img/tiles/environment/ore_copper.png
  12. BIN
      img/tiles/environment/ore_gold.png
  13. BIN
      img/tiles/environment/spruce_large.png
  14. BIN
      img/tiles/environment/spruce_small.png
  15. BIN
      img/tiles/environment/stone.png
  16. BIN
      img/tiles/environment/stone_0.png
  17. BIN
      img/tiles/environment/stone_1.png
  18. BIN
      img/tiles/environment/stone_3.png
  19. BIN
      img/tiles/environment/wood_log.png
  20. BIN
      img/tiles/environment/wooden_fence.png
  21. BIN
      img/tiles/grass.png
  22. BIN
      img/tiles/roads/corner_n_o.png
  23. BIN
      img/tiles/roads/corner_n_w.png
  24. BIN
      img/tiles/roads/corner_o_s.png
  25. BIN
      img/tiles/roads/corner_s_w.png
  26. BIN
      img/tiles/roads/cross.png
  27. BIN
      img/tiles/roads/end_n.png
  28. BIN
      img/tiles/roads/end_o.png
  29. BIN
      img/tiles/roads/end_s.png
  30. BIN
      img/tiles/roads/end_w.png
  31. BIN
      img/tiles/roads/straight_n_s.png
  32. BIN
      img/tiles/roads/straight_o_w.png
  33. BIN
      img/tiles/roads/t_n_o_s.png
  34. BIN
      img/tiles/roads/t_n_o_w.png
  35. BIN
      img/tiles/roads/t_n_s_w.png
  36. BIN
      img/tiles/roads/t_o_s_w.png
  37. BIN
      img/tiles/singleSpruce.png
  38. BIN
      img/tiles/structure/barn.png
  39. BIN
      img/tiles/structure/blacksmith.png
  40. BIN
      img/tiles/structure/castle_bottom.png
  41. BIN
      img/tiles/structure/castle_top.png
  42. BIN
      img/tiles/structure/church_bottom.png
  43. BIN
      img/tiles/structure/church_top.png
  44. BIN
      img/tiles/structure/house.png
  45. BIN
      img/tiles/structure/house_long.png
  46. BIN
      img/tiles/structure/house_with_stall.png
  47. BIN
      img/tiles/structure/lifestock_bottom.png
  48. BIN
      img/tiles/structure/lifestock_top.png
  49. BIN
      img/tiles/structure/market_stand.png
  50. BIN
      img/tiles/structure/mill_bottom.png
  51. BIN
      img/tiles/structure/mill_top.png
  52. BIN
      img/tiles/structure/mill_top_alt.png
  53. BIN
      img/tiles/structure/mill_wheel_1.png
  54. BIN
      img/tiles/structure/mill_wheel_2.png
  55. BIN
      img/tiles/structure/mill_wheel_3.png
  56. BIN
      img/tiles/structure/statue.png
  57. BIN
      img/tiles/structure/storage.png
  58. BIN
      img/tiles/structure/tower_bottom.png
  59. BIN
      img/tiles/structure/tower_top.png
  60. BIN
      img/tiles/structure/wide_house.png
  61. BIN
      img/tiles/trans.png
  62. 150
      index.html
  63. 74
      js/app.js

22
css/app.css

@ -26,7 +26,6 @@
top: 4px; top: 4px;
right: 10px; right: 10px;
font-size: 2.5em; font-size: 2.5em;
-webkit-text-stroke: 1px lighgrey;
-webkit-text-fill-color: gold; -webkit-text-fill-color: gold;
font-family: Arial, serif; font-family: Arial, serif;
text-shadow: -1px -1px 2px black; text-shadow: -1px -1px 2px black;
@ -36,3 +35,24 @@
display: inline-block; display: inline-block;
width: 90px; width: 90px;
} }
#mapwrapper {
text-align: center;
overflow: auto;
height: 70vh;
overflow-scrolling: auto;
}
#mapwrapper::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 10px;
background-color: #F5F5F5;
}
.tile {
background-image: url('../img/tiles/grass.png');
}
#mapwrapper.card-body {
padding: 0;
}

0
img/tiles/environment/birch_1.png

0
img/tiles/environment/birch_2.png

0
img/tiles/environment/birch_3.png

0
img/tiles/environment/birch_4.png

BIN
img/tiles/environment/birch_large.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
img/tiles/environment/birch_small.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/tiles/environment/bush.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
img/tiles/environment/bush_berries.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
img/tiles/environment/fire.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/tiles/environment/ore_copper.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
img/tiles/environment/ore_gold.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
img/tiles/environment/spruce_large.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
img/tiles/environment/spruce_small.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/tiles/environment/stone.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/tiles/environment/stone_0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
img/tiles/environment/stone_1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
img/tiles/environment/stone_3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
img/tiles/environment/wood_log.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/tiles/environment/wooden_fence.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
img/tiles/grass.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
img/tiles/roads/corner_n_o.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/tiles/roads/corner_n_w.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/tiles/roads/corner_o_s.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/tiles/roads/corner_s_w.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/tiles/roads/cross.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
img/tiles/roads/end_n.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/tiles/roads/end_o.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/tiles/roads/end_s.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
img/tiles/roads/end_w.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/tiles/roads/straight_n_s.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
img/tiles/roads/straight_o_w.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
img/tiles/roads/t_n_o_s.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
img/tiles/roads/t_n_o_w.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
img/tiles/roads/t_n_s_w.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
img/tiles/roads/t_o_s_w.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
img/tiles/singleSpruce.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/tiles/structure/barn.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/tiles/structure/blacksmith.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/tiles/structure/castle_bottom.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
img/tiles/structure/castle_top.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
img/tiles/structure/church_bottom.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
img/tiles/structure/church_top.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/tiles/structure/house.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/tiles/structure/house_long.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/tiles/structure/house_with_stall.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
img/tiles/structure/lifestock_bottom.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
img/tiles/structure/lifestock_top.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
img/tiles/structure/market_stand.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
img/tiles/structure/mill_bottom.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
img/tiles/structure/mill_top.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/tiles/structure/mill_top_alt.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/tiles/structure/mill_wheel_1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
img/tiles/structure/mill_wheel_2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
img/tiles/structure/mill_wheel_3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
img/tiles/structure/statue.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
img/tiles/structure/storage.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/tiles/structure/tower_bottom.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
img/tiles/structure/tower_top.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/tiles/structure/wide_house.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
img/tiles/trans.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 993 B

150
index.html

@ -6,84 +6,119 @@
<link rel="stylesheet" href="https://bootswatch.com/4/darkly/bootstrap.min.css"> <link rel="stylesheet" href="https://bootswatch.com/4/darkly/bootstrap.min.css">
<link rel="stylesheet" href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css"> <link rel="stylesheet" href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/izitoast/1.4.0/css/iziToast.min.css"/> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/izitoast/1.4.0/css/iziToast.min.css"/>
<link rel="stylesheet" href="css/app.css" > <link rel="stylesheet" href="css/app.css">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no" name="viewport"> <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no"
name="viewport">
</head> </head>
<body> <body>
<div id="root" class="container mt-2"> <div id="root" class="container-fluid mt-2">
<div class="row"> <div class="row">
<div class="col-md-12"> <!-- <div class="col-md-12">-->
<div class="alert alert-warning"> <!-- <div class="alert alert-warning alert-dis">-->
This game is in an early state of development, resources could be resetted everytime and bugs may appear. Also not every building is balanced yet. <!-- This game is in an early state of development, resources could be resetted everytime and bugs may appear. Also not every building is balanced yet.-->
<!-- </div>-->
<!-- </div>-->
<div class="col-xl-8">
<div class="card">
<div class="card-header">Map</div>
<div class="card-body" id="mapwrapper">
<div id="">
<div class="mapRow" v-for="row in map">
<nobr>
<a v-for="tile in row">
<img :src="tile.asset" alt="" class="tile" style="display: inline-block;" @click="interactWithTile(tile)"/>
</a>
</nobr>
</div>
</div>
</div>
</div> </div>
</div> </div>
<div class="col-sm-6"> <div class="col-xl-4">
<div class="card"> <div class="card">
<a class="card-header" data-toggle="collapse" href="#collapseResources" role="button" aria-expanded="true" aria-controls="collapseResources"> <a class="card-header" data-toggle="collapse" href="#collapseResources" role="button"
aria-expanded="true" aria-controls="collapseResources">
<h3>Resources</h3> <h3>Resources</h3>
</a> </a>
<div class="card-body" id="collapseResources"> <div class="card-body" id="collapseResources">
<div class="row"> <div class="row">
<div class="col-md-12" v-for="resource in resources" v-if="resource.amount > 0 || resource.name === 'Gold'"> <div class="col-md-12" v-for="resource in resources"
<div class="float-right">{{ getFormattedNumber(resource.amount) }} <img class="resource-icon" :src="resource.icon"></div> v-if="resource.amount > 0 || resource.name === 'Gold'">
<div class="float-right">{{ getFormattedNumber(resource.amount) }} <img
class="resource-icon" :src="resource.icon"></div>
{{ resource.name }} {{ resource.name }}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="col-sm-6">
<div class="card"> <div class="card">
<a class="card-header" data-toggle="collapse" href="#collapseQuest" role="button" aria-expanded="true" aria-controls="collapseQuest"> <a class="card-header" data-toggle="collapse" href="#collapseQuest" role="button"
aria-expanded="true"
aria-controls="collapseQuest">
<h3>Quests</h3> <h3>Quests</h3>
</a> </a>
<div class="card-body" id="collapseQuest"> <div class="card-body" id="collapseQuest">
<div v-if="currentQuest"> <div v-if="currentQuest">
Items needed: <br/> Items needed: <br/>
<span v-for="resource in Object.keys(resources)" v-if="resources[resource].unlocked && currentQuest[resource] > 0" :style="'color: ' + getColorForQuestResource(currentQuest[resource], resources[resource].amount)"> <span v-for="resource in Object.keys(resources)"
<img :title="resources[resource].name" class="resource-icon" :src="resources[resource].icon"> {{ currentQuest[resource] }} v-if="resources[resource].unlocked && currentQuest[resource] > 0"
:style="'color: ' + getColorForQuestResource(currentQuest[resource], resources[resource].amount)">
<img :title="resources[resource].name" class="resource-icon"
:src="resources[resource].icon"> {{ currentQuest[resource] }}
</span> </span>
<br/> <br/>
<br/> <br/>
<a href="javascript:" class="btn btn-sm btn-success float-right" @click="redeemReward()">Redeem reward ({{ currentQuest.reward }} <img class="resource-icon" src="img/gold.png">)</a> <a href="javascript:" class="btn btn-sm btn-success float-right" @click="redeemReward()">Redeem
<a class="btn btn-sm btn-info float-right" style="margin-right: 1em;" @click="generateQuestWithRandomItems(true)"><i class="fas fa-question"></i> Get a new quest for 250 <img class="resource-icon" src="img/gold.png"> ({{ 3 - questSkipCounter }} left)</a> reward ({{ currentQuest.reward }} <img class="resource-icon" src="img/gold.png">)</a>
<a class="btn btn-sm btn-info float-right" style="margin-right: 1em;"
@click="generateQuestWithRandomItems(true)"><i class="fas fa-question"></i> Get a new
quest
for 250 <img class="resource-icon" src="img/gold.png"> ({{ 3 - questSkipCounter }} left)</a>
</div> </div>
<div v-else> <div v-else>
You don't have a quest at the moment. <br/> You don't have a quest at the moment. <br/>
<br/> <br/>
<br/> <br/>
<a class="btn btn-sm btn-info float-right" @click="generateQuestWithRandomItems()"><i class="fas fa-question"></i> Get a new quest</a> <a class="btn btn-sm btn-info float-right" @click="generateQuestWithRandomItems()"><i
class="fas fa-question"></i> Get a new quest</a>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="col-md-6">
<div class="card"> <div class="card">
<a class="card-header" data-toggle="collapse" href="#collapseOwned" role="button" aria-expanded="true" aria-controls="collapseOwned"> <a class="card-header" data-toggle="collapse" href="#collapseOwned" role="button"
aria-expanded="true"
aria-controls="collapseOwned">
<h3>Owned buildings</h3> <h3>Owned buildings</h3>
</a> </a>
<div class="card-body" id="collapseOwned"> <div class="card-body" id="collapseOwned">
<ul class="list-group"> <ul class="list-group">
<li class="list-group-item" v-for="building in buildings" v-if="building.isOwned"> <li class="list-group-item" v-for="building in buildings" v-if="building.isOwned">
<div class="float-right" v-if="building.isUpgradeable"> <div class="float-right" v-if="building.isUpgradeable">
<a href="javascript:" @click="buyUpgrade(building)"><i class="fas fa-arrow-up text-success"></i> {{ building.price }} <img class="resource-icon" src="img/gold.png"> </a> <a href="javascript:" @click="buyUpgrade(building)"><i
class="fas fa-arrow-up text-success"></i> {{ building.price }} <img
class="resource-icon" src="img/gold.png"> </a>
</div> </div>
<div class="float-left icon-level-container"> <div class="float-left icon-level-container">
<img class="building-icon" :src="'img/' + building.icon + '.png'" :alt="building.name + '_icon'"> <img class="building-icon" :src="'img/' + building.icon + '.png'"
:alt="building.name + '_icon'">
<div class="level-marker">{{ building.level === 10 ? 'X' : building.level }}</div> <div class="level-marker">{{ building.level === 10 ? 'X' : building.level }}</div>
</div> </div>
<strong>{{ building.name }}</strong><br> <strong>{{ building.name }}</strong><br>
{{ building.amount }} <img class="resource-icon" :src="'img/' + building.resource + '.png'" :alt="building.resource + '_icon'"> every {{ building.intervalInSeconds }}s<br/> {{ building.amount }} <img class="resource-icon"
:src="'img/' + building.resource + '.png'"
:alt="building.resource + '_icon'"> every
{{ building.intervalInSeconds }}s<br/>
<span v-if="building.hasRequirements" v-html="getRequirementsText(building)"></span> <span v-if="building.hasRequirements" v-html="getRequirementsText(building)"></span>
<div class="progress"> <div class="progress">
<div class="progress-bar progress-bar-success text-light" role="progressbar" :style="'width: ' + building.loader + '%;'" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100"> <div class="progress-bar progress-bar-success text-light" role="progressbar"
:style="'width: ' + building.loader + '%;'" aria-valuenow="10"
aria-valuemin="0"
aria-valuemax="100">
<span v-if="!building.hasMissingResources"> <span v-if="!building.hasMissingResources">
{{ building.loader }} % {{ building.loader }} %
</span> </span>
@ -96,11 +131,9 @@
</ul> </ul>
</div> </div>
</div> </div>
</div>
<div class="col-md-6">
<div class="card"> <div class="card">
<a class="card-header" data-toggle="collapse" href="#collapseAvailable" role="button" aria-expanded="true" aria-controls="collapseAvailable"> <a class="card-header" data-toggle="collapse" href="#collapseAvailable" role="button"
aria-expanded="true" aria-controls="collapseAvailable">
<h3>Available buildings</h3> <h3>Available buildings</h3>
</a> </a>
<div class="card-body" id="collapseAvailable"> <div class="card-body" id="collapseAvailable">
@ -111,11 +144,15 @@
<template v-if="building.resourcesToBuild"> <template v-if="building.resourcesToBuild">
<i class="fas fa-hammer text-success"></i> <i class="fas fa-hammer text-success"></i>
<span v-for="(amount, resoureceName) in building.resourcesToBuild"> <span v-for="(amount, resoureceName) in building.resourcesToBuild">
{{ amount }} <img class="resource-icon" :src="resources[resoureceName].icon" :title="resources[resoureceName].icon" :alt="resources[resoureceName].icon"> {{ amount }} <img class="resource-icon" :src="resources[resoureceName].icon"
:title="resources[resoureceName].icon"
:alt="resources[resoureceName].icon">
</span> </span>
</template> </template>
<template v-else> <template v-else>
<i class="fas fa-shopping-basket text-success"></i> {{ building.price }} <img class="resource-icon" src="img/gold.png"> <i class="fas fa-shopping-basket text-success"></i> {{ building.price }}
<img
class="resource-icon" src="img/gold.png">
</template> </template>
</a> </a>
</div> </div>
@ -123,51 +160,56 @@
<img class="building-icon" :src="'img/' + building.icon + '.png'"> <img class="building-icon" :src="'img/' + building.icon + '.png'">
</div> </div>
<strong>{{ building.name }}</strong><br> <strong>{{ building.name }}</strong><br>
{{ building.amount }} <img class="resource-icon" :src="'img/' + building.resource + '.png'"> every {{ building.intervalInSeconds }}s<br/> {{ building.amount }} <img class="resource-icon"
:src="'img/' + building.resource + '.png'">
every {{ building.intervalInSeconds }}s<br/>
<span v-if="building.hasRequirements" v-html="getRequirementsText(building)"></span> <span v-if="building.hasRequirements" v-html="getRequirementsText(building)"></span>
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
</div>
<div class="col-md-12">
<div class="card"> <div class="card">
<a class="card-header" data-toggle="collapse" href="#collapseDebug" role="button" aria-expanded="true" aria-controls="collapseDebug"> <a class="card-header" data-toggle="collapse" href="#collapseDebug" role="button"
aria-expanded="true"
aria-controls="collapseDebug">
<h3>Debug</h3> <h3>Debug</h3>
</a> </a>
<div class="card-body" id="collapseDebug"> <div class="card-body" id="collapseDebug">
<a href="https://git.luna-development.net/neroignis/idle-buildup/issues"><i class="fas fa-bug"></i> Found a bug?</a><br/> <a href="https://git.luna-development.net/neroignis/idle-buildup/issues"><i
class="fas fa-bug"></i>
Found a bug?</a><br/>
<br/> <br/>
<input type="checkbox" v-model="debug.levelSandbox"> Buildings-Sandbox<br/> <input type="checkbox" v-model="debug.levelSandbox"> Buildings-Sandbox<br/>
<input type="checkbox" v-model="debug.buildingsSandbox"> Resource-Sandbox<br/> <input type="checkbox" v-model="debug.buildingsSandbox"> Resource-Sandbox<br/>
<!-- <a class="btn btn-sm btn-danger" style="margin: 0.5em;" href="javascript:" @click="resources = {gold: 500,wood: 50,stone: 50,iron: 50,bricks: 50,corn: 50,coal: 50,planks: 50}">Reset resources</a>--> <!-- <a class="btn btn-sm btn-danger" style="margin: 0.5em;" href="javascript:" @click="resources = {gold: 500,wood: 50,stone: 50,iron: 50,bricks: 50,corn: 50,coal: 50,planks: 50}">Reset resources</a>-->
<a class="btn btn-sm btn-danger" style="margin: 0.5em;" href="javascript:" @click="reset()">Soft reset (everything except resources)</a> <a class="btn btn-sm btn-danger" style="margin: 0.5em;" href="javascript:" @click="reset()">Soft
<a class="btn btn-sm btn-danger" style="margin: 0.5em;" href="javascript:" @click="reset(true)">Hard reset (everything)</a><br/> reset (everything except resources)</a>
<a class="btn btn-sm btn-danger" style="margin: 0.5em;" href="javascript:" @click="reset(true)">Hard
reset (everything)</a><br/>
</div> </div>
</div> </div>
</div>
<div class="col-md-12" v-if="debug.levelSandbox"> <div class="card" v-if="debug.levelSandbox">
<div class="card">
<div class="card-header">Buildings Sandbox</div> <div class="card-header">Buildings Sandbox</div>
<div class="card-body"> <div class="card-body">
<template v-for="building in buildings" v-if="building.amountPerLevel || building.intervalPerLevel || building.pricePerLevel"> <template v-for="building in buildings"
v-if="building.amountPerLevel || building.intervalPerLevel || building.pricePerLevel">
<h3><strong>{{ building.name }}</strong></h3> <h3><strong>{{ building.name }}</strong></h3>
Amout per Level:<br/> Amout per Level:<br/>
<input class="form-control form-control-sandbox" type="number" v-for="amount in building.amountPerLevel" :value="amount"><br/> <input class="form-control form-control-sandbox" type="number"
v-for="amount in building.amountPerLevel" :value="amount"><br/>
Interval per Level:<br/> Interval per Level:<br/>
<input class="form-control form-control-sandbox" type="number" v-for="interval in building.intervalPerLevel" :value="interval"><br/> <input class="form-control form-control-sandbox" type="number"
v-for="interval in building.intervalPerLevel" :value="interval"><br/>
Price per Level:<br/> Price per Level:<br/>
<input class="form-control form-control-sandbox" type="number" v-for="price in building.pricePerLevel" :value="price"><br/> <input class="form-control form-control-sandbox" type="number"
<hr/><br/> v-for="price in building.pricePerLevel" :value="price"><br/>
<hr/>
<br/>
</template> </template>
</div> </div>
</div> </div>
</div> <div class="card" v-if="debug.buildingsSandbox">
<div class="col-md-12" v-if="debug.buildingsSandbox">
<div class="card">
<div class="card-header">Resource Sandbox</div> <div class="card-header">Resource Sandbox</div>
<div class="card-body"> <div class="card-body">
<template v-for="resource in resources"> <template v-for="resource in resources">

74
js/app.js

@ -6,6 +6,7 @@ let game = new Vue({
levelSandbox: false, levelSandbox: false,
buildingsSandbox: false buildingsSandbox: false
}, },
map: [],
resources: { resources: {
gold: { gold: {
amount: 500, amount: 500,
@ -208,20 +209,69 @@ let game = new Vue({
loadedIntervals: [] loadedIntervals: []
}, },
created() { created() {
this.storageNames = { this.generateMap(100, 50);
lastVersion: 'lastVersion', this.setTile(1, 1, {
resources: 'resources' + this.version, asset: 'img/tiles/environment/birch_large.png'
buildings: 'buildings' + this.version, });
} this.setTile(1, 2, {
asset: 'img/tiles/environment/birch_large.png'
this.checkVersion(); });
this.setTile(2, 1, {
this.checkBuildings(); asset: 'img/tiles/environment/birch_large.png'
this.loadResourcesFromStorage(); });
this.loadBuildingsFromStorage(); this.setTile(2, 2, {
this.reloadBuildings(); asset: 'img/tiles/structure/house.png',
building: 'lumberjack'
});
this.setTile(5, 4, {
asset: 'img/tiles/structure/blacksmith.png',
building: 'blacksmith'
});
// this.storageNames = {
// lastVersion: 'lastVersion',
// resources: 'resources' + this.version,
// buildings: 'buildings' + this.version,
// }
//
// this.checkVersion();
//
// this.checkBuildings();
// this.loadResourcesFromStorage();
// this.loadBuildingsFromStorage();
// this.reloadBuildings();
}, },
methods: { methods: {
// Map generation
generateMap(rows, cols) {
let map = [];
for (let i = 0; i < rows; i++) {
let newRow = [];
for (let j = 0; j < cols; j++) {
newRow.push({
asset: 'img/tiles/trans.png',
building: null
});
}
map.push(newRow);
}
this.map = map;
},
setTile(x, y, tile) {
this.map[x-1][y-1] = tile;
},
interactWithTile(tile) {
if (tile.building) {
this.sendNotification(tile.building);
}
},
// System & Saving // System & Saving
// Check if a new version is played and notify the user of the loss of his beloved score & progress // Check if a new version is played and notify the user of the loss of his beloved score & progress
checkVersion() { checkVersion() {

Loading…
Cancel
Save