whats wrong here, it gives me an endresult in playerSrcript.ore of 240000+ while the ore amount is 90?
oreAmount -=1.0*(Time.deltaTime*miningSpeed);
PlayerScript.ore +=(oreAmountStart-oreAmount);
its placed in the OnGUI function.
whats wrong here, it gives me an endresult in playerSrcript.ore of 240000+ while the ore amount is 90?
oreAmount -=1.0*(Time.deltaTime*miningSpeed);
PlayerScript.ore +=(oreAmountStart-oreAmount);
its placed in the OnGUI function.
You’re the second person today I’ve seen multiply something by just “1”. Why? Are you just testing the identiy theorem at runtime to make sure hundreds of years of mathematical theory are right?
Also you’re adding the difference of oreAmount and oreAmountStart every frame. Of course this is going to compound quickly.
float minedOre = Time.deltaTime*miningSpeed;
oreAmount -= minedOre;
PlayerScript.ore += minedOre;
@lordofduct yeah it was 0.5 originally, the idea was to count done the oreAmount by a half every second the player is near it…
thx JamesLeeNZ works like a charm