User prompt
Make it so If you click In the red Bar of a Red pop-up 5 times it spawns the Green Pop-up And red ones Get Erased
User prompt
Make it so When Tapping 5 Red Pop-ups a Green one Appears That Gives you Enough score to Unlock the Anti-virus pop-up
User prompt
Add a Secret Green Pop-up that Can only be spawned When clicking in 5 Red Pop-ups That If you click will Give you 950 score So you can beat the game
User prompt
Make it so After Getting 1000 score You unlock An Anti-virus Pop-up with Blue Color instead of read that When clicked it Reboots the Computer, After the Reboot is Complete, It says "Thanks for playing!" And ends the game with a win
User prompt
Make it so Before the Game over you get a Windows Blue screen of death
User prompt
Make the X easier to hit in mobile
User prompt
Please fix the bug: 'Timeout.tick error: Cannot set properties of undefined (setting 'wordWrap')' in or related to this line: 'errorText.style.wordWrap = true;' Line Number: 49
User prompt
Make the Pop-up screens Bigger and Make it so the Pop-ups say Stuff like "Congratulations, You have won 10 Million dollars! Click this Pop-up to claim your prize!" And when you click a Pop-up it Drains 10 Score and has a 1 in 1000 chance of Crashing the Computer and giving a Game over
User prompt
Please fix the bug: 'TypeError: Cannot set properties of undefined (setting 'fill')' in or related to this line: 'popupCountText.style.fill = "#000000";' Line Number: 215
Code edit (1 edits merged)
Please save this source code
User prompt
Virus Pop-Up Destroyer
Initial prompt
Make a game where The goal is to Remove Virus error pop-ups From your screen, If more than 6 stay in your screen, Your Computer crashes and Game over, Every Error you close gives 10 Score, Once you reach 100 score, The errors Will occasionally move
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var VirusPopup = Container.expand(function () {
var self = Container.call(this);
// Create popup window
var popupWindow = self.attachAsset('popup', {
anchorX: 0.5,
anchorY: 0.5
});
// Create red header bar
var header = self.attachAsset('popupHeader', {
anchorX: 0.5,
anchorY: 0.5,
y: -80
});
// Create close button
var closeBtn = self.attachAsset('closeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 135,
y: -80
});
// Add error text
var errorText = new Text2('VIRUS DETECTED!', {
size: 24,
fill: 0x000000
});
errorText.anchor.set(0.5, 0.5);
errorText.x = 0;
errorText.y = -20;
self.addChild(errorText);
var warningText = new Text2('Click X to close', {
size: 18,
fill: 0x666666
});
warningText.anchor.set(0.5, 0.5);
warningText.x = 0;
warningText.y = 20;
self.addChild(warningText);
// Add X symbol to close button
var xText = new Text2('X', {
size: 20,
fill: 0x000000
});
xText.anchor.set(0.5, 0.5);
xText.x = 135;
xText.y = -80;
self.addChild(xText);
// Movement properties
self.isMoving = false;
self.moveSpeedX = 0;
self.moveSpeedY = 0;
// Enable movement
self.enableMovement = function () {
self.isMoving = true;
self.moveSpeedX = (Math.random() - 0.5) * 4;
self.moveSpeedY = (Math.random() - 0.5) * 4;
};
self.update = function () {
if (self.isMoving) {
self.x += self.moveSpeedX;
self.y += self.moveSpeedY;
// Bounce off edges
if (self.x < 150 || self.x > 2048 - 150) {
self.moveSpeedX *= -1;
}
if (self.y < 100 || self.y > 2732 - 100) {
self.moveSpeedY *= -1;
}
// Keep within bounds
self.x = Math.max(150, Math.min(2048 - 150, self.x));
self.y = Math.max(100, Math.min(2732 - 100, self.y));
}
};
self.down = function (x, y, obj) {
// Only close if clicking the close button area
if (x > 120 && x < 150 && y > -95 && y < -65) {
self.closePopup();
}
};
self.closePopup = function () {
// Remove from active popups array
for (var i = activePopups.length - 1; i >= 0; i--) {
if (activePopups[i] === self) {
activePopups.splice(i, 1);
break;
}
}
// Add score
LK.setScore(LK.getScore() + 10);
scoreText.setText('Score: ' + LK.getScore());
// Play close sound
LK.getSound('close').play();
// Visual feedback
tween(self, {
scaleX: 0,
scaleY: 0,
alpha: 0
}, {
duration: 200,
onFinish: function onFinish() {
self.destroy();
}
});
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87ceeb
});
/****
* Game Code
****/
// Game variables
var activePopups = [];
var spawnTimer = 0;
var spawnInterval = 180; // 3 seconds at 60fps
var movementEnabled = false;
var dangerFlashing = false;
// UI Elements
var scoreText = new Text2('Score: 0', {
size: 60,
fill: 0x000000
});
scoreText.anchor.set(0, 0);
scoreText.x = 150;
scoreText.y = 50;
LK.gui.topLeft.addChild(scoreText);
var popupCountText = new Text2('Popups: 0/6', {
size: 50,
fill: 0x000000
});
popupCountText.anchor.set(1, 0);
popupCountText.x = -50;
popupCountText.y = 50;
LK.gui.topRight.addChild(popupCountText);
var warningText = new Text2('', {
size: 80,
fill: 0xFF0000
});
warningText.anchor.set(0.5, 0.5);
LK.gui.center.addChild(warningText);
// Spawn popup function
function spawnPopup() {
var popup = new VirusPopup();
// Random position
popup.x = Math.random() * (2048 - 300) + 150;
popup.y = Math.random() * (2732 - 200) + 100;
// Enable movement if score >= 100
if (LK.getScore() >= 100) {
popup.enableMovement();
}
activePopups.push(popup);
game.addChild(popup);
// Play spawn sound
LK.getSound('spawn').play();
// Entrance animation
popup.scaleX = 0;
popup.scaleY = 0;
popup.alpha = 0;
tween(popup, {
scaleX: 1,
scaleY: 1,
alpha: 1
}, {
duration: 300
});
}
// Update popup count display
function updatePopupCount() {
var count = activePopups.length;
popupCountText.setText('Popups: ' + count + '/6');
if (count >= 5) {
popupCountText.style.fill = "#ff0000";
if (!dangerFlashing) {
dangerFlashing = true;
warningText.setText('DANGER!');
tween(warningText, {
alpha: 0
}, {
duration: 500,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(warningText, {
alpha: 1
}, {
duration: 500,
easing: tween.easeInOut
});
}
});
}
} else {
popupCountText.style.fill = "#000000";
if (dangerFlashing) {
dangerFlashing = false;
warningText.setText('');
tween.stop(warningText);
warningText.alpha = 1;
}
}
}
// Game update loop
game.update = function () {
// Update spawn timer
spawnTimer++;
// Spawn new popup
if (spawnTimer >= spawnInterval) {
spawnTimer = 0;
spawnPopup();
// Gradually increase spawn rate
if (spawnInterval > 60) {
spawnInterval -= 1;
}
}
// Update popup count
updatePopupCount();
// Check game over condition
if (activePopups.length >= 6) {
LK.showGameOver();
}
// Enable movement at 100 points
if (LK.getScore() >= 100 && !movementEnabled) {
movementEnabled = true;
for (var i = 0; i < activePopups.length; i++) {
activePopups[i].enableMovement();
}
}
};
// Initial spawn
LK.setTimeout(function () {
spawnPopup();
}, 1000); ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,244 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var VirusPopup = Container.expand(function () {
+ var self = Container.call(this);
+ // Create popup window
+ var popupWindow = self.attachAsset('popup', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Create red header bar
+ var header = self.attachAsset('popupHeader', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ y: -80
+ });
+ // Create close button
+ var closeBtn = self.attachAsset('closeButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 135,
+ y: -80
+ });
+ // Add error text
+ var errorText = new Text2('VIRUS DETECTED!', {
+ size: 24,
+ fill: 0x000000
+ });
+ errorText.anchor.set(0.5, 0.5);
+ errorText.x = 0;
+ errorText.y = -20;
+ self.addChild(errorText);
+ var warningText = new Text2('Click X to close', {
+ size: 18,
+ fill: 0x666666
+ });
+ warningText.anchor.set(0.5, 0.5);
+ warningText.x = 0;
+ warningText.y = 20;
+ self.addChild(warningText);
+ // Add X symbol to close button
+ var xText = new Text2('X', {
+ size: 20,
+ fill: 0x000000
+ });
+ xText.anchor.set(0.5, 0.5);
+ xText.x = 135;
+ xText.y = -80;
+ self.addChild(xText);
+ // Movement properties
+ self.isMoving = false;
+ self.moveSpeedX = 0;
+ self.moveSpeedY = 0;
+ // Enable movement
+ self.enableMovement = function () {
+ self.isMoving = true;
+ self.moveSpeedX = (Math.random() - 0.5) * 4;
+ self.moveSpeedY = (Math.random() - 0.5) * 4;
+ };
+ self.update = function () {
+ if (self.isMoving) {
+ self.x += self.moveSpeedX;
+ self.y += self.moveSpeedY;
+ // Bounce off edges
+ if (self.x < 150 || self.x > 2048 - 150) {
+ self.moveSpeedX *= -1;
+ }
+ if (self.y < 100 || self.y > 2732 - 100) {
+ self.moveSpeedY *= -1;
+ }
+ // Keep within bounds
+ self.x = Math.max(150, Math.min(2048 - 150, self.x));
+ self.y = Math.max(100, Math.min(2732 - 100, self.y));
+ }
+ };
+ self.down = function (x, y, obj) {
+ // Only close if clicking the close button area
+ if (x > 120 && x < 150 && y > -95 && y < -65) {
+ self.closePopup();
+ }
+ };
+ self.closePopup = function () {
+ // Remove from active popups array
+ for (var i = activePopups.length - 1; i >= 0; i--) {
+ if (activePopups[i] === self) {
+ activePopups.splice(i, 1);
+ break;
+ }
+ }
+ // Add score
+ LK.setScore(LK.getScore() + 10);
+ scoreText.setText('Score: ' + LK.getScore());
+ // Play close sound
+ LK.getSound('close').play();
+ // Visual feedback
+ tween(self, {
+ scaleX: 0,
+ scaleY: 0,
+ alpha: 0
+ }, {
+ duration: 200,
+ onFinish: function onFinish() {
+ self.destroy();
+ }
+ });
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x87ceeb
+});
+
+/****
+* Game Code
+****/
+// Game variables
+var activePopups = [];
+var spawnTimer = 0;
+var spawnInterval = 180; // 3 seconds at 60fps
+var movementEnabled = false;
+var dangerFlashing = false;
+// UI Elements
+var scoreText = new Text2('Score: 0', {
+ size: 60,
+ fill: 0x000000
+});
+scoreText.anchor.set(0, 0);
+scoreText.x = 150;
+scoreText.y = 50;
+LK.gui.topLeft.addChild(scoreText);
+var popupCountText = new Text2('Popups: 0/6', {
+ size: 50,
+ fill: 0x000000
+});
+popupCountText.anchor.set(1, 0);
+popupCountText.x = -50;
+popupCountText.y = 50;
+LK.gui.topRight.addChild(popupCountText);
+var warningText = new Text2('', {
+ size: 80,
+ fill: 0xFF0000
+});
+warningText.anchor.set(0.5, 0.5);
+LK.gui.center.addChild(warningText);
+// Spawn popup function
+function spawnPopup() {
+ var popup = new VirusPopup();
+ // Random position
+ popup.x = Math.random() * (2048 - 300) + 150;
+ popup.y = Math.random() * (2732 - 200) + 100;
+ // Enable movement if score >= 100
+ if (LK.getScore() >= 100) {
+ popup.enableMovement();
+ }
+ activePopups.push(popup);
+ game.addChild(popup);
+ // Play spawn sound
+ LK.getSound('spawn').play();
+ // Entrance animation
+ popup.scaleX = 0;
+ popup.scaleY = 0;
+ popup.alpha = 0;
+ tween(popup, {
+ scaleX: 1,
+ scaleY: 1,
+ alpha: 1
+ }, {
+ duration: 300
+ });
+}
+// Update popup count display
+function updatePopupCount() {
+ var count = activePopups.length;
+ popupCountText.setText('Popups: ' + count + '/6');
+ if (count >= 5) {
+ popupCountText.style.fill = "#ff0000";
+ if (!dangerFlashing) {
+ dangerFlashing = true;
+ warningText.setText('DANGER!');
+ tween(warningText, {
+ alpha: 0
+ }, {
+ duration: 500,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ tween(warningText, {
+ alpha: 1
+ }, {
+ duration: 500,
+ easing: tween.easeInOut
+ });
+ }
+ });
+ }
+ } else {
+ popupCountText.style.fill = "#000000";
+ if (dangerFlashing) {
+ dangerFlashing = false;
+ warningText.setText('');
+ tween.stop(warningText);
+ warningText.alpha = 1;
+ }
+ }
+}
+// Game update loop
+game.update = function () {
+ // Update spawn timer
+ spawnTimer++;
+ // Spawn new popup
+ if (spawnTimer >= spawnInterval) {
+ spawnTimer = 0;
+ spawnPopup();
+ // Gradually increase spawn rate
+ if (spawnInterval > 60) {
+ spawnInterval -= 1;
+ }
+ }
+ // Update popup count
+ updatePopupCount();
+ // Check game over condition
+ if (activePopups.length >= 6) {
+ LK.showGameOver();
+ }
+ // Enable movement at 100 points
+ if (LK.getScore() >= 100 && !movementEnabled) {
+ movementEnabled = true;
+ for (var i = 0; i < activePopups.length; i++) {
+ activePopups[i].enableMovement();
+ }
+ }
+};
+// Initial spawn
+LK.setTimeout(function () {
+ spawnPopup();
+}, 1000);
\ No newline at end of file