User prompt
score 807 target 750 iken bölümü geçemiyorum kontrol edermisin ? ayrıca shopta harcamalarımdan kalan score diğerinin üzerine eklenmiyor olabilir.
User prompt
level 4 750 score ben 777 score yaptım ama oyun bitti level 10a kadar gitmeli ayrıca bölümlerde maksimum 2 mystery bag olabilir.
User prompt
shop ekranındaki yazıların arkasındaki görsel için bir asset oluştururmusun ayrıca araları biraz açık olsun yazılar üst üste gelmiş
User prompt
levellarda target score u geçsemde game over oluyor level sistemini dikkatli olarak güncelleyelim. ayrıca süre bittikten sonra eğer target score u geçtiysek level 2 ye geçmeli ayrıca. shop ekranında mevcut scorun yarısını silmeli öyle gelmeli
User prompt
game over olduktan sonra tekrar level 1 den başlamalıyız.
User prompt
her seviyede puan sıfırlanmalı. Süre level 2 ye geldikten sonra geri saymayı durduruyorç
User prompt
level sistemi eklemek istiyorum her level için gereken puan artmalı ve her seviye sonunda market özelliğini kullanarak oyuncular isterse +5 +10 +15 saniye ve +1 +2 +3 dinamit gibi özellikleri satın alabilmeli. alınan her özellik sıradaki seviye için kullanılabilir. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
eşyalara gölge ekleyelim böyle çok kötü duruyor
User prompt
goldların değerler ifarketmiyor bunu çözmek yerine goldların harici farklı bir eşyada ekleyelim örneğin yakut eklemek zümrüt eklemek gold 50 altın olmalı yakut 70 zümrüt 85 diamond 100 domuzcuklu diamond 150.
User prompt
claw drop distance biraz daha arttırılmalı ayrıca gold nıggetlar büyükte olsa 20 küçükte olsa 20 puan veriyor düzenlenmesi gerekiyor.
User prompt
gold ların boyutları random olmalı büyük altınlar daha fazla değere sahip olmalı. Bir mystery bag eklemek istiyorum her bölümde 1 adet çıkacak. bu mystery bagin içinden rastgele elmas yada rastgele değerde altın çıkabilir. Ayrıca bir dinamit sistemi eklemek istiyorum.bu mystery bagin içinden çıkabilir. Eğer limizde dinamit var ise Tnt yada taş çektiğimizde onu otomatik fırlatıp hemen clawı resetleyebilir.
User prompt
daha büyük bir gold nugget olmalı şuanda hepsinin değeri 60 ama büyüklerin değerleri daha fazla olmalı
User prompt
her oyunda mutlaka çok büyük bir gold nugget olmalı
User prompt
gold nuggetlar boyutlarına göre değerleri farklı olmalı küçükler ucuzken büyükler daha fazla puan vermeli
User prompt
normal diamond sayısı 2 olsun 3 tane domuzcuk sabit altın sayısını arttırabiliriz
User prompt
miner için kullandığımız asset hareketli olabilirmi image yerine makara saran bir karakter koymak istiyorum
User prompt
baktığı yönün tam zıttına gidiyor şuanda ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
ters yöne gidiyor şuanda ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
claw baktığı yöne gitsin düzelt artık şunu
User prompt
Claw angle soldaki max açıdayken tıklarsam max dereceye gitmiyor. daha aşasında bir açıya gidiyor ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
claw ile drop ters yönlerde yine ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
claw angle ile gittiği nokta aynı olmuyor. çok sağa baktığında bile oraya gitmiyor. oyun ekranının içinden çıkmamalı claw ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
claw angle biraz daha artmalı çok köşelerde çıkanları alamıyoruz . Ayrıca yakalanacak tüm eşyalar biraz daha aşağılarda spawn olmalı çünkü çok yakın oluyorlar. ürünler iç içe çıkmamalı tnt en fazla 3 adet olmalı.
User prompt
claw çok hızlı gidip geliyor. sabit hızla gitmeli çektiği eşyanın büyüklüğüne göre yavaş yada hızlı çekmeli. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
drop distance dahada yükselt şuanda oyun ekranının yarısı kadar dropluyor ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Claw = Container.expand(function () {
var self = Container.call(this);
var clawGraphics = self.attachAsset('claw', {
anchorX: 0.5,
anchorY: 0.5
});
// Cable removed - no longer visible
self.swingAngle = 0;
self.swingSpeed = 0.02;
self.swingRadius = 300;
self.centerX = 1024; // Center position
self.startX = 1024; // Starting X position - same as center
self.isDropping = false;
self.isRetracting = false;
self.dropSpeed = 8;
self.retractSpeed = 6;
self.startY = 350;
self.grabbedItem = null;
self.weight = 1;
self.isRetractingStarted = false;
self.update = function () {
if (!self.isDropping && !self.isRetracting) {
// Swing back and forth by rotating the claw
self.swingAngle += self.swingSpeed;
self.rotation = Math.sin(self.swingAngle) * 1.8; // Rotate between -1.8 and 1.8 radians for much wider swing
}
// Dropping is now handled by tween animation in drop() method
if (self.isRetracting && !self.isRetractingStarted) {
self.isRetractingStarted = true;
// Calculate distance back to start position
var distanceBack = Math.sqrt(Math.pow(self.startX - self.x, 2) + Math.pow(self.startY - self.y, 2));
// Base retraction speed (pixels per second) - slower when carrying items
var baseRetractSpeed = 600; // pixels per second when empty
var weightedRetractSpeed = baseRetractSpeed / self.weight; // Slower for heavier items
var retractDuration = distanceBack / weightedRetractSpeed * 1000; // Convert to milliseconds
// Use tween to move claw back to start position
tween(self, {
x: self.startX,
y: self.startY
}, {
duration: retractDuration,
easing: tween.linear,
onFinish: function onFinish() {
self.isRetracting = false;
self.isRetractingStarted = false;
// Use a small delay to ensure item collection happens cleanly
if (self.grabbedItem) {
LK.setTimeout(function () {
if (self.grabbedItem) {
// Double check item still exists
self.collectItem();
}
}, 50);
}
}
});
}
// Move grabbed item with claw
if (self.grabbedItem) {
self.grabbedItem.x = self.x;
self.grabbedItem.y = self.y + 40;
}
// Cable positioning removed - cable is now invisible
};
self.drop = function () {
if (!self.isDropping && !self.isRetracting) {
self.isDropping = true;
// Calculate target position based on current rotation
var targetDistance = 1800; // How far the claw should extend - increased to reach bottom of screen
// Use the rotation directly to calculate the target position
var targetX = self.x + Math.sin(self.rotation) * targetDistance;
var targetY = self.startY + targetDistance;
// Ensure claw stays within screen bounds
if (targetX < 50) targetX = 50;
if (targetX > 1998) targetX = 1998;
// Calculate distance to target
var distance = Math.sqrt(Math.pow(targetX - self.x, 2) + Math.pow(targetY - self.y, 2));
// Use constant speed for dropping (pixels per second)
var dropSpeed = 800; // pixels per second
var dropDuration = distance / dropSpeed * 1000; // Convert to milliseconds
// Use tween to move claw directly to target position
tween(self, {
x: targetX,
y: targetY
}, {
duration: dropDuration,
easing: tween.linear,
onFinish: function onFinish() {
self.isDropping = false;
self.isRetracting = true;
}
});
LK.getSound('clawMove').play();
}
};
self.collectItem = function () {
if (self.grabbedItem) {
var itemToCollect = self.grabbedItem; // Store reference before clearing
self.grabbedItem = null; // Clear reference immediately to prevent double collection
self.weight = 1; // Reset weight immediately
// Add to score based on item type
var points = 0;
if (itemToCollect.itemType === 'gold') {
points = 50;
} else if (itemToCollect.itemType === 'diamond') {
points = 100;
} else if (itemToCollect.itemType === 'rock') {
points = 10;
} else if (itemToCollect.itemType === 'pig') {
points = 150; // Higher value for pig with diamond
} else if (itemToCollect.itemType === 'tnt') {
// TNT explodes and resets score to 0
LK.setScore(0);
scoreText.setText('Score: 0');
// Flash screen red for explosion effect
LK.effects.flashScreen(0xFF0000, 1000);
points = 0;
}
if (itemToCollect.itemType !== 'tnt') {
LK.setScore(LK.getScore() + points);
scoreText.setText('Score: ' + LK.getScore());
}
// Remove item from items array
for (var i = items.length - 1; i >= 0; i--) {
if (items[i] === itemToCollect) {
items[i].destroy();
items.splice(i, 1);
break;
}
}
LK.getSound('collect').play();
}
};
return self;
});
var Miner = Container.expand(function () {
var self = Container.call(this);
// Create miner character using a shape asset
var minerGraphics = self.attachAsset('miner', {
anchorX: 0.5,
anchorY: 1
});
return self;
});
var MiningItem = Container.expand(function (itemType) {
var self = Container.call(this);
self.itemType = itemType;
var assetName = '';
var scale = 1;
if (itemType === 'gold') {
assetName = 'goldNugget';
self.weight = 1.5;
// Random scale between 0.7 and 1.3
scale = 0.7 + Math.random() * 0.6;
self.weight *= scale; // Adjust weight based on size
} else if (itemType === 'diamond') {
assetName = 'diamond';
self.weight = 1;
} else if (itemType === 'rock') {
assetName = 'rock';
self.weight = 3;
// Random scale between 0.6 and 1.4
scale = 0.6 + Math.random() * 0.8;
self.weight *= scale; // Adjust weight based on size
} else if (itemType === 'tnt') {
assetName = 'tnt';
self.weight = 2;
}
var itemGraphics = self.attachAsset(assetName, {
anchorX: 0.5,
anchorY: 0.5
});
// Apply random scale
itemGraphics.scaleX = scale;
itemGraphics.scaleY = scale;
return self;
});
var Pig = Container.expand(function () {
var self = Container.call(this);
var pigGraphics = self.attachAsset('pig', {
anchorX: 0.5,
anchorY: 0.5
});
var diamond = self.attachAsset('diamond', {
anchorX: 0.5,
anchorY: 0.5
});
diamond.x = 0;
diamond.y = -10; // Position diamond in pig's "mouth"
diamond.scaleX = 0.6;
diamond.scaleY = 0.6;
// Random movement speed between 0.5 and 2.5
self.moveSpeed = 0.5 + Math.random() * 2;
// Random initial direction
self.direction = Math.random() < 0.5 ? -1 : 1;
// Random movement range between 150 and 350
self.moveRange = 150 + Math.random() * 200;
self.startX = 0;
self.itemType = 'pig';
self.weight = 2;
self.update = function () {
// Move pig back and forth
self.x += self.moveSpeed * self.direction;
if (self.x > self.startX + self.moveRange || self.x < self.startX - self.moveRange) {
self.direction *= -1;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Game assets will be created dynamically
// Game variables
var claw;
var items = [];
var gameTime = 60; // 60 seconds per level
var timeLeft = gameTime;
var gameActive = true;
var scoreText;
var timeText;
var gameTimer;
// Create sky background
var sky = game.attachAsset('sky', {
x: 0,
y: 0
});
// Create ground
var ground = game.attachAsset('ground', {
x: 0,
y: 300
});
// Create miner character
var miner = game.addChild(new Miner());
miner.x = 1024;
miner.y = 300;
// Create claw
claw = game.addChild(new Claw());
claw.x = 1024;
claw.y = 350;
// Create UI elements
scoreText = new Text2('Score: 0', {
size: 80,
fill: 0xFFFFFF
});
scoreText.anchor.set(0, 0);
LK.gui.topLeft.addChild(scoreText);
scoreText.x = 120; // Avoid top-left menu area
timeText = new Text2('Time: 60', {
size: 80,
fill: 0xFFFFFF
});
timeText.anchor.set(1, 0);
LK.gui.topRight.addChild(timeText);
// Generate random items underground
function generateItems() {
var itemTypes = ['gold', 'diamond', 'rock', 'tnt'];
var itemCount = 25;
var tntCount = 0;
var maxTnt = 3;
var occupiedPositions = []; // Track positions to prevent overlap
var minDistance = 120; // Minimum distance between items
for (var i = 0; i < itemCount; i++) {
var itemType = itemTypes[Math.floor(Math.random() * itemTypes.length)];
// Limit TNT to 3 pieces maximum
if (itemType === 'tnt') {
if (tntCount >= maxTnt) {
// Replace with another item type
itemType = itemTypes[Math.floor(Math.random() * (itemTypes.length - 1))]; // Exclude TNT
} else {
tntCount++;
}
}
var item = new MiningItem(itemType);
// Find a position that doesn't overlap with existing items
var validPosition = false;
var attempts = 0;
var maxAttempts = 50;
while (!validPosition && attempts < maxAttempts) {
// Random position underground - moved much further down
item.x = Math.random() * 1800 + 124; // Keep within bounds
item.y = Math.random() * 1200 + 800; // Much deeper underground area
// Check if position is far enough from other items
validPosition = true;
for (var j = 0; j < occupiedPositions.length; j++) {
var distance = Math.sqrt(Math.pow(item.x - occupiedPositions[j].x, 2) + Math.pow(item.y - occupiedPositions[j].y, 2));
if (distance < minDistance) {
validPosition = false;
break;
}
}
attempts++;
}
// Store position for overlap checking
occupiedPositions.push({
x: item.x,
y: item.y
});
items.push(item);
game.addChild(item);
}
// Add moving pigs with diamonds - also moved further down
var pigCount = 3;
for (var i = 0; i < pigCount; i++) {
var pig = new Pig();
// Find position that doesn't overlap with items
var validPosition = false;
var attempts = 0;
var maxAttempts = 50;
while (!validPosition && attempts < maxAttempts) {
pig.x = Math.random() * 1600 + 200;
pig.y = Math.random() * 600 + 1000; // Much deeper underground
// Check if position is far enough from other items
validPosition = true;
for (var j = 0; j < occupiedPositions.length; j++) {
var distance = Math.sqrt(Math.pow(pig.x - occupiedPositions[j].x, 2) + Math.pow(pig.y - occupiedPositions[j].y, 2));
if (distance < minDistance) {
validPosition = false;
break;
}
}
attempts++;
}
pig.startX = pig.x;
occupiedPositions.push({
x: pig.x,
y: pig.y
});
items.push(pig);
game.addChild(pig);
}
}
// Initialize items
generateItems();
// Game timer
gameTimer = LK.setInterval(function () {
if (gameActive) {
timeLeft--;
timeText.setText('Time: ' + timeLeft);
if (timeLeft <= 0) {
gameActive = false;
LK.clearInterval(gameTimer);
// Small delay before showing game over
LK.setTimeout(function () {
LK.showGameOver();
}, 500);
}
}
}, 1000);
// Touch/click handler for dropping claw
game.down = function (x, y, obj) {
if (gameActive) {
claw.drop();
}
};
// Main game update loop
game.update = function () {
if (!gameActive) return;
// Check for item collection - only when claw (not cable) touches items
if (claw.isDropping && !claw.grabbedItem) {
for (var i = 0; i < items.length; i++) {
var item = items[i];
// Check collision using distance-based detection focused on claw position
// This ensures only the claw itself (not the cable) triggers collection
var clawCenterX = claw.x;
var clawCenterY = claw.y;
var itemCenterX = item.x;
var itemCenterY = item.y;
var distance = Math.sqrt(Math.pow(clawCenterX - itemCenterX, 2) + Math.pow(clawCenterY - itemCenterY, 2));
var clawRadius = 40; // Approximate claw size
var itemRadius = 50; // Approximate item size
var clawTouchesItem = distance < clawRadius + itemRadius;
if (clawTouchesItem) {
claw.grabbedItem = item;
claw.weight = item.weight;
claw.isDropping = false;
claw.isRetracting = true;
break;
}
}
}
// Update score display
scoreText.setText('Score: ' + LK.getScore());
};
// Play background music
LK.playMusic('bgmusic'); ===================================================================
--- original.js
+++ change.js
@@ -73,12 +73,16 @@
};
self.drop = function () {
if (!self.isDropping && !self.isRetracting) {
self.isDropping = true;
- // Calculate target position based on swing angle
+ // Calculate target position based on current rotation
var targetDistance = 1800; // How far the claw should extend - increased to reach bottom of screen
- var targetX = self.centerX - Math.sin(self.rotation) * targetDistance;
+ // Use the rotation directly to calculate the target position
+ var targetX = self.x + Math.sin(self.rotation) * targetDistance;
var targetY = self.startY + targetDistance;
+ // Ensure claw stays within screen bounds
+ if (targetX < 50) targetX = 50;
+ if (targetX > 1998) targetX = 1998;
// Calculate distance to target
var distance = Math.sqrt(Math.pow(targetX - self.x, 2) + Math.pow(targetY - self.y, 2));
// Use constant speed for dropping (pixels per second)
var dropSpeed = 800; // pixels per second
claw for machine. In-Game asset. 2d. High contrast. No shadows
metal cable. In-Game asset. 2d. High contrast. No shadows
diamond. In-Game asset. 2d. High contrast. No shadows
gold nugget. In-Game asset. 2d. High contrast. No shadows
rock. In-Game asset. 2d. High contrast. No shadows
domuzcuk. In-Game asset. 2d. High contrast. No shadows
tnt box. In-Game asset. 2d. High contrast. No shadows
woman miner cartoon. In-Game asset. 2d. High contrast. No shadows
emerald. In-Game asset. 2d. High contrast. No shadows
ruby. In-Game asset. 2d. High contrast. No shadows
ground background side wiew. In-Game asset. 2d. High contrast. No shadows
blue sky wiew large scale. In-Game asset. 2d. High contrast. No shadows