Letti42
well, im trying to make it so when the player clicks on a grid, it sets a timer to execute those lines of code.
(it's some ore mining game thingy)
for (var gridI = 0; gridI < grids.length; gridI++) {
if (mouseIsOver(grids[gridI]) && mouseWentDown("leftButton")) {
grids[gridI].destroy();
grids.splice();
for (var stonesI = 0; stonesI < stones.length; stonesI++) {if (mouseIsOver(stones[stonesI]) && mouseWentDown("leftButton")) {cash += oreStats.stone.cash;}}
for (var goldsI = 0; goldsI < golds.length; goldsI++) {if (mouseIsOver(golds[goldsI]) && mouseWentDown("leftButton")) {cash += oreStats.gold.cash;}}
for (var topazesI = 0; topazesI < topazes.length; topazesI++) {if (mouseIsOver(topazes[topazesI]) && mouseWentDown("leftButton")) {cash += oreStats.topaz.cash;}}
for (var emeraldsI = 0; emeraldsI < emeralds.length; emeraldsI++) {if (mouseIsOver(emeralds[emeraldsI]) && mouseWentDown("leftButton")) {cash += oreStats.emerald.cash;}}
for (var rubiesI = 0; rubiesI < rubies.length; rubiesI++) {if (mouseIsOver(rubies[rubiesI]) && mouseWentDown("leftButton")) {cash += oreStats.ruby.cash;}}
for (var sapphiresI = 0; sapphiresI < sapphires.length; sapphiresI++) {if (mouseIsOver(sapphires[sapphiresI]) && mouseWentDown("leftButton")) {cash += oreStats.sapphire.cash;}}
for (var amethystsI = 0; amethystsI < amethysts.length; amethystsI++) {if (mouseIsOver(amethysts[amethystsI]) && mouseWentDown("leftButton")) {cash += oreStats.amethyst.cash;}}
for (var diamondsI = 0; diamondsI < diamonds.length; diamondsI++) {if (mouseIsOver(diamonds[diamondsI]) && mouseWentDown("leftButton")) {cash += oreStats.diamond.cash;}}
for (var plutonitesI = 0; plutonitesI < plutonites.length; plutonitesI++) {if (mouseIsOver(plutonites[diamondsI]) && mouseWentDown("leftButton")) {cash += oreStats.diamond.cash;}}
}
}