User prompt
play ruzgar sound continuously while mouse triggers air_particle asset.
User prompt
ruzgar sesi sol mouse basılı olduğu sürece devamlı çalsın.
User prompt
Must reactivate pickaxe by player when "ruzgar" sound is not playing
User prompt
"ruzgar" sesi bittiğinde oyuncu tekrar sol mouse basarak tetik versin.
User prompt
play "ruzgar" sound asset when air particles are active.
User prompt
"Tap the ores to mine them" yazısını "Statik'ten kurtulmak için tıklatın" olarak değiştir.
User prompt
kodda "Crystal Rush Miner" başlığını altın sarısı renkler ile "Föge Defense" alt satırına da beyaz font ile "Clean The Line" olarak değiştir.
User prompt
only destroy closest mineral to the pickaxe's left side when air particles are active
User prompt
only destroy closest mineral to the "pickaxe" when air particle is activated
User prompt
Modify air particle collision detection to only destroy closest mineral when "air_particle" asset is activated.
User prompt
only destroy the closest mineral when "pickaxe" asset triggerd.
User prompt
Modify air particle collision detection to only destroy the closest mineral.
User prompt
tekrar dener misin? "all minerals" assetleri hemen yok olmakta. benim isteğim, "pickaxe" asseti aktif edilip bu asset ucundan çıkan hava partikülleri "all minerals" assetlerine değdiğinde yok olması. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
hava partikülleri, *All minerals** (gold, emerald, diamond, coal, copper, iron ) değdiğinde bu assetler yok olsun.
User prompt
hava partikülleri, sol mouse tuşuna basılı tutulduğunda art arda aktif olsun. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
air particle creation şeklini değiştir, daha uzağa giden hava püskürtme olarak. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
"pickaxe" asseti sol mouse ile basıldığında, resmin sol ucundan hava püskürmesini istiyorum. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
"pickaxe" asseti aktif edildiğinde, "air_partical" asset resmi gösterilsin. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
"pickaxe" asseti aktif edildiğinde, asset resminde bulunan kırmızı yuvarlık uç tarafından içerisinde "+" ve "-" iyonlar bulunduran hava çıkışı gösterilsin. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
"pickaxe" assetini oyun içerisinde aktif ettiğimde yani mouse sol tuşu ile bastığımda ucundan beyaz hava süzülerek diğer assetleri silsin. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
*All minerals** (gold, emerald, diamond, coal, copper, iron ) could be restricted to specific zones like: X ekseni: 200 – 1700 px aralığında Y ekseni: 1400 – 2000 px aralığında
User prompt
*All minerals** (gold, emerald, diamond, coal, copper, iron ) could be restricted to specific zones like: X ekseni: 200 – 1700 px aralığında Y ekseni: 1400 – 1900 px aralığında
User prompt
SO *All minerals** (gold, emerald, diamond, coal, copper, iron ) could be restricted to specific zones like: X ekseni: 200 – 1700 px aralığında Y ekseni: 1200 – 1700 px aralığında
User prompt
*All minerals** (gold, emerald, diamond, coal, copper, iron ) could be restricted to specific zones like: X ekseni: 200 – 2000 px aralığında Y ekseni: 1200 – 1700 px aralığında
User prompt
*All minerals** (gold, emerald, diamond, coal, copper, iron ) could be restricted to specific zones like: X ekseni: 600 – 2800 px aralığında Y ekseni: 1200 – 1700 px aralığında
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var MenuButton = Container.expand(function (text, difficulty, x, y) {
var self = Container.call(this);
self.difficulty = difficulty;
// Create button background with difficulty-specific asset
var buttonAsset = 'button_' + difficulty;
var buttonBg = self.attachAsset(buttonAsset, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2,
scaleY: 1.5
});
// Create button text
var buttonText = new Text2(text, {
size: 60,
fill: 0x000000,
stroke: 0x000000,
strokeThickness: 2
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
// Position button
self.x = x;
self.y = y;
// Button press handler
self.down = function (x, y, obj) {
// Visual feedback
tween(self, {
scaleX: 0.95,
scaleY: 0.95
}, {
duration: 100,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(self, {
scaleX: 1,
scaleY: 1
}, {
duration: 100,
easing: tween.easeOut
});
}
});
// Start game with selected difficulty
startGameWithDifficulty(self.difficulty);
};
return self;
});
var Mineral = Container.expand(function (type) {
var self = Container.call(this);
self.type = type;
self.mineralData = mineralTypes[type];
var mineralGraphics = self.attachAsset(type, {
anchorX: 0.5,
anchorY: 0.5
});
// Initialize properties
self.timeLeft = self.mineralData.duration;
self.maxTime = self.mineralData.duration;
self.isCollected = false;
self.hasLostLife = false;
// Add sparkle effect for rare minerals
if (self.mineralData.rarity >= 3) {
tween(mineralGraphics, {
alpha: 0.7
}, {
duration: 500,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(mineralGraphics, {
alpha: 1
}, {
duration: 500,
easing: tween.easeInOut
});
}
});
}
self.update = function () {
if (self.isCollected) {
return;
}
self.timeLeft -= 16.67; // Roughly 60 FPS
// Flash when time is running out
if (self.timeLeft < 1000) {
var flashAlpha = Math.sin(LK.ticks * 0.5) * 0.3 + 0.7;
mineralGraphics.alpha = flashAlpha;
}
// Remove when time expires
if (self.timeLeft <= 0) {
self.expire();
}
};
self.collect = function () {
if (self.isCollected) {
return;
}
self.isCollected = true;
// Add score
var points = self.mineralData.points * scoreMultiplier;
LK.setScore(LK.getScore() + points);
// Increase multiplier
scoreMultiplier = Math.min(scoreMultiplier + 0.1, 5);
consecutiveCollections++;
// Play sound
LK.getSound('mine').play();
// Animation
tween(mineralGraphics, {
scaleX: 1.5,
scaleY: 1.5,
alpha: 0
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
// Remove from minerals array
for (var i = minerals.length - 1; i >= 0; i--) {
if (minerals[i] === self) {
minerals.splice(i, 1);
break;
}
}
// Update UI
updateScoreDisplay();
};
self.expire = function () {
// Only lose life if we haven't already lost one for this mineral
if (!self.hasLostLife) {
// Reset multiplier on missed mineral
scoreMultiplier = 1;
consecutiveCollections = 0;
// Lose a life
currentLives--;
self.hasLostLife = true;
updateScoreDisplay();
// Check game over
if (currentLives <= 0) {
LK.showGameOver();
return;
}
}
// Fade out animation
tween(mineralGraphics, {
alpha: 0,
scaleX: 0.5,
scaleY: 0.5
}, {
duration: 200,
onFinish: function onFinish() {
self.destroy();
}
});
// Remove from minerals array
for (var i = minerals.length - 1; i >= 0; i--) {
if (minerals[i] === self) {
minerals.splice(i, 1);
break;
}
}
};
self.down = function (x, y, obj) {
self.collect();
};
return self;
});
var Pickaxe = Container.expand(function () {
var self = Container.call(this);
var pickaxeGraphics = self.attachAsset('pickaxe', {
anchorX: 0.5,
anchorY: 0.5
});
// Initialize position
self.targetX = 1024;
self.targetY = 1366;
self.x = self.targetX;
self.y = self.targetY;
// Smooth following properties
self.followSpeed = 0.15;
// Air particles array
self.airParticles = [];
self.isActive = false;
self.update = function () {
// Smooth movement towards target position
var dx = self.targetX - self.x;
var dy = self.targetY - self.y;
self.x += dx * self.followSpeed;
self.y += dy * self.followSpeed;
// Add subtle swaying animation
var sway = Math.sin(LK.ticks * 0.05) * 2;
pickaxeGraphics.rotation = sway * 0.1;
// Continuous air particle creation when active
if (self.isActive) {
// Create air particles every 5 frames (about 12 times per second)
if (LK.ticks % 5 === 0) {
self.createAirParticles();
}
}
// Check air particle collisions with minerals
for (var p = self.airParticles.length - 1; p >= 0; p--) {
var particle = self.airParticles[p];
if (!particle.parent) continue; // Skip destroyed particles
// Check collision with all minerals
for (var m = minerals.length - 1; m >= 0; m--) {
var mineral = minerals[m];
if (mineral.isCollected) continue; // Skip already collected minerals
// Calculate distance between particle and mineral
var dx = particle.x - mineral.x;
var dy = particle.y - mineral.y;
var distance = Math.sqrt(dx * dx + dy * dy);
// Check if particle intersects with mineral (using mineral's asset size)
var mineralRadius = 75; // Approximate radius for mineral collision
var particleRadius = 10; // Air particle radius
if (distance < mineralRadius + particleRadius) {
// Destroy the mineral
mineral.collect();
// Optionally destroy the particle that hit the mineral
particle.destroy();
self.airParticles.splice(p, 1);
break; // Exit mineral loop since particle is destroyed
}
}
}
};
self.setTarget = function (x, y) {
self.targetX = x;
self.targetY = y;
// Add a little shake effect when moving to new position
tween(pickaxeGraphics, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 100,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(pickaxeGraphics, {
scaleX: 1,
scaleY: 1
}, {
duration: 100,
easing: tween.easeOut
});
}
});
};
self.activate = function () {
self.isActive = true;
};
self.deactivate = function () {
self.isActive = false;
};
self.createAirParticles = function () {
// Calculate left tip position of the pickaxe image
// The pickaxe image has its anchor at center (0.5, 0.5)
// Left tip would be at the leftmost edge of the image
var tipOffsetX = -100; // Left side of the pickaxe (negative X from center)
var tipOffsetY = -80; // Slightly up from center to match the actual tip position
var tipX = self.x + tipOffsetX;
var tipY = self.y + tipOffsetY;
// Create multiple air particles for a powerful blast effect
for (var i = 0; i < 20; i++) {
// Create air particle
var airParticle = LK.getAsset('air_particle', {
anchorX: 0.5,
anchorY: 0.5
});
airParticle.x = tipX;
airParticle.y = tipY;
// Create a cone-shaped blast pattern pointing left
var baseAngle = Math.PI; // Point left (180 degrees)
var coneSpread = Math.PI * 0.8; // 144 degree cone spread
var randomAngle = baseAngle + (Math.random() - 0.5) * coneSpread;
// Much higher speed for farther travel
var speed = 400 + Math.random() * 600; // 400-1000 pixel range
var targetX = tipX + Math.cos(randomAngle) * speed;
var targetY = tipY + Math.sin(randomAngle) * speed;
// Add some random starting scale variation
airParticle.scaleX = 0.8 + Math.random() * 0.4;
airParticle.scaleY = 0.8 + Math.random() * 0.4;
game.addChild(airParticle);
self.airParticles.push(airParticle);
// Animate particle movement with longer duration for farther travel
tween(airParticle, {
x: targetX,
y: targetY,
alpha: 0,
scaleX: 0.1,
scaleY: 0.1
}, {
duration: 1800 + Math.random() * 400,
// 1.8-2.2 seconds for long travel
easing: tween.easeOut,
onFinish: function onFinish() {
if (airParticle.parent) {
airParticle.destroy();
}
// Remove from airParticles array
for (var j = self.airParticles.length - 1; j >= 0; j--) {
if (self.airParticles[j] === airParticle) {
self.airParticles.splice(j, 1);
break;
}
}
}
});
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a2e
});
/****
* Game Code
****/
// Add mining background
var backgroundImage = game.attachAsset('mining_background', {
x: 0,
y: 0,
anchorX: 0,
anchorY: 0
});
// Game state
var gameState = 'menu'; // 'menu' or 'playing'
var currentDifficulty = 'normal';
// Game variables
var minerals = [];
var scoreMultiplier = 1;
var consecutiveCollections = 0;
var gameTime = 0;
var targetScore = 10000;
var currentLives = 3;
var maxLives = 3;
var lifeRegenTimer = 0;
var lifeRegenInterval = 30000; // 30 seconds
var spawnRateIncrease = 1; // Track spawn rate multiplier for endless mode
// Pickaxe
var pickaxe = new Pickaxe();
game.addChild(pickaxe);
// Menu elements
var menuContainer;
var titleText;
var menuButtons = [];
// Difficulty configurations
var difficultySettings = {
easy: {
name: 'Easy',
targetScore: 8000,
pointMultiplier: 1,
spawnRateMultiplier: 1.5,
durationMultiplier: 1.5,
lives: 5
},
normal: {
name: 'Normal',
targetScore: 15000,
pointMultiplier: 1,
spawnRateMultiplier: 1,
durationMultiplier: 1,
lives: 3
},
hard: {
name: 'Hard',
targetScore: 30000,
pointMultiplier: 1,
spawnRateMultiplier: 0.7,
durationMultiplier: 0.8,
lives: 2
},
endless: {
name: 'Endless',
targetScore: -1,
// No target score for endless
pointMultiplier: 1,
spawnRateMultiplier: 0.85,
durationMultiplier: 0.9,
lives: 5
}
};
// Base mineral type definitions (will be modified by difficulty)
var baseMineralTypes = {
coal: {
points: 10,
duration: 5000,
spawnRate: 2500,
rarity: 1
},
copper: {
points: 20,
duration: 5000,
spawnRate: 3000,
rarity: 1
},
iron: {
points: 50,
duration: 4000,
spawnRate: 6000,
rarity: 2
},
silver: {
points: 80,
duration: 4000,
spawnRate: 7000,
rarity: 2
},
gold: {
points: 200,
duration: 3000,
spawnRate: 12000,
rarity: 3
},
emerald: {
points: 300,
duration: 3000,
spawnRate: 15000,
rarity: 3
},
diamond: {
points: 800,
duration: 2000,
spawnRate: 25000,
rarity: 4
},
ruby: {
points: 1000,
duration: 2000,
spawnRate: 30000,
rarity: 4
}
};
// Current mineral types (adjusted for difficulty)
var mineralTypes = {};
var mineralTypeArray = Object.keys(mineralTypes);
// Spawn timers for each mineral type
var spawnTimers = {};
for (var i = 0; i < mineralTypeArray.length; i++) {
var type = mineralTypeArray[i];
spawnTimers[type] = 0;
}
// UI Elements
var scoreTxt = new Text2('Score: 0', {
size: 80,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 3
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
var multiplierTxt = new Text2('x1.0', {
size: 60,
fill: 0xFFFF00,
stroke: 0x000000,
strokeThickness: 2
});
multiplierTxt.anchor.set(1, 0);
multiplierTxt.x = -20;
multiplierTxt.y = 20;
LK.gui.topRight.addChild(multiplierTxt);
var targetTxt = new Text2('Target: ' + targetScore, {
size: 50,
fill: 0x00FF00,
stroke: 0x000000,
strokeThickness: 2
});
targetTxt.anchor.set(0, 0);
targetTxt.x = 120;
targetTxt.y = 20;
LK.gui.topLeft.addChild(targetTxt);
var livesTxt = new Text2('Lives: ' + currentLives, {
size: 50,
fill: 0xFF0000,
stroke: 0x000000,
strokeThickness: 2
});
livesTxt.anchor.set(0, 0);
livesTxt.x = 120;
livesTxt.y = 80;
LK.gui.topLeft.addChild(livesTxt);
function spawnMineral(type) {
var mineral = new Mineral(type);
// Restricted spawn area - X: 200-1700px, Y: 1400-2000px
var leftBoundary = 200;
var rightBoundary = 1700;
var topBoundary = 1400;
var bottomBoundary = 2000;
mineral.x = leftBoundary + Math.random() * (rightBoundary - leftBoundary);
mineral.y = topBoundary + Math.random() * (bottomBoundary - topBoundary);
// Ensure it doesn't overlap with existing minerals too much and avoid UI areas
var attempts = 0;
while (attempts < 10) {
var tooClose = false;
var inUIArea = false;
// Check if mineral overlaps with UI areas
// Top-left pause button area (expanded to 200x200 for safety)
if (mineral.x < 200 && mineral.y < 200) {
inUIArea = true;
}
// Top score area (center top)
if (mineral.x > 700 && mineral.x < 1348 && mineral.y < 150) {
inUIArea = true;
}
// Top-right multiplier area (expanded)
if (mineral.x > 1700 && mineral.y < 150) {
inUIArea = true;
}
// Top-left counters area (target score and lives)
if (mineral.x < 500 && mineral.y < 200) {
inUIArea = true;
}
// Check distance from existing minerals
for (var i = 0; i < minerals.length; i++) {
var existingMineral = minerals[i];
var dx = mineral.x - existingMineral.x;
var dy = mineral.y - existingMineral.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 200) {
tooClose = true;
break;
}
}
if (!tooClose && !inUIArea) {
break;
}
mineral.x = leftBoundary + Math.random() * (rightBoundary - leftBoundary);
mineral.y = topBoundary + Math.random() * (bottomBoundary - topBoundary);
attempts++;
}
minerals.push(mineral);
game.addChild(mineral);
// Spawn animation
mineral.scaleX = 0;
mineral.scaleY = 0;
tween(mineral, {
scaleX: 1,
scaleY: 1
}, {
duration: 300,
easing: tween.easeOut
});
}
function createMenu() {
menuContainer = new Container();
game.addChild(menuContainer);
// Title
titleText = new Text2('Crystal Rush Miner', {
size: 120,
fill: 0x00CCFF,
stroke: 0x000000,
strokeThickness: 4
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 1024;
titleText.y = 600;
menuContainer.addChild(titleText);
// Subtitle
var subtitleText = new Text2('Select Difficulty', {
size: 80,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 3
});
subtitleText.anchor.set(0.5, 0.5);
subtitleText.x = 1024;
subtitleText.y = 750;
menuContainer.addChild(subtitleText);
// Create difficulty buttons
var buttonY = 1000;
var buttonSpacing = 450;
var easyBtn = new MenuButton('Easy\n8,000 pts', 'easy', 1024 - buttonSpacing * 1.5, buttonY);
var normalBtn = new MenuButton('Normal\n15,000 pts', 'normal', 1024 - buttonSpacing * 0.5, buttonY);
var hardBtn = new MenuButton('Hard\n30,000 pts', 'hard', 1024 + buttonSpacing * 0.5, buttonY);
var endlessBtn = new MenuButton('Endless\nNo Limit', 'endless', 1024 + buttonSpacing * 1.5, buttonY);
menuButtons.push(easyBtn, normalBtn, hardBtn, endlessBtn);
menuContainer.addChild(easyBtn);
menuContainer.addChild(normalBtn);
menuContainer.addChild(hardBtn);
menuContainer.addChild(endlessBtn);
// Add instruction text below buttons
var instructionText = new Text2('Tap the ores to mine them', {
size: 60,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 3
});
instructionText.anchor.set(0.5, 0.5);
instructionText.x = 1024;
instructionText.y = buttonY + 200;
menuContainer.addChild(instructionText);
}
function startGameWithDifficulty(difficulty) {
currentDifficulty = difficulty;
gameState = 'playing';
// Hide menu
if (menuContainer) {
menuContainer.visible = false;
}
// Apply difficulty settings
var settings = difficultySettings[difficulty];
targetScore = settings.targetScore;
// Scale mineral types based on difficulty
mineralTypes = {};
var baseTypes = Object.keys(baseMineralTypes);
for (var i = 0; i < baseTypes.length; i++) {
var type = baseTypes[i];
var base = baseMineralTypes[type];
mineralTypes[type] = {
points: Math.floor(base.points * settings.pointMultiplier),
duration: Math.floor(base.duration * settings.durationMultiplier),
spawnRate: Math.floor(base.spawnRate * settings.spawnRateMultiplier),
rarity: base.rarity
};
}
// Reset game variables
minerals = [];
scoreMultiplier = 1;
consecutiveCollections = 0;
gameTime = 0;
currentLives = settings.lives;
maxLives = settings.lives;
lifeRegenTimer = 0;
spawnRateIncrease = 1; // Reset spawn rate multiplier
LK.setScore(0);
// Initialize spawn timers
mineralTypeArray = Object.keys(mineralTypes);
spawnTimers = {};
for (var i = 0; i < mineralTypeArray.length; i++) {
var type = mineralTypeArray[i];
spawnTimers[type] = 0;
}
// Update UI
updateScoreDisplay();
// Start background music
LK.playMusic('mining_ambient');
}
function updateScoreDisplay() {
scoreTxt.setText('Score: ' + LK.getScore());
multiplierTxt.setText('x' + scoreMultiplier.toFixed(1));
livesTxt.setText('Lives: ' + currentLives);
// Update target display based on difficulty
if (currentDifficulty === 'endless') {
targetTxt.setText('Mode: Endless');
} else {
targetTxt.setText('Target: ' + targetScore);
}
// Check win condition (only for non-endless modes)
if (currentDifficulty !== 'endless' && LK.getScore() >= targetScore) {
LK.showYouWin();
}
}
// Touch/Mouse movement handler
game.move = function (x, y, obj) {
if (gameState === 'playing' && pickaxe) {
pickaxe.setTarget(x, y);
}
};
// Touch/Mouse down handler
game.down = function (x, y, obj) {
if (gameState === 'playing' && pickaxe) {
pickaxe.setTarget(x, y);
pickaxe.activate();
}
};
// Touch/Mouse up handler
game.up = function (x, y, obj) {
if (gameState === 'playing' && pickaxe) {
pickaxe.deactivate();
}
};
// Initialize menu
createMenu();
game.update = function () {
// Only update game logic when playing
if (gameState !== 'playing') {
return;
}
gameTime += 16.67; // Roughly 60 FPS
// Update spawn timers and spawn minerals
for (var i = 0; i < mineralTypeArray.length; i++) {
var type = mineralTypeArray[i];
var mineralData = mineralTypes[type];
spawnTimers[type] += 16.67;
// Apply spawn rate increase for endless mode
var effectiveSpawnRate = mineralData.spawnRate;
if (currentDifficulty === 'endless') {
effectiveSpawnRate = mineralData.spawnRate / spawnRateIncrease;
}
if (spawnTimers[type] >= effectiveSpawnRate) {
spawnTimers[type] = 0;
spawnMineral(type);
}
}
// Gradually decrease multiplier if no collections for a while
if (consecutiveCollections === 0 && gameTime % 3000 < 16.67) {
scoreMultiplier = Math.max(scoreMultiplier - 0.1, 1);
updateScoreDisplay();
}
// Life regeneration for endless mode
if (currentDifficulty === 'endless') {
lifeRegenTimer += 16.67;
if (lifeRegenTimer >= lifeRegenInterval && currentLives < maxLives) {
currentLives++;
lifeRegenTimer = 0;
updateScoreDisplay();
// Flash the lives text green to indicate regeneration
tween(livesTxt, {
tint: 0x00FF00
}, {
duration: 200,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(livesTxt, {
tint: 0xFFFFFF
}, {
duration: 200,
easing: tween.easeInOut
});
}
});
}
// Increase spawn rate over time in endless mode (every 30 seconds)
if (gameTime % 30000 < 16.67) {
spawnRateIncrease = Math.min(spawnRateIncrease + 0.1, 3); // Cap at 3x spawn rate
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -203,9 +203,8 @@
if (self.isActive) {
// Create air particles every 5 frames (about 12 times per second)
if (LK.ticks % 5 === 0) {
self.createAirParticles();
- self.destroyNearbyMinerals();
}
}
// Check air particle collisions with minerals
for (var p = self.airParticles.length - 1; p >= 0; p--) {
@@ -315,26 +314,8 @@
}
});
}
};
- self.destroyNearbyMinerals = function () {
- // Calculate pickaxe tip position
- var tipOffsetX = Math.sin(pickaxeGraphics.rotation) * 100;
- var tipOffsetY = -Math.cos(pickaxeGraphics.rotation) * 100;
- var tipX = self.x + tipOffsetX;
- var tipY = self.y + tipOffsetY;
- // Check all minerals for collision with air effect area
- for (var i = minerals.length - 1; i >= 0; i--) {
- var mineral = minerals[i];
- var dx = mineral.x - tipX;
- var dy = mineral.y - tipY;
- var distance = Math.sqrt(dx * dx + dy * dy);
- // If mineral is within air effect range (150px radius)
- if (distance < 150) {
- mineral.collect();
- }
- }
- };
return self;
});
/****