Code edit (5 edits merged)
Please save this source code
User prompt
Make the countdown number to be in red in color
User prompt
Make the text color of the timer to be red
User prompt
Put the score at the bottom of the screen
User prompt
Also, as time progresses, increase the score, in relation to seconds. Change the timer bar to counting down number
User prompt
also increase the frequency of the malfunction to appear after 30 score
User prompt
I have made the final score to be 9999999999 something, making it to infinity, I want now a fast pacing characteristic, meaning that as time passes make the timer go little faster, make it gradual, but only change this after 20 score.
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'fill')' in or related to this line: 'screenText.style.fill = "#000"; // Always set text color to black for correctWireColor' Line Number: 267
User prompt
make the text of the correctWireColor to be black color
User prompt
make the correctWireColor to random color
User prompt
I want the correctWireColor to be black
Code edit (2 edits merged)
Please save this source code
User prompt
Make the CommBack's height as half of panel_bg
User prompt
Make the CommBack having the same width as panel_bg
Code edit (1 edits merged)
Please save this source code
User prompt
mal_overlay is good, make another box, that appears on the bomb with the screws, when the screws are clicked the another box goes away, and returns us to the bomb screen
User prompt
Now all that is good, make the mal_overlay to be in the center of the screen
User prompt
Everything is good, but when the screen malfunctions, it just shows a screen with the screws but I just want it to be blank, and then the players should click on it, to show a screen popped up which has the screw
Code edit (1 edits merged)
Please save this source code
User prompt
Create a box inside the panel_bg
User prompt
This is the aspect ratio of the panel_bg ( 1500 X 2000) , make the screen to be in the top
User prompt
Make the grey screen larger
Code edit (1 edits merged)
Please save this source code
User prompt
Bomb Defuse Clicker
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Screw class (for malfunction minigame) var Screw = Container.expand(function () { var self = Container.call(this); self.fixed = false; self.screwAsset = self.attachAsset('screw', { anchorX: 0.5, anchorY: 0.5 }); // Touch/click event self.down = function (x, y, obj) { if (self.fixed) { return; } self.fixed = true; // Animate: fade out and shrink tween(self, { scaleX: 0.1, scaleY: 0.1, alpha: 0 }, { duration: 200, easing: tween.cubicIn, onFinish: function onFinish() { self.visible = false; } }); if (typeof self.onFix === 'function') { self.onFix(self); } }; return self; }); // Wire class var Wire = Container.expand(function () { var self = Container.call(this); // Properties self.color = 'red'; // default, will be set on init self.cut = false; // Attach asset self.wireAsset = null; self.init = function (color) { self.color = color; self.cut = false; var assetId = 'wire_' + color; self.wireAsset = self.attachAsset(assetId, { anchorX: 0.5, anchorY: 0.5 }); }; // Cut animation self.cutWire = function () { if (self.cut) { return; } self.cut = true; // Animate: fade out and shrink tween(self, { scaleX: 0.1, scaleY: 0.1, alpha: 0 }, { duration: 300, easing: tween.cubicIn, onFinish: function onFinish() { self.visible = false; } }); }; // Touch/click event self.down = function (x, y, obj) { if (self.cut) { return; } if (typeof self.onCut === 'function') { self.onCut(self); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x181818 }); /**** * Game Code ****/ // Sounds // Malfunction overlay // Screw (for malfunction minigame) // Communication screen // Panel // Wires: red, blue, green, yellow, black, white // --- Game constants --- var WIRE_COLORS = ['red', 'blue', 'green', 'yellow', 'black', 'white']; var WIRES_PER_PANEL = 4; var PANEL_X = 2048 / 2; var PANEL_Y = 2732 / 2; var PANEL_W = 700; var PANEL_H = 500; var SCREEN_H = 180; var ROUND_TIME = 8000; // ms per round var MALFUNCTION_CHANCE = 0.18; // 18% chance per round // --- Game state --- var wires = []; var panel = null; var screen = null; var screenText = null; var malOverlay = null; var screws = []; var screwBox = null; // Box for screws during malfunction minigame var malfunctionActive = false; var roundTimer = null; var timeLeft = 0; var timerBar = null; var correctWireColor = ''; var canCut = true; var scoreText = null; var roundNum = 0; var tickingSoundTimer = null; // --- GUI --- scoreText = new Text2('0', { size: 120, fill: "#fff" }); scoreText.anchor.set(0.5, 1); LK.gui.bottom.addChild(scoreText); // Timer bar timerBar = LK.getAsset('panel_bg', { width: 600, height: 24, color: 0x44ff44, anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 180 }); game.addChild(timerBar); // --- Panel setup --- panel = new Container(); var panelBorder = panel.attachAsset('panel_border', { anchorX: 0.5, anchorY: 0.5 }); var panelBg = panel.attachAsset('panel_bg', { anchorX: 0.5, anchorY: 0.5 }); // Add a box inside the panel_bg (steel panel) var innerBox = panel.attachAsset('panel_border', { anchorX: 0.5, anchorY: 0.5, width: 900, // slightly smaller than panel_bg (1500x2000), visually inside height: 1200, x: 0, y: 50 // move it down a bit to be inside the panel visually }); panel.x = PANEL_X; panel.y = PANEL_Y; game.addChild(panel); // --- Communication screen --- screen = new Container(); var screenBg = screen.attachAsset('screen', { anchorX: 0.5, anchorY: 0.5 }); screen.x = 0; // Place the screen at the top of the panel, matching the panel_bg aspect ratio (panel_bg is 1500x2000, so screen should be near the top edge) screen.y = -1000 + SCREEN_H / 2 + 60 + 40; // -1000 is half of 2000 (panel_bg height), add some margin panel.addChild(screen); screenText = new Text2('', { size: 60, fill: "#fff" }); screenText.anchor.set(0.5, 0.5); screen.addChild(screenText); // Malfunction overlay (hidden by default) malOverlay = LK.getAsset('mal_overlay', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, alpha: 0.8 }); // Center malOverlay in the middle of the screen container malOverlay.x = 0; malOverlay.y = 0; malOverlay.visible = false; screen.addChild(malOverlay); // --- Functions --- function shuffle(arr) { // Fisher-Yates shuffle for (var i = arr.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var t = arr[i]; arr[i] = arr[j]; arr[j] = t; } return arr; } function startRound() { roundNum += 1; canCut = true; malfunctionActive = false; // Remove old wires for (var i = 0; i < wires.length; i++) { wires[i].destroy(); } wires = []; // Remove screws if any for (var i = 0; i < screws.length; i++) { screws[i].destroy(); } screws = []; // Randomize wires var colorPool = shuffle(WIRE_COLORS.slice()); var roundWires = colorPool.slice(0, WIRES_PER_PANEL); // Pick correct wire correctWireColor = roundWires[Math.floor(Math.random() * roundWires.length)]; // Place wires vertically in panel var spacing = PANEL_H / (WIRES_PER_PANEL + 1); for (var i = 0; i < roundWires.length; i++) { var w = new Wire(); w.init(roundWires[i]); w.x = 0; w.y = -PANEL_H / 2 + spacing * (i + 1) + 40; w.onCut = handleWireCut; panel.addChild(w); wires.push(w); } // Set screen text screenText.setText(correctWireColor.toUpperCase() + ' WIRE!'); screenText.visible = true; screenText.setStyle({ fill: '#309191' }); // Always set text color to black for correctWireColor malOverlay.visible = false; // Malfunction? var malfunctionChance = MALFUNCTION_CHANCE; if (LK.getScore() > 30) { // Gradually increase malfunction chance after score 30, up to 60% malfunctionChance = Math.min(0.6, MALFUNCTION_CHANCE + 0.02 * (LK.getScore() - 30)); } if (Math.random() < malfunctionChance) { LK.setTimeout(triggerMalfunction, 600 + Math.floor(Math.random() * 800)); } // Start timer timeLeft = ROUND_TIME; updateTimerBar(); if (roundTimer) { LK.clearInterval(roundTimer); } roundTimer = LK.setInterval(tickTimer, 30); // Ticking sound if (tickingSoundTimer) { LK.clearInterval(tickingSoundTimer); } tickingSoundTimer = LK.setInterval(function () { LK.getSound('tick').play(); }, 1000); } function handleWireCut(wire) { if (!canCut || malfunctionActive && !screws.length) { return; } canCut = false; wire.cutWire(); if (wire.color === correctWireColor) { // Success! LK.getSound('cut').play(); LK.setScore(LK.getScore() + 1); scoreText.setText(LK.getScore()); // Animate panel flash green LK.effects.flashObject(panel, 0x44ff44, 300); // Next round after short delay LK.setTimeout(startRound, 700); } else { // Wrong wire! LK.getSound('fail').play(); LK.effects.flashScreen(0xff0000, 600); LK.setScore(Math.max(0, LK.getScore() - 1)); scoreText.setText(LK.getScore()); // Game over LK.setTimeout(function () { LK.showGameOver(); }, 600); } } function tickTimer() { if (!canCut) { return; } // Gradually speed up timer after score > 20 var timerDecrement = 30; var score = LK.getScore(); if (score > 20) { // Increase speed: for every 5 points above 20, timerDecrement increases by 2ms, up to a max of 60ms per tick var extra = Math.min(40, Math.floor((score - 20) / 5) * 2); timerDecrement += extra; } timeLeft -= timerDecrement; // --- Add: Score increases with time (every 1000ms, +1 score) --- if (typeof tickTimer._accum === "undefined") { tickTimer._accum = 0; tickTimer._lastScoreTime = 0; } tickTimer._accum += timerDecrement; if (tickTimer._accum - tickTimer._lastScoreTime >= 1000) { LK.setScore(LK.getScore() + 1); scoreText.setText(LK.getScore()); tickTimer._lastScoreTime += 1000; } updateTimerBar(); if (timeLeft <= 0) { canCut = false; LK.getSound('fail').play(); LK.effects.flashScreen(0xff0000, 600); LK.setTimeout(function () { LK.showGameOver(); }, 600); } } function updateTimerBar() { // Remove bar visual, show countdown number instead timerBar.visible = false; // Add or update a countdown number Text2 object if (typeof updateTimerBar.timerNumber === "undefined") { updateTimerBar.timerNumber = new Text2('', { size: 100, fill: "#fff" }); updateTimerBar.timerNumber.anchor.set(0.5, 0.5); updateTimerBar.timerNumber.x = 2048 / 2; updateTimerBar.timerNumber.y = 180; game.addChild(updateTimerBar.timerNumber); } var secondsLeft = Math.ceil(Math.max(0, timeLeft) / 1000); updateTimerBar.timerNumber.setText(secondsLeft); // Color changes as time runs out if (timeLeft / ROUND_TIME > 0.5) { updateTimerBar.timerNumber.setStyle({ fill: 0x44FF44 }); } else if (timeLeft / ROUND_TIME > 0.2) { updateTimerBar.timerNumber.setStyle({ fill: 0xFFE066 }); } else { updateTimerBar.timerNumber.setStyle({ fill: 0xFF3333 }); } } function triggerMalfunction() { if (!canCut) { return; } malfunctionActive = true; screenText.visible = false; malOverlay.visible = true; // Hide screws for now, only show after click for (var i = 0; i < screws.length; i++) { screws[i].destroy(); } screws = []; // Add a one-time click handler to the screen to show the screw minigame screen.down = function (x, y, obj) { // Remove this handler after first click screen.down = undefined; // Create a new box (screwBox) that will contain the screws, centered on the bomb/panel if (typeof screwBox !== "undefined" && screwBox && screwBox.parent) { screwBox.parent.removeChild(screwBox); } screwBox = new Container(); // Add a background for the screwBox (use panel_border for visual consistency) var screwBoxBg = screwBox.attachAsset('CommBack', { anchorX: 0.5, anchorY: 0.5, width: 1500, // Match panel_bg width height: 1000, // Half of panel_bg height (2000px) x: 0, y: 0 }); // Center the screwBox on the panel screwBox.x = 0; screwBox.y = 0; panel.addChild(screwBox); // Show screws at random positions inside the screwBox var screwCount = 3 + Math.floor(Math.random() * 2); // 3 or 4 screws = []; for (var i = 0; i < screwCount; i++) { var s = new Screw(); // Place randomly within the screwBox area s.x = -220 + Math.random() * 440; s.y = -120 + Math.random() * 240; s.onFix = function (screw) { handleScrewFix(screw); // If all screws are fixed, remove the screwBox and return to bomb screen var allFixed = true; for (var j = 0; j < screws.length; j++) { if (!screws[j].fixed) { allFixed = false; break; } } if (allFixed) { if (screwBox && screwBox.parent) { screwBox.parent.removeChild(screwBox); } screwBox = null; } }; screwBox.addChild(s); screws.push(s); } LK.getSound('beep').play(); }; } function handleScrewFix(screw) { // Don't allow fixing screws if the minigame hasn't started (blank screen) if (!screws.length) { return; } LK.getSound('fix').play(); // Check if all screws fixed var allFixed = true; for (var i = 0; i < screws.length; i++) { if (!screws[i].fixed) { allFixed = false; break; } } if (allFixed) { malfunctionActive = false; malOverlay.visible = false; screenText.visible = true; // Remove screws from screen for (var i = 0; i < screws.length; i++) { screws[i].destroy(); } screws = []; // Remove any leftover click handler screen.down = undefined; } } // --- Game event handlers --- // Drag prevention: no drag in this game game.move = function (x, y, obj) {}; // --- Game update loop --- game.update = function () { // Win condition: e.g. 20 points if (LK.getScore() >= 99999999999) { LK.showYouWin(); } }; // --- Start game --- LK.setScore(0); scoreText.setText('0'); startRound();
===================================================================
--- original.js
+++ change.js
@@ -133,10 +133,10 @@
scoreText = new Text2('0', {
size: 120,
fill: "#fff"
});
-scoreText.anchor.set(0.5, 0);
-LK.gui.top.addChild(scoreText);
+scoreText.anchor.set(0.5, 1);
+LK.gui.bottom.addChild(scoreText);
// Timer bar
timerBar = LK.getAsset('panel_bg', {
width: 600,
height: 24,
It is like the back of a bomb, wires on the side. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
It's a screen, very chip like, light blue screen. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
“Top-down view of a steel box with a smooth metallic surface, subtle reflections, and sharp clean edges. The box should appear sturdy and industrial, with a slightly brushed texture on the steel. Lighting highlights the metal’s cool gray color and gives depth to the edges. Minimal shadows inside the box, set against a plain light background.”. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
it's a black wire. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
it's a blue wire. Don't cut it open, just blue nothing else. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
it's a green wire. Don't cut it open, just blue nothing else. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
it's a red wire. Don't cut it open, just blue nothing else. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
it's a yellow wire. Don't cut it open, just blue nothing else. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
paint it white
It's like back of a chip display. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Make it light greyish black
It is a black screen, like a glass pane. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Make it steel
That's a button, imagine a keyboard button. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
make it as a perfect rectangle, screws on all the corners. no background, transparent background