User prompt
separate the introbackground and startbuttons from the game objects like scores, depth texts
User prompt
Add Introbackground before the game start and startbutton
User prompt
use the images of the assets for the game the texture didn't changed
User prompt
repeat after the 5000 of crystal again from bronze
User prompt
let the player follow the cursor exactly at the same time
User prompt
Move the player with the cursor
User prompt
Add tween plugin to code ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Increase the speed of player when moving with cursor
User prompt
Don't teleport the player to cursor move it and digg by it only if holded
User prompt
There is space on the right side of the stone line! move the stone right line to the max right and use the 100px for terrain
User prompt
move the stone right line to the max right , the stone can't be mined and make it can't be passed by player two.
User prompt
let the player can reach the bottom as the cursor not digging from the half of the screen!
User prompt
make the player can be seen front of the terrain on the screen
User prompt
fix it to reach the bottom
User prompt
don't limit the digging 10/10! let it be infinit like first time
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'fill')' in or related to this line: 'capacityText.style.fill = 0x00FF00; // Green when plenty' Line Number: 263
User prompt
the player digged a small area only then stop like the terrain pixels can't be mined!
User prompt
show the player after terrain layer to be seen on the screen when game is start
User prompt
dig only by player
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'toGlobal')' in or related to this line: 'var gamePos = game.toLocal(obj.parent.toGlobal(obj.position));' Line Number: 30
User prompt
don't teleport the player to cursor move it with it only if get holded on it
User prompt
depthText.y = 30;
User prompt
scoreText.y = 90;
User prompt
scoreText.y = 70;
Code edit (1 edits merged)
Please save this source code
/**** * Plugins ****/ var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); playerGraphics.alpha = 0.8; return self; }); var StoneBlock = Container.expand(function () { var self = Container.call(this); self.blockType = 'stone'; var stoneGraphics = self.attachAsset('stone', { anchorX: 0, anchorY: 0 }); self.mine = function () { return false; // Stone blocks cannot be mined }; return self; }); var TerrainBlock = Container.expand(function () { var self = Container.call(this); self.blockType = 'terrain'; self.hasTreasure = false; self.treasureType = null; self.treasureGraphics = null; var blockGraphics = self.attachAsset('terrain', { anchorX: 0, anchorY: 0 }); self.graphics = blockGraphics; self.setTreasure = function (type) { self.hasTreasure = true; self.treasureType = type; // Create and display the actual treasure image if (type) { self.treasureGraphics = self.attachAsset(type, { anchorX: 0.5, anchorY: 0.5, x: blockSize / 2, y: blockSize / 2, scaleX: 0.8, scaleY: 0.8 }); } }; self.mine = function () { if (self.blockType === 'stone') { return false; } self.visible = false; if (self.treasureGraphics) { self.treasureGraphics.visible = false; } return true; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ game.setBackgroundColor(0x000000); var blockSize = 100; var gridWidth = Math.floor(2048 / blockSize); var gridHeight = Math.floor(2732 / blockSize); var stoneWallWidth = 1; var mineableStartX = stoneWallWidth; var mineableEndX = gridWidth - stoneWallWidth; var terrain = []; var player; var depth = 0; var score = 0; var isDragging = false; var targetX = null; var targetY = null; var playerSpeed = 20; // Pixels per frame var treasureCounts = { bronze: 0, silver: 0, gold: 0, diamond: 0, crystal: 0 }; // Game state var gameStarted = false; var introContainer = null; function movePlayerTowardsTarget() { if (targetX === null || targetY === null || !player) return; // Instantly move player to cursor position player.x = targetX; player.y = targetY; mineBlock(targetX, targetY); } // Create score text first (will be at the back) var scoreText = new Text2('Score: 0', { size: 60, fill: 0xFFFFFF }); scoreText.anchor.set(0.5, 0); scoreText.y = 90; scoreText.visible = false; // Hide initially LK.gui.top.addChild(scoreText); // Create depth text second (will be in the middle) var depthText = new Text2('Depth: 0m', { size: 60, fill: 0xFFFFFF }); depthText.anchor.set(0.5, 0); depthText.y = 30; depthText.visible = false; // Hide initially LK.gui.top.addChild(depthText); // Create treasure count displays var treasureTexts = {}; var treasureTypes = ['bronze', 'silver', 'gold', 'diamond', 'crystal']; var treasureColors = { bronze: 0xCD7F32, silver: 0xC0C0C0, gold: 0xFFD700, diamond: 0x00FFFF, crystal: 0xFF69B4 }; // Create container for treasure counts var treasureContainer = new Container(); treasureContainer.y = -20; // Move to the very top edge treasureContainer.visible = false; // Hide initially // Create text for each treasure type var xOffset = -500; for (var i = 0; i < treasureTypes.length; i++) { var type = treasureTypes[i]; var text = new Text2(type.charAt(0).toUpperCase() + type.slice(1) + ': 0', { size: 50, fill: treasureColors[type] }); text.anchor.set(0.5, 0); text.x = xOffset + i * 250; treasureContainer.addChild(text); treasureTexts[type] = text; } // Add container to GUI after all texts are created to ensure it appears on top LK.gui.top.addChild(treasureContainer); function getTreasureType(currentDepth) { // Each 5000 miles (250000 pixels) has a specific treasure type var depthInMiles = Math.floor(currentDepth / 50); // Convert pixels to miles var treasureZone = Math.floor(depthInMiles / 5000); // Which 5000-mile zone var rand = Math.random(); var spawnChance = 0.1; // 10% chance to spawn treasure if (rand > spawnChance) { return null; // No treasure } // Make treasure zones cycle every 5 zones (25000 miles) var cycledZone = treasureZone % 5; // Return specific treasure based on cycled zone switch (cycledZone) { case 0: // Bronze zone return 'bronze'; case 1: // Silver zone return 'silver'; case 2: // Gold zone return 'gold'; case 3: // Diamond zone return 'diamond'; case 4: // Crystal zone return 'crystal'; } } function generateRow(y) { var row = []; for (var x = 0; x < gridWidth; x++) { var block; if (x < mineableStartX || x >= mineableEndX) { block = new StoneBlock(); } else { block = new TerrainBlock(); var treasure = getTreasureType(depth + y * blockSize); if (treasure) { block.setTreasure(treasure); } } block.x = x * blockSize; block.y = y * blockSize; game.addChild(block); row.push(block); } return row; } function initializeTerrain() { terrain = []; for (var y = 0; y < gridHeight + 1; y++) { terrain.push(generateRow(y)); } } function scrollTerrain() { for (var y = 0; y < terrain.length; y++) { for (var x = 0; x < terrain[y].length; x++) { terrain[y][x].y -= blockSize; } } for (var x = 0; x < terrain[0].length; x++) { terrain[0][x].destroy(); } terrain.shift(); depth += blockSize; terrain.push(generateRow(gridHeight)); depthText.setText('Depth: ' + Math.floor(depth / 50) + 'm'); } function mineBlock(worldX, worldY) { var gridX = Math.floor(worldX / blockSize); var gridY = Math.floor(worldY / blockSize); if (gridX < 0 || gridX >= gridWidth || gridY < 0 || gridY >= gridHeight) { return; } var block = terrain[gridY][gridX]; if (!block || !block.visible) { return; } if (block.mine()) { if (block.hasTreasure) { var treasureValue = 0; switch (block.treasureType) { case 'bronze': treasureValue = 10; break; case 'silver': treasureValue = 25; break; case 'gold': treasureValue = 50; break; case 'diamond': treasureValue = 100; break; case 'crystal': treasureValue = 150; break; } score += treasureValue; LK.setScore(score); scoreText.setText('Score: ' + score); treasureCounts[block.treasureType]++; treasureTexts[block.treasureType].setText(block.treasureType.charAt(0).toUpperCase() + block.treasureType.slice(1) + ': ' + treasureCounts[block.treasureType]); } if (gridY > gridHeight / 2) { scrollTerrain(); } } } // Create intro screen function createIntroScreen() { introContainer = new Container(); // Add intro background var introBackground = introContainer.attachAsset('Introbackground', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, scaleX: 2.048, scaleY: 2.732 }); // Add start button var startButton = introContainer.attachAsset('Startbutton', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 434, scaleX: 4, scaleY: 1.5 }); // Make button interactive startButton.interactive = true; // Add button press handler startButton.down = function () { startGame(); }; // Add to GUI center instead of game LK.gui.center.addChild(introContainer); } function startGame() { if (gameStarted) return; gameStarted = true; // Remove intro screen if (introContainer) { introContainer.destroy(); introContainer = null; } // Show game UI elements scoreText.visible = true; depthText.visible = true; treasureContainer.visible = true; // Initialize game initializeTerrain(); player = game.addChild(new Player()); player.x = 1024; player.y = 200; } // Create intro screen instead of starting game immediately createIntroScreen(); game.down = function (x, y, obj) { if (!gameStarted) return; isDragging = true; targetX = x; targetY = y; }; game.move = function (x, y, obj) { if (!gameStarted) return; targetX = x; targetY = y; }; game.up = function (x, y, obj) { if (!gameStarted) return; isDragging = false; }; game.update = function () { if (!gameStarted) return; if (player && targetX !== null && targetY !== null) { movePlayerTowardsTarget(); } };
===================================================================
--- original.js
+++ change.js
@@ -114,16 +114,18 @@
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
scoreText.y = 90;
+scoreText.visible = false; // Hide initially
LK.gui.top.addChild(scoreText);
// Create depth text second (will be in the middle)
var depthText = new Text2('Depth: 0m', {
size: 60,
fill: 0xFFFFFF
});
depthText.anchor.set(0.5, 0);
depthText.y = 30;
+depthText.visible = false; // Hide initially
LK.gui.top.addChild(depthText);
// Create treasure count displays
var treasureTexts = {};
var treasureTypes = ['bronze', 'silver', 'gold', 'diamond', 'crystal'];
@@ -136,8 +138,9 @@
};
// Create container for treasure counts
var treasureContainer = new Container();
treasureContainer.y = -20; // Move to the very top edge
+treasureContainer.visible = false; // Hide initially
// Create text for each treasure type
var xOffset = -500;
for (var i = 0; i < treasureTypes.length; i++) {
var type = treasureTypes[i];
@@ -269,19 +272,19 @@
// Add intro background
var introBackground = introContainer.attachAsset('Introbackground', {
anchorX: 0.5,
anchorY: 0.5,
- x: 1024,
- y: 1366,
+ x: 0,
+ y: 0,
scaleX: 2.048,
scaleY: 2.732
});
// Add start button
var startButton = introContainer.attachAsset('Startbutton', {
anchorX: 0.5,
anchorY: 0.5,
- x: 1024,
- y: 1800,
+ x: 0,
+ y: 434,
scaleX: 4,
scaleY: 1.5
});
// Make button interactive
@@ -289,9 +292,10 @@
// Add button press handler
startButton.down = function () {
startGame();
};
- game.addChild(introContainer);
+ // Add to GUI center instead of game
+ LK.gui.center.addChild(introContainer);
}
function startGame() {
if (gameStarted) return;
gameStarted = true;
@@ -299,8 +303,12 @@
if (introContainer) {
introContainer.destroy();
introContainer = null;
}
+ // Show game UI elements
+ scoreText.visible = true;
+ depthText.visible = true;
+ treasureContainer.visible = true;
// Initialize game
initializeTerrain();
player = game.addChild(new Player());
player.x = 1024;
Same ninja character, with pack of all colors
Same ninja character, with pack of colors silver,gold,diamond,pink crystal
Same ninja character, with silver color
Same ninja character, with gold color
Same ninja character, with diamond color
Same ninja character, with crystal pink color
Pack of crystals, pink color In-Game asset. 2d. High contrast. No shadows
same image but add beside the character +1 with green color.
Same image of ninja with dig machine but with different colors. HD colors. yellow
Same image of ninja with dig machine but with different colors. HD colors. red
Same image of ninja with dig machine but with different colors. HD colors. blue
Same image of ninja with dig machine but with different colors. HD colors. black ninja
Same image of ninja with dig machine but with different colors. HD colors. green
Playerdiggingsound1
Sound effect
Enemydiggingsound1
Sound effect
Gamemusic1
Music
CollectedTreasuresound1
Sound effect
Startsound1
Sound effect
Intromusic1
Music
PlayerShotSound
Sound effect
EnemyShotshound1
Sound effect
Lifesound1
Sound effect
enemyshotsound1
Sound effect
playershotsound1
Sound effect