User prompt
Increase the size of the target by 5 times
Code edit (1 edits merged)
Please save this source code
User prompt
Target Blitz: Reflex Challenge
Initial prompt
Let random targets appear in screen. Let it be the difficulty setting, it is the most difficult, difficult, medium and easy, so let the targets disappear at this time (0.250 0.400 0.600 0.800). Let's count how many were shot at the top. Let there be a total of 20 targets each time. When it's over, go back to the menu so that the difficulty setting can be selected again. See the best number of shots for each challenge separately (best score).
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
// Target class: a tappable target that appears and disappears after a timeout
var Target = Container.expand(function () {
var self = Container.call(this);
// Attach a circular target asset, centered
var targetAsset = self.attachAsset('targetCircle', {
anchorX: 0.5,
anchorY: 0.5
});
// Set size and color for the target
targetAsset.width = 180;
targetAsset.height = 180;
targetAsset.color = 0xff4444;
targetAsset.shape = 'ellipse';
// Mark as not yet hit
self.isHit = false;
// Called when the target is tapped
self.down = function (x, y, obj) {
if (self.isHit) return;
self.isHit = true;
// Animate: scale up and fade out
tween(self, {
scaleX: 1.4,
scaleY: 1.4,
alpha: 0
}, {
duration: 120,
easing: tween.cubicOut,
onFinish: function onFinish() {
self.destroy();
}
});
// Notify game that this target was hit
if (typeof onTargetHit === 'function') {
onTargetHit(self);
}
};
// For tap feedback, animate in
self.alpha = 0;
self.scaleX = self.scaleY = 0.7;
tween(self, {
alpha: 1,
scaleX: 1,
scaleY: 1
}, {
duration: 120,
easing: tween.cubicOut
});
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x181818
});
/****
* Game Code
****/
// --- Difficulty settings ---
var difficulties = [{
name: "Easy",
key: "easy",
time: 800
}, {
name: "Medium",
key: "medium",
time: 600
}, {
name: "Difficult",
key: "hard",
time: 400
}, {
name: "Most Difficult",
key: "insane",
time: 250
}];
// --- State variables ---
var currentDifficulty = null; // {name, key, time}
var roundTargets = 20;
var targetsSpawned = 0;
var targetsHit = 0;
var targetTimeout = null;
var activeTarget = null;
var inGame = false;
// --- Best scores ---
if (!storage.bestScores) storage.bestScores = {};
var bestScores = storage.bestScores;
// --- UI elements ---
var scoreTxt = new Text2('0', {
size: 120,
fill: "#fff"
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
var menuContainer = new Container();
LK.gui.center.addChild(menuContainer);
var bestScoreTxts = []; // Array of Text2 for best scores per difficulty
// --- Helper: Show menu ---
function showMenu() {
inGame = false;
// Clear any active target
if (activeTarget) {
activeTarget.destroy();
activeTarget = null;
}
if (targetTimeout) {
LK.clearTimeout(targetTimeout);
targetTimeout = null;
}
// Reset score display
scoreTxt.setText('');
// Remove previous menu items
while (menuContainer.children.length) menuContainer.removeChild(menuContainer.children[0]);
bestScoreTxts = [];
// Title
var title = new Text2("Tap Reflex Challenge", {
size: 120,
fill: 0xFFEC00
});
title.anchor.set(0.5, 0);
title.y = -420;
menuContainer.addChild(title);
// Instructions
var instr = new Text2("Tap targets before they vanish!\nChoose your difficulty.", {
size: 60,
fill: "#fff"
});
instr.anchor.set(0.5, 0);
instr.y = -280;
menuContainer.addChild(instr);
// Difficulty buttons
var btnY = -60;
for (var i = 0; i < difficulties.length; i++) {
(function (diff, idx) {
// Button background
var btn = LK.getAsset('menuBtn' + idx, {
width: 700,
height: 140,
color: 0x333333 + idx * 0x222222,
shape: 'box',
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: btnY + idx * 180
});
menuContainer.addChild(btn);
// Button label
var btnLabel = new Text2(diff.name, {
size: 70,
fill: "#fff"
});
btnLabel.anchor.set(0.5, 0.5);
btnLabel.x = btn.x;
btnLabel.y = btn.y;
menuContainer.addChild(btnLabel);
// Best score for this difficulty
var best = bestScores[diff.key] || 0;
var bestTxt = new Text2("Best: " + best + " / " + roundTargets, {
size: 40,
fill: 0xFFEC00
});
bestTxt.anchor.set(0.5, 0.5);
bestTxt.x = btn.x + 220;
bestTxt.y = btn.y + 38;
menuContainer.addChild(bestTxt);
bestScoreTxts.push(bestTxt);
// Button tap handler
btn.down = function (x, y, obj) {
startGame(diff);
};
})(difficulties[i], i);
}
}
// --- Helper: Start game with selected difficulty ---
function startGame(diff) {
inGame = true;
currentDifficulty = diff;
targetsSpawned = 0;
targetsHit = 0;
scoreTxt.setText("0 / " + roundTargets);
// Remove menu
while (menuContainer.children.length) menuContainer.removeChild(menuContainer.children[0]);
// Start first target
spawnNextTarget();
}
// --- Helper: Spawn a target at a random position ---
function spawnNextTarget() {
if (!inGame) return;
if (activeTarget) {
activeTarget.destroy();
activeTarget = null;
}
if (targetsSpawned >= roundTargets) {
endGame();
return;
}
targetsSpawned++;
// Random position, avoid edges (target is 180x180)
var margin = 120;
var x = margin + Math.random() * (2048 - 2 * margin);
var y = 220 + Math.random() * (2732 - 220 - margin);
var target = new Target();
target.x = x;
target.y = y;
activeTarget = target;
game.addChild(target);
// Timeout: if not hit in time, remove and spawn next
targetTimeout = LK.setTimeout(function () {
if (activeTarget === target && !target.isHit) {
// Animate out
tween(target, {
alpha: 0
}, {
duration: 100,
onFinish: function onFinish() {
target.destroy();
}
});
activeTarget = null;
spawnNextTarget();
}
}, currentDifficulty.time);
}
// --- Helper: Called when a target is hit ---
function onTargetHit(target) {
if (!inGame) return;
if (activeTarget === target) {
targetsHit++;
scoreTxt.setText(targetsHit + " / " + roundTargets);
activeTarget = null;
if (targetTimeout) {
LK.clearTimeout(targetTimeout);
targetTimeout = null;
}
// Next target after a short delay for feedback
LK.setTimeout(spawnNextTarget, 80);
}
}
// --- Helper: End of round ---
function endGame() {
inGame = false;
// Update best score if needed
var key = currentDifficulty.key;
if (!bestScores[key] || targetsHit > bestScores[key]) {
bestScores[key] = targetsHit;
storage.bestScores = bestScores;
}
// Show result popup
var resultTxt = new Text2("You hit " + targetsHit + " / " + roundTargets + "!", {
size: 100,
fill: "#fff"
});
resultTxt.anchor.set(0.5, 0.5);
resultTxt.y = -120;
menuContainer.addChild(resultTxt);
var best = bestScores[key] || 0;
var bestTxt = new Text2("Best: " + best + " / " + roundTargets, {
size: 60,
fill: 0xFFEC00
});
bestTxt.anchor.set(0.5, 0.5);
bestTxt.y = 0;
menuContainer.addChild(bestTxt);
var againBtn = LK.getAsset('againBtn', {
width: 500,
height: 120,
color: 0x44bb44,
shape: 'box',
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 180
});
menuContainer.addChild(againBtn);
var againLabel = new Text2("Menu", {
size: 60,
fill: "#fff"
});
againLabel.anchor.set(0.5, 0.5);
againLabel.x = againBtn.x;
againLabel.y = againBtn.y;
menuContainer.addChild(againLabel);
againBtn.down = function (x, y, obj) {
// Remove result elements
while (menuContainer.children.length) menuContainer.removeChild(menuContainer.children[0]);
showMenu();
};
}
// --- Game move handler (no drag, but required for touch compatibility) ---
game.move = function (x, y, obj) {};
// --- Start with menu ---
showMenu(); ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,303 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+var storage = LK.import("@upit/storage.v1");
+
+/****
+* Classes
+****/
+// Target class: a tappable target that appears and disappears after a timeout
+var Target = Container.expand(function () {
+ var self = Container.call(this);
+ // Attach a circular target asset, centered
+ var targetAsset = self.attachAsset('targetCircle', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Set size and color for the target
+ targetAsset.width = 180;
+ targetAsset.height = 180;
+ targetAsset.color = 0xff4444;
+ targetAsset.shape = 'ellipse';
+ // Mark as not yet hit
+ self.isHit = false;
+ // Called when the target is tapped
+ self.down = function (x, y, obj) {
+ if (self.isHit) return;
+ self.isHit = true;
+ // Animate: scale up and fade out
+ tween(self, {
+ scaleX: 1.4,
+ scaleY: 1.4,
+ alpha: 0
+ }, {
+ duration: 120,
+ easing: tween.cubicOut,
+ onFinish: function onFinish() {
+ self.destroy();
+ }
+ });
+ // Notify game that this target was hit
+ if (typeof onTargetHit === 'function') {
+ onTargetHit(self);
+ }
+ };
+ // For tap feedback, animate in
+ self.alpha = 0;
+ self.scaleX = self.scaleY = 0.7;
+ tween(self, {
+ alpha: 1,
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 120,
+ easing: tween.cubicOut
+ });
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x181818
+});
+
+/****
+* Game Code
+****/
+// --- Difficulty settings ---
+var difficulties = [{
+ name: "Easy",
+ key: "easy",
+ time: 800
+}, {
+ name: "Medium",
+ key: "medium",
+ time: 600
+}, {
+ name: "Difficult",
+ key: "hard",
+ time: 400
+}, {
+ name: "Most Difficult",
+ key: "insane",
+ time: 250
+}];
+// --- State variables ---
+var currentDifficulty = null; // {name, key, time}
+var roundTargets = 20;
+var targetsSpawned = 0;
+var targetsHit = 0;
+var targetTimeout = null;
+var activeTarget = null;
+var inGame = false;
+// --- Best scores ---
+if (!storage.bestScores) storage.bestScores = {};
+var bestScores = storage.bestScores;
+// --- UI elements ---
+var scoreTxt = new Text2('0', {
+ size: 120,
+ fill: "#fff"
+});
+scoreTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreTxt);
+var menuContainer = new Container();
+LK.gui.center.addChild(menuContainer);
+var bestScoreTxts = []; // Array of Text2 for best scores per difficulty
+// --- Helper: Show menu ---
+function showMenu() {
+ inGame = false;
+ // Clear any active target
+ if (activeTarget) {
+ activeTarget.destroy();
+ activeTarget = null;
+ }
+ if (targetTimeout) {
+ LK.clearTimeout(targetTimeout);
+ targetTimeout = null;
+ }
+ // Reset score display
+ scoreTxt.setText('');
+ // Remove previous menu items
+ while (menuContainer.children.length) menuContainer.removeChild(menuContainer.children[0]);
+ bestScoreTxts = [];
+ // Title
+ var title = new Text2("Tap Reflex Challenge", {
+ size: 120,
+ fill: 0xFFEC00
+ });
+ title.anchor.set(0.5, 0);
+ title.y = -420;
+ menuContainer.addChild(title);
+ // Instructions
+ var instr = new Text2("Tap targets before they vanish!\nChoose your difficulty.", {
+ size: 60,
+ fill: "#fff"
+ });
+ instr.anchor.set(0.5, 0);
+ instr.y = -280;
+ menuContainer.addChild(instr);
+ // Difficulty buttons
+ var btnY = -60;
+ for (var i = 0; i < difficulties.length; i++) {
+ (function (diff, idx) {
+ // Button background
+ var btn = LK.getAsset('menuBtn' + idx, {
+ width: 700,
+ height: 140,
+ color: 0x333333 + idx * 0x222222,
+ shape: 'box',
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 0,
+ y: btnY + idx * 180
+ });
+ menuContainer.addChild(btn);
+ // Button label
+ var btnLabel = new Text2(diff.name, {
+ size: 70,
+ fill: "#fff"
+ });
+ btnLabel.anchor.set(0.5, 0.5);
+ btnLabel.x = btn.x;
+ btnLabel.y = btn.y;
+ menuContainer.addChild(btnLabel);
+ // Best score for this difficulty
+ var best = bestScores[diff.key] || 0;
+ var bestTxt = new Text2("Best: " + best + " / " + roundTargets, {
+ size: 40,
+ fill: 0xFFEC00
+ });
+ bestTxt.anchor.set(0.5, 0.5);
+ bestTxt.x = btn.x + 220;
+ bestTxt.y = btn.y + 38;
+ menuContainer.addChild(bestTxt);
+ bestScoreTxts.push(bestTxt);
+ // Button tap handler
+ btn.down = function (x, y, obj) {
+ startGame(diff);
+ };
+ })(difficulties[i], i);
+ }
+}
+// --- Helper: Start game with selected difficulty ---
+function startGame(diff) {
+ inGame = true;
+ currentDifficulty = diff;
+ targetsSpawned = 0;
+ targetsHit = 0;
+ scoreTxt.setText("0 / " + roundTargets);
+ // Remove menu
+ while (menuContainer.children.length) menuContainer.removeChild(menuContainer.children[0]);
+ // Start first target
+ spawnNextTarget();
+}
+// --- Helper: Spawn a target at a random position ---
+function spawnNextTarget() {
+ if (!inGame) return;
+ if (activeTarget) {
+ activeTarget.destroy();
+ activeTarget = null;
+ }
+ if (targetsSpawned >= roundTargets) {
+ endGame();
+ return;
+ }
+ targetsSpawned++;
+ // Random position, avoid edges (target is 180x180)
+ var margin = 120;
+ var x = margin + Math.random() * (2048 - 2 * margin);
+ var y = 220 + Math.random() * (2732 - 220 - margin);
+ var target = new Target();
+ target.x = x;
+ target.y = y;
+ activeTarget = target;
+ game.addChild(target);
+ // Timeout: if not hit in time, remove and spawn next
+ targetTimeout = LK.setTimeout(function () {
+ if (activeTarget === target && !target.isHit) {
+ // Animate out
+ tween(target, {
+ alpha: 0
+ }, {
+ duration: 100,
+ onFinish: function onFinish() {
+ target.destroy();
+ }
+ });
+ activeTarget = null;
+ spawnNextTarget();
+ }
+ }, currentDifficulty.time);
+}
+// --- Helper: Called when a target is hit ---
+function onTargetHit(target) {
+ if (!inGame) return;
+ if (activeTarget === target) {
+ targetsHit++;
+ scoreTxt.setText(targetsHit + " / " + roundTargets);
+ activeTarget = null;
+ if (targetTimeout) {
+ LK.clearTimeout(targetTimeout);
+ targetTimeout = null;
+ }
+ // Next target after a short delay for feedback
+ LK.setTimeout(spawnNextTarget, 80);
+ }
+}
+// --- Helper: End of round ---
+function endGame() {
+ inGame = false;
+ // Update best score if needed
+ var key = currentDifficulty.key;
+ if (!bestScores[key] || targetsHit > bestScores[key]) {
+ bestScores[key] = targetsHit;
+ storage.bestScores = bestScores;
+ }
+ // Show result popup
+ var resultTxt = new Text2("You hit " + targetsHit + " / " + roundTargets + "!", {
+ size: 100,
+ fill: "#fff"
+ });
+ resultTxt.anchor.set(0.5, 0.5);
+ resultTxt.y = -120;
+ menuContainer.addChild(resultTxt);
+ var best = bestScores[key] || 0;
+ var bestTxt = new Text2("Best: " + best + " / " + roundTargets, {
+ size: 60,
+ fill: 0xFFEC00
+ });
+ bestTxt.anchor.set(0.5, 0.5);
+ bestTxt.y = 0;
+ menuContainer.addChild(bestTxt);
+ var againBtn = LK.getAsset('againBtn', {
+ width: 500,
+ height: 120,
+ color: 0x44bb44,
+ shape: 'box',
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 0,
+ y: 180
+ });
+ menuContainer.addChild(againBtn);
+ var againLabel = new Text2("Menu", {
+ size: 60,
+ fill: "#fff"
+ });
+ againLabel.anchor.set(0.5, 0.5);
+ againLabel.x = againBtn.x;
+ againLabel.y = againBtn.y;
+ menuContainer.addChild(againLabel);
+ againBtn.down = function (x, y, obj) {
+ // Remove result elements
+ while (menuContainer.children.length) menuContainer.removeChild(menuContainer.children[0]);
+ showMenu();
+ };
+}
+// --- Game move handler (no drag, but required for touch compatibility) ---
+game.move = function (x, y, obj) {};
+// --- Start with menu ---
+showMenu();
\ No newline at end of file
Sunset between the mountains ( natural) piksel art. In-Game asset. 2d. High contrast. No shadows
Big fat flaying bird ( Piksel art). Colorful In-Game asset. 2d. High contrast.
Rectangle
Big fat flaying bird ( Piksel art). Colorful. Cute. In-Game asset. 2d. High contrast.
Big fat flaying bird ( Piksel art). Cute. Colorful In-Game asset. 2d. High contrast.
Fastest flaying bird ( Piksel art). Cute. Colorful In-Game asset. 2d. High contrast.
Target for weapon.(piksel art) In-Game asset. 2d. High contrast.
(700x140) button (cute pixel art). no writing No shadows
A pixel art sign that says BIRDS SHOOTING.(800x240 size) No shadows
700x700(total size) black red button (like hell fire around and into button) (cute pixel art). no writing No shadows