Code edit (1 edits merged)
Please save this source code
User prompt
Fix it
User prompt
Please fix the bug: 'TypeError: Cannot set properties of undefined (setting 'fill')' in or related to this line: 'ref.textObj.style.fill = 0x666666;' Line Number: 638
User prompt
Please fix the bug: 'TypeError: Cannot set properties of undefined (setting 'fill')' in or related to this line: 'ref.textObj.style.fill = 0x666666;' Line Number: 637
User prompt
Please fix the bug: 'TypeError: setTimeout is not a function' in or related to this line: 'setTimeout(function () {' Line Number: 75
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'p.lastX = ore.parent.x + ore.x;' Line Number: 317
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'p.x = ore.parent.x + ore.x;' Line Number: 317
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: setTimeout is not a function' in or related to this line: 'setTimeout(function () {' Line Number: 75
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'y')' in or related to this line: 'p.y = ore.y + ore.parent.y;' Line Number: 325
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'p.x = ore.x + ore.parent.x; // because ore is offset in the cluster' Line Number: 324
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'p.x = ore.x + ore.parent.x; // because ore is offset in the cluster' Line Number: 320
User prompt
Please fix the bug: 'TypeError: Cannot set properties of undefined (setting 'fill')' in or related to this line: 'ref.textObj.style.fill = 0x666666;' Line Number: 650
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'p.x = ore.x + ore.parent.x; // because ore is offset in the cluster' Line Number: 316
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'p.x = ore.x + ore.parent.x; // because ore is offset in the cluster' Line Number: 310
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'elapsed')' in or related to this line: 'self.y += Math.sin(LK.time.elapsed / 250) * 0.5;' Line Number: 70
User prompt
Please fix the bug: 'TypeError: setTimeout is not a function' in or related to this line: 'setTimeout(function () {' Line Number: 151
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'elapsed')' in or related to this line: 'self.y += Math.sin(LK.time.elapsed / 250) * 0.5;' Line Number: 69
Code edit (1 edits merged)
Please save this source code
User prompt
Make the buy buttons be behind each text in the buy menu
User prompt
Make the text inside of buy menu Black and Bold with a Black outline
User prompt
Move the cancel button to the left and down 200 pixels
User prompt
Move the cancel button to the upper right of menu background
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
/**
* A cluster container that spawns several Ore objects of the same type.
* We track how many remain. Once all are destroyed, we remove the cluster
* container from the game, then after a delay, spawn a new cluster if allowed.
*/
var Cluster = Container.expand(function (type) {
var self = Container.call(this);
self.type = type;
self.oreList = []; // the Ore objects in this cluster
// Random center
var centerX = 100 + Math.random() * (2048 - 200);
var centerY = 100 + Math.random() * (2732 - 200);
self.x = centerX;
self.y = centerY;
// Decide how many ore are in this cluster, based on the cluster config
var clusterConfig = gameState.clusterConfig;
var count = randomInt(clusterConfig.min, clusterConfig.max);
// Create each ore with random offsets
for (var i = 0; i < count; i++) {
var ore = new Ore(type, self);
ore.x = (Math.random() - 0.5) * 120;
ore.y = (Math.random() - 0.5) * 120;
self.oreList.push(ore);
self.addChild(ore);
}
// Called when an ore is destroyed
self.notifyOreDestroyed = function (ore) {
// remove from the container
if (self.oreList.indexOf(ore) >= 0) {
self.oreList.splice(self.oreList.indexOf(ore), 1);
}
ore.destroy();
// If all ore gone => cluster is done
if (self.oreList.length === 0) {
// remove cluster from stage
if (self.parent) {
self.parent.removeChild(self);
}
// remove from global array
var idx = clusters.indexOf(self);
if (idx >= 0) {
clusters.splice(idx, 1);
}
// Decrement cluster count
gameState.clusterCount[self.type]--;
// Wait for respawnTime, then spawn a new cluster if not exceeding max
// If type == 'coal', we slow it further, e.g. 2x
var finalDelay = gameState.respawnTime;
if (self.type === 'coal') {
finalDelay *= 2; // slow rate for coal
}
setTimeout(function () {
maybeSpawnCluster(self.type);
}, finalDelay);
}
};
return self;
});
/****
* HELPER / UTILITY FUNCTIONS
****/
// Spawns a new cluster if we haven't reached max for that type
/****
* CLASSES
****/
/**
* Miner class: Moves to the closest available ore (within currentTier)
* and mines it.
*/
var Miner = Container.expand(function () {
var self = Container.call(this);
self.attachAsset('miner', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.currentTarget = null;
self.miningRange = 25;
self.miningCooldown = 0;
self.miningRate = 30;
self.miningDamage = 1;
// findNewTarget picks from ALL clusters' ore, sorted by distance
self.findNewTarget = function () {
var validOre = [];
clusters.forEach(function (c) {
c.oreList.forEach(function (ore) {
// only if alive and within tier
if (ore.health > 0 && ore.tier <= gameState.currentTier) {
validOre.push(ore);
}
});
});
if (validOre.length === 0) {
self.currentTarget = null;
return;
}
self.currentTarget = validOre.sort(function (a, b) {
var distA = Math.hypot(a.x - self.x, a.y - self.y);
var distB = Math.hypot(b.x - self.x, b.y - self.y);
return distA - distB;
})[0];
};
self.update = function () {
self.findNewTarget();
if (self.currentTarget) {
var dx = self.currentTarget.x - self.x;
var dy = self.currentTarget.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > self.miningRange) {
self.x += dx / distance * self.speed;
self.y += dy / distance * self.speed;
} else {
self.mineOre(self.currentTarget);
}
} else {
// idle "hover"
self.y += Math.sin(LK.time.elapsed / 250) * 0.5;
}
};
self.mineOre = function (ore) {
if (self.miningCooldown > 0) {
self.miningCooldown--;
return;
}
// apply damage
ore.health -= self.miningDamage * gameState.pickaxeLevel;
self.miningCooldown = self.miningRate;
// if destroyed
if (ore.health <= 0) {
gameState.money += ore.getValue();
updateUI();
// Remove from its cluster
ore.cluster.notifyOreDestroyed(ore);
// Particles
spawnMiningParticles(ore, 5);
} else {
// Particles for each hit
spawnMiningParticles(ore, 2);
}
};
return self;
});
/**
* A single ore object.
*/
var Ore = Container.expand(function (type, cluster) {
var self = Container.call(this);
self.type = type;
self.cluster = cluster;
// Tier determination
self.tier = ['coal', 'iron', 'gold', 'diamond'].indexOf(type) + 1;
self.maxHealth = 10; // fixed
self.health = self.maxHealth;
// Base value depends on tier
self.baseValue = 5 * self.tier;
// Attach sprite
self.attachAsset(type + '_ore', {
anchorX: 0.5,
anchorY: 0.5
});
// Larger health bar, properly centered above the ore
// We'll make it 120 wide, 20 high, and anchorX=0.5
self.healthBar = LK.getAsset('rectangle', {
width: 120,
height: 20,
fill: 0x00FF00,
anchorX: 0.5,
anchorY: 0.5
});
// Position above ore
self.healthBar.x = 0;
self.healthBar.y = -70;
self.addChild(self.healthBar);
self.getValue = function () {
return self.baseValue * gameState.oreMultipliers[self.type];
};
return self;
});
/****
* Initialize Game
****/
/****
* THE GAME
****/
var game = new LK.Game({
backgroundColor: 0x1a1a1a
});
/****
* Game Code
****/
// We'll store references to cluster containers (one container per cluster).
/****
* GLOBAL ARRAYS & STATE
****/
/****
* PLUGINS
****/
/****
* ASSETS
****/
var clusters = [];
/****
* GAME STATE
****/
var gameState = {
money: 0,
pickaxeLevel: 1,
currentTier: 1,
// Multipliers for each ore type
oreMultipliers: {
coal: 1,
iron: 1,
gold: 1,
diamond: 1
},
// Respawn timing (in ms); if type = 'coal', we apply a separate multiplier to slow it down
respawnTime: 3000,
// Max clusters (per type) at once. The user wants 3 per type to prevent screen overload.
maxClustersPerType: 3,
// Track how many clusters of each type currently exist on screen
clusterCount: {
coal: 0,
iron: 0,
gold: 0,
diamond: 0
},
// Cluster range for spawning multiple ore objects inside one cluster
clusterConfigLevels: [{
min: 2,
max: 3
},
// default
{
min: 2,
max: 4
}, {
min: 3,
max: 5
}, {
min: 5,
max: 10
}],
clusterUpgradeTier: 0,
// By default, cluster spawning is in the first config (2-3)
get clusterConfig() {
return this.clusterConfigLevels[this.clusterUpgradeTier] || {
min: 2,
max: 3
};
}
};
/****
* HELPER / UTILITY FUNCTIONS
****/
// Spawns a new cluster if we haven't reached max for that type
function maybeSpawnCluster(type) {
// Tier check: don't spawn if locked
var tIndex = ['coal', 'iron', 'gold', 'diamond'].indexOf(type) + 1;
if (tIndex > gameState.currentTier) {
return;
}
// Check if we have space for a new cluster
if (gameState.clusterCount[type] >= gameState.maxClustersPerType) {
// do nothing, we've reached max
return;
}
// spawn a cluster
var cluster = new Cluster(type);
game.addChild(cluster);
clusters.push(cluster);
// increment cluster count
gameState.clusterCount[type]++;
}
// Random int between min and max inclusive
function randomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
// Particle effect for mining
function spawnMiningParticles(ore, num) {
for (var i = 0; i < num; i++) {
var p = LK.getAsset('mining_particle', {
anchorX: 0.5,
anchorY: 0.5
});
p.x = ore.x + ore.parent.x; // because ore is offset in the cluster
p.y = ore.y + ore.parent.y;
p.vx = (Math.random() - 0.5) * 10;
p.vy = (Math.random() - 0.5) * 10;
p.alpha = 1;
// tween out
tween(p, {
alpha: 0,
y: p.y - 50
}, {
duration: 1000,
onFinish: function onFinish() {
p.destroy();
}
});
game.addChild(p);
}
}
// Color interpolation
function interpolateColor(color1, color2, factor) {
var r1 = color1 >> 16 & 0xff;
var g1 = color1 >> 8 & 0xff;
var b1 = color1 & 0xff;
var r2 = color2 >> 16 & 0xff;
var g2 = color2 >> 8 & 0xff;
var b2 = color2 & 0xff;
var r = Math.round(r1 + factor * (r2 - r1));
var g = Math.round(g1 + factor * (g2 - g1));
var b = Math.round(b1 + factor * (b2 - b1));
return r << 16 | g << 8 | b;
}
var miner = game.addChild(new Miner());
miner.x = 2048 / 2;
miner.y = 2732 / 2;
// Background
var background = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5
});
background.x = 2048 / 2;
background.y = 2732 / 2;
game.addChildAt(background, 0);
// UI
var upgradeMenu = new Container();
var tooltip = new Text2('', {
size: 40,
fill: 0xFFFFFF
});
var moneyDisplay = new Text2('$0', {
size: 80,
fill: 0xFFFFFF,
fontWeight: 'bold',
stroke: 0x000000,
strokeThickness: 5
});
moneyDisplay.x = 2048 / 2 - moneyDisplay.width / 2;
moneyDisplay.y = 50;
var shopButton = LK.getAsset('buy_button', {
anchorX: 0.5,
anchorY: 0.5
});
shopButton.x = 2048 - 150;
shopButton.y = 2732 - 150;
shopButton.down = function () {
createUpgradeMenu();
game.addChild(upgradeMenu);
};
game.addChild(moneyDisplay);
game.addChild(shopButton);
game.addChild(tooltip);
/****
* MULTI-PURCHASABLE & OTHER UPGRADES
****/
var clusterUpgradeBaseCost = 1000;
// We store an object for each upgrade. For multi-purchase upgrades (like coal_expert),
// we allow repeated buys that keep doubling the cost, keep increasing effect, etc.
var upgrades = [{
id: 'coal_expert',
name: "Coal Expertise",
cost: 100,
multi: true,
// can be purchased repeatedly
level: 0,
// track how many times purchased
effect: "Doubles coal value each purchase",
tier: 1,
requires: null,
action: function action() {
this.level++;
// Each purchase x2 for coal
gameState.oreMultipliers.coal *= 2;
// Double cost for next time
this.cost *= 2;
}
}, {
id: 'unlock_iron',
name: "Unlock Iron Mining",
cost: 500,
effect: "Allows iron ore clusters to spawn",
tier: 2,
requires: null,
purchased: false,
action: function action() {
gameState.currentTier = 2;
}
}, {
id: 'iron_expert',
name: "Iron Expertise",
cost: 2000,
effect: "Triple iron value (one-time)",
tier: 2,
requires: 'unlock_iron',
action: function action() {
gameState.oreMultipliers.iron *= 3;
}
}, {
id: 'unlock_gold',
name: "Unlock Gold Mining",
cost: 5000,
effect: "Allows gold ore clusters to spawn",
tier: 3,
requires: null,
action: function action() {
gameState.currentTier = 3;
}
}, {
id: 'gold_expert',
name: "Gold Expertise",
cost: 10000,
effect: "Quadruple gold value (one-time)",
tier: 3,
requires: 'unlock_gold',
action: function action() {
gameState.oreMultipliers.gold *= 4;
}
}, {
id: 'unlock_diamond',
name: "Unlock Diamond Mining",
cost: 20000,
effect: "Allows diamond ore clusters to spawn",
tier: 4,
requires: null,
action: function action() {
gameState.currentTier = 4;
}
}, {
id: 'faster_respawn',
name: "Quicker Respawn",
cost: 8000,
effect: "Halves respawn time (min 500ms)",
tier: 2,
requires: null,
action: function action() {
gameState.respawnTime = Math.max(500, gameState.respawnTime / 2);
}
}, {
id: 'cluster_up',
name: "Cluster Growth [Tier 1]",
cost: clusterUpgradeBaseCost,
effect: "Increases cluster size range",
tier: 1,
requires: null,
action: function action() {
if (gameState.clusterUpgradeTier < gameState.clusterConfigLevels.length - 1) {
gameState.clusterUpgradeTier++;
}
// Increase cost for next purchase (if user wants multiple buys).
// We'll just add +2000 each time
this.cost += 2000;
}
}];
/****
* CREATE UPGRADE MENU
* We also want to fix:
* - The text behind button glitch
* - Real-time update of "canBuy" if money changes while the menu is open
****/
var upgradeItemRefs = []; // store references so we can update them each frame
function createUpgradeMenu() {
upgradeMenu.removeChildren();
upgradeItemRefs = [];
// Background
var menuBg = LK.getAsset('rectangle', {
width: 1600,
height: 1800,
color: 0x2a2a2a,
anchorX: 0.5,
anchorY: 0.5
});
menuBg.x = 2048 / 2;
menuBg.y = 2732 / 2;
upgradeMenu.addChild(menuBg);
// Update cluster upgrade display
var clusterUpObj = upgrades.find(function (u) {
return u.id === 'cluster_up';
});
if (clusterUpObj) {
clusterUpObj.name = "Cluster Growth [Tier " + (gameState.clusterUpgradeTier + 1) + "]";
var cfg = gameState.clusterConfig;
clusterUpObj.effect = "Spawns " + cfg.min + "-" + cfg.max + " per cluster";
}
// Go through each upgrade
upgrades.forEach(function (upg, i) {
var requirement = null;
if (upg.requires) {
requirement = upgrades.find(function (u) {
return u.id === upg.requires;
});
}
// If upg multi: we never set "purchased = true" permanently
// If not multi: we can set purchased after first buy
var yPos = 2732 / 2 - 500 + i * 200;
// Make a container for the button + text to ensure layering
var itemContainer = new Container();
itemContainer.x = 0;
itemContainer.y = 0;
upgradeMenu.addChild(itemContainer);
// Button
var btn = LK.getAsset('buy_button', {
anchorX: 0.5,
anchorY: 0.5
});
btn.x = 2048 / 2;
btn.y = yPos;
itemContainer.addChild(btn);
// For multi levels, e.g. coal_expert, show the level in the name
var displayName = upg.name;
if (upg.id === 'coal_expert' && upg.level > 0) {
displayName += " (Lv " + upg.level + ")";
}
// We'll create the text on top
var txtStr = displayName + "\n" + upg.effect + "\n$" + upg.cost;
var txt = new Text2(txtStr, {
size: 40,
align: 'center',
fill: 0x666666
});
txt.anchor.set(0.5);
txt.x = btn.x;
txt.y = btn.y;
itemContainer.addChild(txt);
// On click
btn.down = function () {
var canBuy = checkUpgradeable(upg, requirement);
if (canBuy) {
gameState.money -= upg.cost;
// If single-purchase (no multi)
if (!upg.multi) {
upg.purchased = true;
}
// Perform upgrade
upg.action();
// Refresh menu to update text (cost, name, etc.)
createUpgradeMenu();
updateUI();
}
};
// Keep references for real-time color update
upgradeItemRefs.push({
upgrade: upg,
requirement: requirement,
textObj: txt
});
});
// Close button
var closeBtn = LK.getAsset('cancelButton', {
anchorX: 0.5,
anchorY: 0.5
});
closeBtn.x = 2048 / 2 + 600;
closeBtn.y = 2732 / 2 - 700;
closeBtn.down = function () {
game.removeChild(upgradeMenu);
};
upgradeMenu.addChild(closeBtn);
}
/**
* Checks if an upgrade is currently purchasable, ignoring UI color state.
*/
function checkUpgradeable(upg, requirement) {
var hasReq = true;
if (requirement && !requirement.purchased) {
hasReq = false;
// For multi upgrades, "purchased" is irrelevant. If the requirement is single-purchase, we check that.
}
// If multi = true, do not block purchase after first time
if (!upg.multi && upg.purchased) {
return false;
}
// Must have enough money
if (gameState.money < upg.cost) {
return false;
}
return hasReq;
}
/****
* UPDATE UI
****/
function updateUI() {
moneyDisplay.setText("$" + gameState.money.toLocaleString() + "\n" + "Multipliers: C" + gameState.oreMultipliers.coal + "x " + "I" + gameState.oreMultipliers.iron + "x " + "G" + gameState.oreMultipliers.gold + "x " + "D" + gameState.oreMultipliers.diamond + "x");
moneyDisplay.x = 2048 / 2 - moneyDisplay.width / 2;
}
/****
* MAIN GAME UPDATE
* - Real-time update of the buy menu text color
* - Update ore health bars & fade, if needed
****/
game.update = function () {
// 1) Miner logic
miner.update();
// 2) For each cluster, update each ore's health bar & alpha
clusters.forEach(function (cluster) {
cluster.oreList.forEach(function (ore) {
if (ore.health > 0) {
var fraction = ore.health / ore.maxHealth;
ore.healthBar.width = 120 * fraction;
ore.healthBar.fill = interpolateColor(0xFF0000, 0x00FF00, fraction);
ore.alpha = fraction; // fade
}
});
});
// 3) If the upgradeMenu is open, check if items became purchasable
if (upgradeMenu.parent) {
// Re-check each item
upgradeItemRefs.forEach(function (ref) {
var canBuy = checkUpgradeable(ref.upgrade, ref.requirement);
// If canBuy => text color = 0xFFFFFF, else 0x666666
if (canBuy) {
ref.textObj.style.fill = 0xFFFFFF;
} else {
ref.textObj.style.fill = 0x666666;
}
});
}
};
/****
* SAVE & LOAD
****/
LK.saveGame = function () {
return gameState;
};
LK.loadGame = function (data) {
gameState = data;
updateUI();
};
/****
* INITIAL SETUP: spawn some clusters for each type up to currentTier
* But we only spawn if we haven't reached the max for that type yet.
****/
function initialSpawn() {
var oreTypes = ['coal', 'iron', 'gold', 'diamond'];
oreTypes.forEach(function (type, idx) {
var tier = idx + 1;
if (tier <= gameState.currentTier) {
// spawn up to maxClustersPerType immediately
for (var i = 0; i < gameState.maxClustersPerType; i++) {
maybeSpawnCluster(type);
}
// Typically you might spawn fewer, but the user request is unclear on how many to spawn at start.
// Feel free to reduce if desired.
}
});
}
// Start the game
initialSpawn();
updateUI();
/****
* END
****/ ===================================================================
--- original.js
+++ change.js
@@ -5,12 +5,77 @@
/****
* Classes
****/
+/**
+* A cluster container that spawns several Ore objects of the same type.
+* We track how many remain. Once all are destroyed, we remove the cluster
+* container from the game, then after a delay, spawn a new cluster if allowed.
+*/
+var Cluster = Container.expand(function (type) {
+ var self = Container.call(this);
+ self.type = type;
+ self.oreList = []; // the Ore objects in this cluster
+ // Random center
+ var centerX = 100 + Math.random() * (2048 - 200);
+ var centerY = 100 + Math.random() * (2732 - 200);
+ self.x = centerX;
+ self.y = centerY;
+ // Decide how many ore are in this cluster, based on the cluster config
+ var clusterConfig = gameState.clusterConfig;
+ var count = randomInt(clusterConfig.min, clusterConfig.max);
+ // Create each ore with random offsets
+ for (var i = 0; i < count; i++) {
+ var ore = new Ore(type, self);
+ ore.x = (Math.random() - 0.5) * 120;
+ ore.y = (Math.random() - 0.5) * 120;
+ self.oreList.push(ore);
+ self.addChild(ore);
+ }
+ // Called when an ore is destroyed
+ self.notifyOreDestroyed = function (ore) {
+ // remove from the container
+ if (self.oreList.indexOf(ore) >= 0) {
+ self.oreList.splice(self.oreList.indexOf(ore), 1);
+ }
+ ore.destroy();
+ // If all ore gone => cluster is done
+ if (self.oreList.length === 0) {
+ // remove cluster from stage
+ if (self.parent) {
+ self.parent.removeChild(self);
+ }
+ // remove from global array
+ var idx = clusters.indexOf(self);
+ if (idx >= 0) {
+ clusters.splice(idx, 1);
+ }
+ // Decrement cluster count
+ gameState.clusterCount[self.type]--;
+ // Wait for respawnTime, then spawn a new cluster if not exceeding max
+ // If type == 'coal', we slow it further, e.g. 2x
+ var finalDelay = gameState.respawnTime;
+ if (self.type === 'coal') {
+ finalDelay *= 2; // slow rate for coal
+ }
+ setTimeout(function () {
+ maybeSpawnCluster(self.type);
+ }, finalDelay);
+ }
+ };
+ return self;
+});
/****
+* HELPER / UTILITY FUNCTIONS
+****/
+// Spawns a new cluster if we haven't reached max for that type
+/****
* CLASSES
****/
-// Miner class
+/**
+* Miner class: Moves to the closest available ore (within currentTier)
+* and mines it.
+*/
var Miner = Container.expand(function () {
var self = Container.call(this);
self.attachAsset('miner', {
anchorX: 0.5,
@@ -21,19 +86,24 @@
self.miningRange = 25;
self.miningCooldown = 0;
self.miningRate = 30;
self.miningDamage = 1;
- // Finds the closest ore that is unlocked & still alive
+ // findNewTarget picks from ALL clusters' ore, sorted by distance
self.findNewTarget = function () {
- var validOres = ores.filter(function (ore) {
- return ore.health > 0 && ore.tier <= gameState.currentTier;
+ var validOre = [];
+ clusters.forEach(function (c) {
+ c.oreList.forEach(function (ore) {
+ // only if alive and within tier
+ if (ore.health > 0 && ore.tier <= gameState.currentTier) {
+ validOre.push(ore);
+ }
+ });
});
- if (validOres.length === 0) {
+ if (validOre.length === 0) {
self.currentTarget = null;
return;
}
- // Sort by distance ascending
- self.currentTarget = validOres.sort(function (a, b) {
+ self.currentTarget = validOre.sort(function (a, b) {
var distA = Math.hypot(a.x - self.x, a.y - self.y);
var distB = Math.hypot(b.x - self.x, b.y - self.y);
return distA - distB;
})[0];
@@ -50,326 +120,361 @@
} else {
self.mineOre(self.currentTarget);
}
} else {
- // Idle float
- self.y += Math.sin(LK.ticks / 250) * 0.5;
+ // idle "hover"
+ self.y += Math.sin(LK.time.elapsed / 250) * 0.5;
}
};
self.mineOre = function (ore) {
if (self.miningCooldown > 0) {
self.miningCooldown--;
return;
}
- // Deal damage
+ // apply damage
ore.health -= self.miningDamage * gameState.pickaxeLevel;
self.miningCooldown = self.miningRate;
- // If ore is destroyed, add money & spawn new cluster after delay
+ // if destroyed
if (ore.health <= 0) {
gameState.money += ore.getValue();
updateUI();
- ore.respawn();
- // Immediately look for a new target
- self.findNewTarget();
+ // Remove from its cluster
+ ore.cluster.notifyOreDestroyed(ore);
+ // Particles
+ spawnMiningParticles(ore, 5);
+ } else {
+ // Particles for each hit
+ spawnMiningParticles(ore, 2);
}
- // Mining particle effect
- for (var i = 0; i < 5; i++) {
- var p = LK.getAsset('mining_particle', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- p.x = ore.x;
- p.y = ore.y;
- p.vx = (Math.random() - 0.5) * 10;
- p.vy = (Math.random() - 0.5) * 10;
- p.alpha = 1;
- tween(p, {
- alpha: 0,
- y: p.y - 50
- }, {
- duration: 1000,
- onFinish: function onFinish() {
- p.destroy();
- }
- });
- game.addChild(p);
- }
};
return self;
});
-// Ore class
-var Ore = Container.expand(function (type) {
+/**
+* A single ore object.
+*/
+var Ore = Container.expand(function (type, cluster) {
var self = Container.call(this);
self.type = type;
+ self.cluster = cluster;
+ // Tier determination
self.tier = ['coal', 'iron', 'gold', 'diamond'].indexOf(type) + 1;
- // For fade-out effect
- self.maxHealth = 10;
+ self.maxHealth = 10; // fixed
self.health = self.maxHealth;
- // Base value depends on tier. Then multiplied by oreMultipliers in gameState.
+ // Base value depends on tier
self.baseValue = 5 * self.tier;
+ // Attach sprite
self.attachAsset(type + '_ore', {
anchorX: 0.5,
anchorY: 0.5
});
- // Health bar (bigger, and above the ore)
+ // Larger health bar, properly centered above the ore
+ // We'll make it 120 wide, 20 high, and anchorX=0.5
self.healthBar = LK.getAsset('rectangle', {
- width: 100,
- // bigger than default
- height: 10,
- fill: 0x00FF00
+ width: 120,
+ height: 20,
+ fill: 0x00FF00,
+ anchorX: 0.5,
+ anchorY: 0.5
});
+ // Position above ore
+ self.healthBar.x = 0;
self.healthBar.y = -70;
self.addChild(self.healthBar);
- // The final money from this ore
self.getValue = function () {
return self.baseValue * gameState.oreMultipliers[self.type];
};
- // Respawn = remove this ore, then spawn a new cluster after some delay
- self.respawn = function () {
- // Remove this ore from the game & from 'ores'
- self.destroy();
- var idx = ores.indexOf(self);
- if (idx !== -1) {
- ores.splice(idx, 1);
- }
- // Wait for respawnTime, then spawn a new cluster
- // of the same type with min–max from clusterConfig
- LK.setTimeout(function () {
- spawnCluster(self.type);
- }, gameState.respawnTime);
- };
return self;
});
/****
* Initialize Game
****/
/****
-* SPAWNING in CLUSTERS
+* THE GAME
****/
-// Spawn a cluster of {min–max} ore objects near a random center
-/****
-* Initialize the Game
-****/
var game = new LK.Game({
backgroundColor: 0x1a1a1a
});
/****
* Game Code
****/
-// Where all current ore objects go
+// We'll store references to cluster containers (one container per cluster).
/****
* GLOBAL ARRAYS & STATE
****/
/****
-* GAME CODE
+* PLUGINS
****/
-var ores = [];
-// Predefined cluster ranges for upgrades
-var clusterConfigLevels = [{
- min: 2,
- max: 3
-},
-// default
-{
- min: 2,
- max: 4
-}, {
- min: 3,
- max: 5
-}, {
- min: 5,
- max: 10
-}];
/****
-* SPAWNING in CLUSTERS
+* ASSETS
****/
-// Spawn a cluster of {min–max} ore objects near a random center
-function spawnCluster(type) {
- // If type not unlocked (tier > currentTier), no spawn
- var tierIndex = ['coal', 'iron', 'gold', 'diamond'].indexOf(type) + 1;
- if (tierIndex > gameState.currentTier) {
+var clusters = [];
+/****
+* GAME STATE
+****/
+var gameState = {
+ money: 0,
+ pickaxeLevel: 1,
+ currentTier: 1,
+ // Multipliers for each ore type
+ oreMultipliers: {
+ coal: 1,
+ iron: 1,
+ gold: 1,
+ diamond: 1
+ },
+ // Respawn timing (in ms); if type = 'coal', we apply a separate multiplier to slow it down
+ respawnTime: 3000,
+ // Max clusters (per type) at once. The user wants 3 per type to prevent screen overload.
+ maxClustersPerType: 3,
+ // Track how many clusters of each type currently exist on screen
+ clusterCount: {
+ coal: 0,
+ iron: 0,
+ gold: 0,
+ diamond: 0
+ },
+ // Cluster range for spawning multiple ore objects inside one cluster
+ clusterConfigLevels: [{
+ min: 2,
+ max: 3
+ },
+ // default
+ {
+ min: 2,
+ max: 4
+ }, {
+ min: 3,
+ max: 5
+ }, {
+ min: 5,
+ max: 10
+ }],
+ clusterUpgradeTier: 0,
+ // By default, cluster spawning is in the first config (2-3)
+ get clusterConfig() {
+ return this.clusterConfigLevels[this.clusterUpgradeTier] || {
+ min: 2,
+ max: 3
+ };
+ }
+};
+/****
+* HELPER / UTILITY FUNCTIONS
+****/
+// Spawns a new cluster if we haven't reached max for that type
+function maybeSpawnCluster(type) {
+ // Tier check: don't spawn if locked
+ var tIndex = ['coal', 'iron', 'gold', 'diamond'].indexOf(type) + 1;
+ if (tIndex > gameState.currentTier) {
return;
}
- var cfg = gameState.clusterConfig;
- var count = randomBetween(cfg.min, cfg.max);
- // Random center
- var centerX = 100 + Math.random() * (2048 - 200);
- var centerY = 100 + Math.random() * (2732 - 200);
- for (var i = 0; i < count; i++) {
- var ore = new Ore(type);
- // Random offset
- var offsetX = (Math.random() - 0.5) * 120;
- var offsetY = (Math.random() - 0.5) * 120;
- ore.x = centerX + offsetX;
- ore.y = centerY + offsetY;
- game.addChild(ore);
- ores.push(ore);
+ // Check if we have space for a new cluster
+ if (gameState.clusterCount[type] >= gameState.maxClustersPerType) {
+ // do nothing, we've reached max
+ return;
}
+ // spawn a cluster
+ var cluster = new Cluster(type);
+ game.addChild(cluster);
+ clusters.push(cluster);
+ // increment cluster count
+ gameState.clusterCount[type]++;
}
-// Utility to pick an integer between min and max inclusive
-function randomBetween(min, max) {
+// Random int between min and max inclusive
+function randomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
+// Particle effect for mining
+function spawnMiningParticles(ore, num) {
+ for (var i = 0; i < num; i++) {
+ var p = LK.getAsset('mining_particle', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ p.x = ore.x + ore.parent.x; // because ore is offset in the cluster
+ p.y = ore.y + ore.parent.y;
+ p.vx = (Math.random() - 0.5) * 10;
+ p.vy = (Math.random() - 0.5) * 10;
+ p.alpha = 1;
+ // tween out
+ tween(p, {
+ alpha: 0,
+ y: p.y - 50
+ }, {
+ duration: 1000,
+ onFinish: function onFinish() {
+ p.destroy();
+ }
+ });
+ game.addChild(p);
+ }
+}
+// Color interpolation
+function interpolateColor(color1, color2, factor) {
+ var r1 = color1 >> 16 & 0xff;
+ var g1 = color1 >> 8 & 0xff;
+ var b1 = color1 & 0xff;
+ var r2 = color2 >> 16 & 0xff;
+ var g2 = color2 >> 8 & 0xff;
+ var b2 = color2 & 0xff;
+ var r = Math.round(r1 + factor * (r2 - r1));
+ var g = Math.round(g1 + factor * (g2 - g1));
+ var b = Math.round(b1 + factor * (b2 - b1));
+ return r << 16 | g << 8 | b;
+}
+var miner = game.addChild(new Miner());
+miner.x = 2048 / 2;
+miner.y = 2732 / 2;
+// Background
+var background = LK.getAsset('background', {
+ anchorX: 0.5,
+ anchorY: 0.5
+});
+background.x = 2048 / 2;
+background.y = 2732 / 2;
+game.addChildAt(background, 0);
+// UI
var upgradeMenu = new Container();
var tooltip = new Text2('', {
size: 40,
fill: 0xFFFFFF
});
-// NEW cluster upgrade cost logic
-// Each time we buy it, the cost goes up, and we move to next cluster tier.
-var clusterUpgradeBaseCost = 1000;
+var moneyDisplay = new Text2('$0', {
+ size: 80,
+ fill: 0xFFFFFF,
+ fontWeight: 'bold',
+ stroke: 0x000000,
+ strokeThickness: 5
+});
+moneyDisplay.x = 2048 / 2 - moneyDisplay.width / 2;
+moneyDisplay.y = 50;
+var shopButton = LK.getAsset('buy_button', {
+ anchorX: 0.5,
+ anchorY: 0.5
+});
+shopButton.x = 2048 - 150;
+shopButton.y = 2732 - 150;
+shopButton.down = function () {
+ createUpgradeMenu();
+ game.addChild(upgradeMenu);
+};
+game.addChild(moneyDisplay);
+game.addChild(shopButton);
+game.addChild(tooltip);
/****
-* Upgrades
+* MULTI-PURCHASABLE & OTHER UPGRADES
****/
+var clusterUpgradeBaseCost = 1000;
+// We store an object for each upgrade. For multi-purchase upgrades (like coal_expert),
+// we allow repeated buys that keep doubling the cost, keep increasing effect, etc.
var upgrades = [{
id: 'coal_expert',
name: "Coal Expertise",
cost: 100,
- effect: "Double coal value",
+ multi: true,
+ // can be purchased repeatedly
+ level: 0,
+ // track how many times purchased
+ effect: "Doubles coal value each purchase",
tier: 1,
+ requires: null,
action: function action() {
+ this.level++;
+ // Each purchase x2 for coal
gameState.oreMultipliers.coal *= 2;
+ // Double cost for next time
+ this.cost *= 2;
}
}, {
id: 'unlock_iron',
- name: "Iron Mining",
+ name: "Unlock Iron Mining",
cost: 500,
- effect: "Unlock iron mining",
+ effect: "Allows iron ore clusters to spawn",
tier: 2,
+ requires: null,
+ purchased: false,
action: function action() {
gameState.currentTier = 2;
}
}, {
id: 'iron_expert',
name: "Iron Expertise",
cost: 2000,
- effect: "Triple iron value",
+ effect: "Triple iron value (one-time)",
tier: 2,
requires: 'unlock_iron',
action: function action() {
gameState.oreMultipliers.iron *= 3;
}
}, {
id: 'unlock_gold',
- name: "Gold Mining",
+ name: "Unlock Gold Mining",
cost: 5000,
- effect: "Unlock gold mining",
+ effect: "Allows gold ore clusters to spawn",
tier: 3,
+ requires: null,
action: function action() {
gameState.currentTier = 3;
}
}, {
id: 'gold_expert',
name: "Gold Expertise",
cost: 10000,
- effect: "Quadruple gold value",
+ effect: "Quadruple gold value (one-time)",
tier: 3,
requires: 'unlock_gold',
action: function action() {
gameState.oreMultipliers.gold *= 4;
}
}, {
id: 'unlock_diamond',
- name: "Diamond Mining",
+ name: "Unlock Diamond Mining",
cost: 20000,
- effect: "Unlock diamond mining",
+ effect: "Allows diamond ore clusters to spawn",
tier: 4,
+ requires: null,
action: function action() {
gameState.currentTier = 4;
}
}, {
id: 'faster_respawn',
name: "Quicker Respawn",
cost: 8000,
- effect: "Halves ore respawn time",
+ effect: "Halves respawn time (min 500ms)",
tier: 2,
+ requires: null,
action: function action() {
- // Halve the respawn time, min of 500 ms
gameState.respawnTime = Math.max(500, gameState.respawnTime / 2);
}
-},
-// The cluster upgrade
-{
+}, {
id: 'cluster_up',
name: "Cluster Growth [Tier 1]",
cost: clusterUpgradeBaseCost,
- effect: "Increases cluster spawn range",
+ effect: "Increases cluster size range",
tier: 1,
+ requires: null,
action: function action() {
- // Increase clusterUpgradeTier if possible
- if (gameState.clusterUpgradeTier < clusterConfigLevels.length - 1) {
+ if (gameState.clusterUpgradeTier < gameState.clusterConfigLevels.length - 1) {
gameState.clusterUpgradeTier++;
}
- // Update cost each purchase (optional: double or add a fixed amount)
- // Example: next cost is +2000
+ // Increase cost for next purchase (if user wants multiple buys).
+ // We'll just add +2000 each time
this.cost += 2000;
- // Update the cluster config in gameState
- gameState.clusterConfig = clusterConfigLevels[gameState.clusterUpgradeTier];
}
}];
-// Game state, including cluster setup
-var gameState = {
- money: 0,
- pickaxeLevel: 1,
- currentTier: 1,
- oreMultipliers: {
- coal: 1,
- iron: 1,
- gold: 1,
- diamond: 1
- },
- respawnTime: 3000,
- // in ms
- clusterUpgradeTier: 0,
- // index into clusterConfigLevels
- // Default cluster range is 2-3
- clusterConfig: {
- min: 2,
- max: 3
- }
-};
-// Create the Miner
-var miner = game.addChild(new Miner());
-miner.x = 2048 / 2;
-miner.y = 2732 / 2;
-// Background
-var background = LK.getAsset('background', {
- anchorX: 0.5,
- anchorY: 0.5
-});
-background.x = 2048 / 2;
-background.y = 2732 / 2;
-game.addChildAt(background, 0);
-// UI
-var moneyDisplay = new Text2('$0', {
- size: 80,
- fill: 0xFFFFFF,
- fontWeight: 'bold',
- stroke: 0x000000,
- strokeThickness: 5
-});
-moneyDisplay.x = 2048 / 2 - moneyDisplay.width / 2;
-moneyDisplay.y = 50;
-var shopButton = LK.getAsset('buy_button', {
- anchorX: 0.5,
- anchorY: 0.5
-});
-shopButton.x = 2048 - 150;
-shopButton.y = 2732 - 150;
-shopButton.down = function () {
- createUpgradeMenu();
- game.addChild(upgradeMenu);
-};
-game.addChild(moneyDisplay);
-game.addChild(shopButton);
-game.addChild(tooltip);
/****
* CREATE UPGRADE MENU
+* We also want to fix:
+* - The text behind button glitch
+* - Real-time update of "canBuy" if money changes while the menu is open
****/
+var upgradeItemRefs = []; // store references so we can update them each frame
function createUpgradeMenu() {
upgradeMenu.removeChildren();
+ upgradeItemRefs = [];
+ // Background
var menuBg = LK.getAsset('rectangle', {
width: 1600,
height: 1800,
color: 0x2a2a2a,
@@ -378,55 +483,79 @@
});
menuBg.x = 2048 / 2;
menuBg.y = 2732 / 2;
upgradeMenu.addChild(menuBg);
- // Dynamically update the cluster upgrade’s display
+ // Update cluster upgrade display
var clusterUpObj = upgrades.find(function (u) {
return u.id === 'cluster_up';
});
if (clusterUpObj) {
clusterUpObj.name = "Cluster Growth [Tier " + (gameState.clusterUpgradeTier + 1) + "]";
- var cfg = clusterConfigLevels[gameState.clusterUpgradeTier];
+ var cfg = gameState.clusterConfig;
clusterUpObj.effect = "Spawns " + cfg.min + "-" + cfg.max + " per cluster";
}
- upgrades.forEach(function (upgrade, i) {
- // Check requirements
+ // Go through each upgrade
+ upgrades.forEach(function (upg, i) {
var requirement = null;
- if (upgrade.requires) {
+ if (upg.requires) {
requirement = upgrades.find(function (u) {
- return u.id === upgrade.requires;
+ return u.id === upg.requires;
});
}
- var y = 2732 / 2 - 500 + i * 200;
- // The buy button
+ // If upg multi: we never set "purchased = true" permanently
+ // If not multi: we can set purchased after first buy
+ var yPos = 2732 / 2 - 500 + i * 200;
+ // Make a container for the button + text to ensure layering
+ var itemContainer = new Container();
+ itemContainer.x = 0;
+ itemContainer.y = 0;
+ upgradeMenu.addChild(itemContainer);
+ // Button
var btn = LK.getAsset('buy_button', {
anchorX: 0.5,
anchorY: 0.5
});
btn.x = 2048 / 2;
- btn.y = y;
- upgradeMenu.addChild(btn);
- var canBuy = !upgrade.purchased && gameState.money >= upgrade.cost && (!requirement || requirement.purchased);
- // Text on top of button
- var text = new Text2(upgrade.name + "\n" + upgrade.effect + "\n$" + upgrade.cost, {
+ btn.y = yPos;
+ itemContainer.addChild(btn);
+ // For multi levels, e.g. coal_expert, show the level in the name
+ var displayName = upg.name;
+ if (upg.id === 'coal_expert' && upg.level > 0) {
+ displayName += " (Lv " + upg.level + ")";
+ }
+ // We'll create the text on top
+ var txtStr = displayName + "\n" + upg.effect + "\n$" + upg.cost;
+ var txt = new Text2(txtStr, {
size: 40,
- fill: canBuy ? 0xFFFFFF : 0x666666,
- align: 'center'
+ align: 'center',
+ fill: 0x666666
});
- text.anchor.set(0.5, 0.5);
- text.x = btn.x;
- text.y = btn.y;
- upgradeMenu.addChild(text);
- // Button action
+ txt.anchor.set(0.5);
+ txt.x = btn.x;
+ txt.y = btn.y;
+ itemContainer.addChild(txt);
+ // On click
btn.down = function () {
+ var canBuy = checkUpgradeable(upg, requirement);
if (canBuy) {
- gameState.money -= upgrade.cost;
- upgrade.purchased = true;
- upgrade.action();
+ gameState.money -= upg.cost;
+ // If single-purchase (no multi)
+ if (!upg.multi) {
+ upg.purchased = true;
+ }
+ // Perform upgrade
+ upg.action();
+ // Refresh menu to update text (cost, name, etc.)
createUpgradeMenu();
updateUI();
}
};
+ // Keep references for real-time color update
+ upgradeItemRefs.push({
+ upgrade: upg,
+ requirement: requirement,
+ textObj: txt
+ });
});
// Close button
var closeBtn = LK.getAsset('cancelButton', {
anchorX: 0.5,
@@ -438,48 +567,68 @@
game.removeChild(upgradeMenu);
};
upgradeMenu.addChild(closeBtn);
}
+/**
+* Checks if an upgrade is currently purchasable, ignoring UI color state.
+*/
+function checkUpgradeable(upg, requirement) {
+ var hasReq = true;
+ if (requirement && !requirement.purchased) {
+ hasReq = false;
+ // For multi upgrades, "purchased" is irrelevant. If the requirement is single-purchase, we check that.
+ }
+ // If multi = true, do not block purchase after first time
+ if (!upg.multi && upg.purchased) {
+ return false;
+ }
+ // Must have enough money
+ if (gameState.money < upg.cost) {
+ return false;
+ }
+ return hasReq;
+}
/****
* UPDATE UI
****/
function updateUI() {
- moneyDisplay.setText("$" + gameState.money.toLocaleString() + "\n" + "Multipliers: " + "C" + gameState.oreMultipliers.coal + "x " + "I" + gameState.oreMultipliers.iron + "x " + "G" + gameState.oreMultipliers.gold + "x " + "D" + gameState.oreMultipliers.diamond + "x");
+ moneyDisplay.setText("$" + gameState.money.toLocaleString() + "\n" + "Multipliers: C" + gameState.oreMultipliers.coal + "x " + "I" + gameState.oreMultipliers.iron + "x " + "G" + gameState.oreMultipliers.gold + "x " + "D" + gameState.oreMultipliers.diamond + "x");
moneyDisplay.x = 2048 / 2 - moneyDisplay.width / 2;
}
/****
* MAIN GAME UPDATE
+* - Real-time update of the buy menu text color
+* - Update ore health bars & fade, if needed
****/
game.update = function () {
+ // 1) Miner logic
miner.update();
- // Update ore health bars & alpha fade
- ores.forEach(function (ore) {
- if (ore.health > 0) {
- var fraction = ore.health / ore.maxHealth;
- // Health bar width & color
- ore.healthBar.width = 100 * fraction;
- ore.healthBar.fill = interpolateColor(0xFF0000, 0x00FF00, fraction);
- // Fade out
- ore.alpha = fraction;
- }
+ // 2) For each cluster, update each ore's health bar & alpha
+ clusters.forEach(function (cluster) {
+ cluster.oreList.forEach(function (ore) {
+ if (ore.health > 0) {
+ var fraction = ore.health / ore.maxHealth;
+ ore.healthBar.width = 120 * fraction;
+ ore.healthBar.fill = interpolateColor(0xFF0000, 0x00FF00, fraction);
+ ore.alpha = fraction; // fade
+ }
+ });
});
+ // 3) If the upgradeMenu is open, check if items became purchasable
+ if (upgradeMenu.parent) {
+ // Re-check each item
+ upgradeItemRefs.forEach(function (ref) {
+ var canBuy = checkUpgradeable(ref.upgrade, ref.requirement);
+ // If canBuy => text color = 0xFFFFFF, else 0x666666
+ if (canBuy) {
+ ref.textObj.style.fill = 0xFFFFFF;
+ } else {
+ ref.textObj.style.fill = 0x666666;
+ }
+ });
+ }
};
/****
-* COLOR HELPER
-****/
-function interpolateColor(color1, color2, factor) {
- var r1 = color1 >> 16 & 0xff;
- var g1 = color1 >> 8 & 0xff;
- var b1 = color1 & 0xff;
- var r2 = color2 >> 16 & 0xff;
- var g2 = color2 >> 8 & 0xff;
- var b2 = color2 & 0xff;
- var r = Math.round(r1 + factor * (r2 - r1));
- var g = Math.round(g1 + factor * (g2 - g1));
- var b = Math.round(b1 + factor * (b2 - b1));
- return r << 16 | g << 8 | b;
-}
-/****
* SAVE & LOAD
****/
LK.saveGame = function () {
return gameState;
@@ -488,19 +637,27 @@
gameState = data;
updateUI();
};
/****
-* INITIAL SPAWN
+* INITIAL SETUP: spawn some clusters for each type up to currentTier
+* But we only spawn if we haven't reached the max for that type yet.
****/
-// Spawn clusters of each type up to your currentTier
function initialSpawn() {
- var types = ['coal', 'iron', 'gold', 'diamond'];
- types.forEach(function (type, index) {
- // If type's tier <= currentTier, spawn a cluster of it
- var tier = index + 1;
+ var oreTypes = ['coal', 'iron', 'gold', 'diamond'];
+ oreTypes.forEach(function (type, idx) {
+ var tier = idx + 1;
if (tier <= gameState.currentTier) {
- spawnCluster(type);
+ // spawn up to maxClustersPerType immediately
+ for (var i = 0; i < gameState.maxClustersPerType; i++) {
+ maybeSpawnCluster(type);
+ }
+ // Typically you might spawn fewer, but the user request is unclear on how many to spawn at start.
+ // Feel free to reduce if desired.
}
});
}
+// Start the game
initialSpawn();
-updateUI();
\ No newline at end of file
+updateUI();
+/****
+* END
+****/
\ No newline at end of file
drone_shot
Sound effect
mine_coal
Sound effect
mine_iron
Sound effect
mine_gold
Sound effect
mine_diamond
Sound effect
mine_sapphire
Sound effect
mine_emerald
Sound effect
mine_ruby
Sound effect
mine_chronostone
Sound effect
mine_quantumshard
Sound effect
ore_destroy_coal
Sound effect
ore_destroy_iron
Sound effect
ore_destroy_gold
Sound effect
ore_destroy_diamond
Sound effect
ore_destroy_sapphire
Sound effect
ore_destroy_emerald
Sound effect
ore_destroy_ruby
Sound effect
mine_coal_1
Sound effect
mine_coal_2
Sound effect
mine_coal_3
Sound effect
mine_diamond1
Sound effect
mine_diamond2
Sound effect
mine_diamond3
Sound effect
mine_emerald1
Sound effect
mine_emerald2
Sound effect
mine_emerald3
Sound effect
mine_gold1
Sound effect
mine_gold2
Sound effect
mine_gold3
Sound effect
mine_iron1
Sound effect
mine_iron2
Sound effect
mine_iron3
Sound effect
mine_ruby1
Sound effect
mine_ruby2
Sound effect
mine_ruby3
Sound effect
mine_sapphire1
Sound effect
mine_sapphire2
Sound effect
mine_sapphire3
Sound effect
song1
Music
song2
Music
song3
Music
song4
Music
song5
Music
song6
Music
song7
Music
song8
Music
song9
Music
song10
Music
song11
Music
song12
Music
song1a
Music
song1b
Music
song2a
Music
song2b
Music
song3a
Music
song3b
Music
song4a
Music
song4b
Music
song5a
Music
song5b
Music
song6a
Music
song6b
Music
song7a
Music
song7b
Music
song8a
Music
song8b
Music
song9a
Music
song9b
Music
song10a
Music
song10b
Music
song11a
Music
song11b
Music
song12a
Music
song12b
Music