Skip to content

Commit

Permalink
increasing stone amount while having stone pits
Browse files Browse the repository at this point in the history
  • Loading branch information
bjazdzyk committed Nov 15, 2021
1 parent 0094dbb commit 13a4df2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ let woodLimit = 500
let stone = 300
let stoneLimit = 500

let stoneIncreasing = 0

let time = Date.now()
let lastTime = Date.now()

Expand All @@ -348,6 +350,10 @@ const loop = (tick) => {
window.requestAnimationFrame(loop)
time = Date.now()

if(time%100<=20){
stone = Math.min(stoneLimit, stone+stoneIncreasing)
}

_W = window.innerWidth
_H = window.innerHeight
a = _H / krat * 2
Expand Down Expand Up @@ -503,6 +509,7 @@ c.addEventListener('mousedown', e => {
//placed building
if(E[strcoords(cursor.x, cursor.y)] && (T[strcoords(cursor.x, cursor.y)] == 1 || T[strcoords(cursor.x, cursor.y)] == 2) && O[strcoords(cursor.x, cursor.y)] === 0){
if(stone >= 50 && wood >=20){
stoneIncreasing += 0.1
stone -= 50
wood -= 20
B[strcoords(cursor.x, cursor.y)] = placing
Expand Down

0 comments on commit 13a4df2

Please sign in to comment.