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 AntivirusPopup = Container.expand(function () { var self = Container.call(this); // Create popup window var popupWindow = self.attachAsset('popup', { anchorX: 0.5, anchorY: 0.5 }); // Create blue header bar var header = self.attachAsset('antivirusHeader', { anchorX: 0.5, anchorY: 0.5, y: -80 }); // Create close button var closeBtn = self.attachAsset('closeButton', { anchorX: 0.5, anchorY: 0.5, x: 220, y: -130 }); // Add antivirus text var antivirusText = new Text2('ANTIVIRUS PROTECTION ACTIVATED!\n\nClick here to install premium antivirus and clean your system from all malware and viruses!', { size: 22, fill: 0x000000 }); antivirusText.anchor.set(0.5, 0.5); antivirusText.x = 0; antivirusText.y = -20; antivirusText.wordWrap = true; antivirusText.wordWrapWidth = 450; self.addChild(antivirusText); var warningText = new Text2('Click X to close (or click to reboot system)', { size: 16, fill: 0x666666 }); warningText.anchor.set(0.5, 0.5); warningText.x = 0; warningText.y = 80; self.addChild(warningText); // Add X symbol to close button var xText = new Text2('X', { size: 30, fill: 0x000000 }); xText.anchor.set(0.5, 0.5); xText.x = 220; xText.y = -130; self.addChild(xText); self.down = function (x, y, obj) { // Only close if clicking the close button area if (x > 190 && x < 250 && y > -160 && y < -100) { self.closePopup(); } else { // Clicked on antivirus content - trigger reboot self.antivirusClicked(); } }; 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(); } }); }; self.antivirusClicked = function () { // Remove from active popups array for (var i = activePopups.length - 1; i >= 0; i--) { if (activePopups[i] === self) { activePopups.splice(i, 1); break; } } // Trigger reboot sequence showRebootSequence(); // Visual feedback tween(self, { scaleX: 0, scaleY: 0, alpha: 0 }, { duration: 200, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); var BlueScreen = Container.expand(function () { var self = Container.call(this); // Create blue background var background = self.attachAsset('popup', { anchorX: 0.5, anchorY: 0.5, scaleX: 6, scaleY: 12, tint: 0x0000AA }); // BSOD Title var titleText = new Text2('BLUE SCREEN OF DEATH', { size: 80, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0.5); titleText.x = 0; titleText.y = -400; self.addChild(titleText); // Error message var errorMsg = new Text2('A problem has been detected and Windows has been shut down to prevent damage to your computer.', { size: 40, fill: 0xFFFFFF }); errorMsg.anchor.set(0.5, 0.5); errorMsg.x = 0; errorMsg.y = -200; errorMsg.wordWrap = true; errorMsg.wordWrapWidth = 1800; self.addChild(errorMsg); // Technical details var techText = new Text2('VIRUS_POPUP_OVERLOAD\n\n*** STOP: 0x0000007E (0xC0000005, 0xF73E4EA4, 0xF73E4B68, 0xF73E4864)', { size: 32, fill: 0xFFFFFF }); techText.anchor.set(0.5, 0.5); techText.x = 0; techText.y = 0; self.addChild(techText); // Bottom text var bottomText = new Text2('If this is the first time you\'ve seen this stop error screen,\nrestart your computer. If this screen appears again, follow these steps:\n\nDisable or uninstall any anti-virus, disk defragmentation\nor backup utilities. Check your hard drive configuration,\nand check for any updated drivers.', { size: 28, fill: 0xFFFFFF }); bottomText.anchor.set(0.5, 0.5); bottomText.x = 0; bottomText.y = 300; bottomText.wordWrap = true; bottomText.wordWrapWidth = 1800; self.addChild(bottomText); return self; }); var GoodPopup = Container.expand(function () { var self = Container.call(this); // Create popup window var popupWindow = self.attachAsset('popup', { anchorX: 0.5, anchorY: 0.5 }); // Create green header bar var header = self.attachAsset('goodPopupHeader', { anchorX: 0.5, anchorY: 0.5, y: -80 }); // Create close button var closeBtn = self.attachAsset('closeButton', { anchorX: 0.5, anchorY: 0.5, x: 220, y: -130 }); // Add good popup text var goodText = new Text2('CONGRATULATIONS!\n\nYou have successfully avoided 5 scam popups! Click here to receive bonus points and unlock special features!', { size: 22, fill: 0x000000 }); goodText.anchor.set(0.5, 0.5); goodText.x = 0; goodText.y = -20; goodText.wordWrap = true; goodText.wordWrapWidth = 450; self.addChild(goodText); var warningText = new Text2('Click X to close (or click to claim bonus)', { size: 16, fill: 0x666666 }); warningText.anchor.set(0.5, 0.5); warningText.x = 0; warningText.y = 80; self.addChild(warningText); // Add X symbol to close button var xText = new Text2('X', { size: 30, fill: 0x000000 }); xText.anchor.set(0.5, 0.5); xText.x = 220; xText.y = -130; self.addChild(xText); self.down = function (x, y, obj) { // Only close if clicking the close button area if (x > 190 && x < 250 && y > -160 && y < -100) { self.closePopup(); } else { // Clicked on good content - give bonus score self.goodClicked(); } }; 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(); } }); }; self.goodClicked = function () { // Remove from active popups array for (var i = activePopups.length - 1; i >= 0; i--) { if (activePopups[i] === self) { activePopups.splice(i, 1); break; } } // Give enough score to unlock antivirus (1000 points minimum) var currentScore = LK.getScore(); var scoreNeeded = Math.max(0, 1000 - currentScore); LK.setScore(currentScore + scoreNeeded + 100); // Extra 100 bonus scoreText.setText('Score: ' + LK.getScore()); // Visual feedback tween(self, { scaleX: 0, scaleY: 0, alpha: 0 }, { duration: 200, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); 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: 220, y: -130 }); // Scam popup messages var scamMessages = ['Congratulations, You have won 10 Million dollars! Click this Pop-up to claim your prize!', 'URGENT: Your computer is infected! Click here to download antivirus!', 'You are the 1,000,000th visitor! Click to claim your prize!', 'Hot singles in your area want to meet you! Click now!', 'Your warranty is about to expire! Click to renew now!', 'Free iPhone! Click here to claim yours today!']; var randomMessage = scamMessages[Math.floor(Math.random() * scamMessages.length)]; // Add scam text var errorText = new Text2(randomMessage, { size: 22, fill: 0x000000 }); errorText.anchor.set(0.5, 0.5); errorText.x = 0; errorText.y = -20; errorText.wordWrap = true; errorText.wordWrapWidth = 450; self.addChild(errorText); var warningText = new Text2('Click X to close (or click anywhere to fall for scam)', { size: 16, fill: 0x666666 }); warningText.anchor.set(0.5, 0.5); warningText.x = 0; warningText.y = 80; self.addChild(warningText); // Add X symbol to close button var xText = new Text2('X', { size: 30, fill: 0x000000 }); xText.anchor.set(0.5, 0.5); xText.x = 220; xText.y = -130; 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 < 250 || self.x > 2048 - 250) { self.moveSpeedX *= -1; } if (self.y < 150 || self.y > 2732 - 150) { self.moveSpeedY *= -1; } // Keep within bounds self.x = Math.max(250, Math.min(2048 - 250, self.x)); self.y = Math.max(150, Math.min(2732 - 150, self.y)); } }; self.down = function (x, y, obj) { // Only close if clicking the close button area (expanded for larger button) if (x > 190 && x < 250 && y > -160 && y < -100) { self.closePopup(); } else if (x >= -250 && x <= 250 && y >= -100 && y <= -60) { // Clicked on red header bar self.redHeaderClicked(); } else { // Clicked on scam content - lose points and chance of crash self.scamClicked(); } }; 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; } } // Increment red popup clicks counter redPopupClicks++; // 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(); } }); }; self.redHeaderClicked = function () { // Increment red header clicks counter redHeaderClicks++; // Flash red to show click was registered tween(header, { tint: 0xFFFFFF }, { duration: 100, onFinish: function onFinish() { tween(header, { tint: 0xFF0000 }, { duration: 100 }); } }); // If clicked 5 times, spawn green popup and erase all red popups if (redHeaderClicks >= 5) { redHeaderClicks = 0; // Reset counter // Remove all red popups (VirusPopup instances) for (var i = activePopups.length - 1; i >= 0; i--) { if (activePopups[i] instanceof VirusPopup) { activePopups[i].destroy(); activePopups.splice(i, 1); } } // Spawn green popup var goodPopup = new GoodPopup(); goodPopup.x = Math.random() * (2048 - 500) + 250; goodPopup.y = Math.random() * (2732 - 300) + 150; activePopups.push(goodPopup); game.addChild(goodPopup); // Entrance animation for green popup goodPopup.scaleX = 0; goodPopup.scaleY = 0; goodPopup.alpha = 0; tween(goodPopup, { scaleX: 1, scaleY: 1, alpha: 1 }, { duration: 300 }); } }; self.scamClicked = function () { // Remove from active popups array for (var i = activePopups.length - 1; i >= 0; i--) { if (activePopups[i] === self) { activePopups.splice(i, 1); break; } } // Drain 10 score (but don't go below 0) var newScore = Math.max(0, LK.getScore() - 10); LK.setScore(newScore); scoreText.setText('Score: ' + LK.getScore()); // 1 in 1000 chance of crash if (Math.random() < 0.001) { showBlueScreen(); return; } // Visual feedback for scam click 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; var blueScreenShown = false; var redPopupClicks = 0; var redHeaderClicks = 0; // Function to show blue screen before game over function showBlueScreen() { if (blueScreenShown) return; blueScreenShown = true; var blueScreen = new BlueScreen(); blueScreen.x = 1024; blueScreen.y = 1366; game.addChild(blueScreen); // Show blue screen for 3 seconds then game over LK.setTimeout(function () { LK.showGameOver(); }, 3000); } function showRebootSequence() { // Clear all popups for (var i = activePopups.length - 1; i >= 0; i--) { activePopups[i].destroy(); } activePopups = []; // Create black screen var rebootScreen = game.addChild(LK.getAsset('popup', { anchorX: 0.5, anchorY: 0.5, scaleX: 6, scaleY: 12, tint: 0x000000 })); rebootScreen.x = 1024; rebootScreen.y = 1366; // Show "Rebooting..." text var rebootText = new Text2('Rebooting...', { size: 80, fill: 0xFFFFFF }); rebootText.anchor.set(0.5, 0.5); rebootText.x = 1024; rebootText.y = 1366; game.addChild(rebootText); // After 2 seconds, show completion message LK.setTimeout(function () { rebootText.setText('Thanks for playing!'); // After another 2 seconds, show win LK.setTimeout(function () { LK.showYouWin(); }, 2000); }, 2000); } // 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; // Spawn green popup if 5 red popups have been clicked if (redPopupClicks >= 5 && LK.getScore() < 1000) { popup = new GoodPopup(); redPopupClicks = 0; // Reset counter // Spawn antivirus popup if score >= 1000 } else if (LK.getScore() >= 1000) { popup = new AntivirusPopup(); } else { popup = new VirusPopup(); } // Random position popup.x = Math.random() * (2048 - 500) + 250; popup.y = Math.random() * (2732 - 300) + 150; // Enable movement if score >= 100 (only for virus popups) if (LK.getScore() >= 100 && popup instanceof VirusPopup) { 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.tint = 0xff0000; 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.tint = 0x000000; 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) { showBlueScreen(); } // 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);
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var AntivirusPopup = Container.expand(function () {
var self = Container.call(this);
// Create popup window
var popupWindow = self.attachAsset('popup', {
anchorX: 0.5,
anchorY: 0.5
});
// Create blue header bar
var header = self.attachAsset('antivirusHeader', {
anchorX: 0.5,
anchorY: 0.5,
y: -80
});
// Create close button
var closeBtn = self.attachAsset('closeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 220,
y: -130
});
// Add antivirus text
var antivirusText = new Text2('ANTIVIRUS PROTECTION ACTIVATED!\n\nClick here to install premium antivirus and clean your system from all malware and viruses!', {
size: 22,
fill: 0x000000
});
antivirusText.anchor.set(0.5, 0.5);
antivirusText.x = 0;
antivirusText.y = -20;
antivirusText.wordWrap = true;
antivirusText.wordWrapWidth = 450;
self.addChild(antivirusText);
var warningText = new Text2('Click X to close (or click to reboot system)', {
size: 16,
fill: 0x666666
});
warningText.anchor.set(0.5, 0.5);
warningText.x = 0;
warningText.y = 80;
self.addChild(warningText);
// Add X symbol to close button
var xText = new Text2('X', {
size: 30,
fill: 0x000000
});
xText.anchor.set(0.5, 0.5);
xText.x = 220;
xText.y = -130;
self.addChild(xText);
self.down = function (x, y, obj) {
// Only close if clicking the close button area
if (x > 190 && x < 250 && y > -160 && y < -100) {
self.closePopup();
} else {
// Clicked on antivirus content - trigger reboot
self.antivirusClicked();
}
};
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();
}
});
};
self.antivirusClicked = function () {
// Remove from active popups array
for (var i = activePopups.length - 1; i >= 0; i--) {
if (activePopups[i] === self) {
activePopups.splice(i, 1);
break;
}
}
// Trigger reboot sequence
showRebootSequence();
// Visual feedback
tween(self, {
scaleX: 0,
scaleY: 0,
alpha: 0
}, {
duration: 200,
onFinish: function onFinish() {
self.destroy();
}
});
};
return self;
});
var BlueScreen = Container.expand(function () {
var self = Container.call(this);
// Create blue background
var background = self.attachAsset('popup', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 6,
scaleY: 12,
tint: 0x0000AA
});
// BSOD Title
var titleText = new Text2('BLUE SCREEN OF DEATH', {
size: 80,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 0;
titleText.y = -400;
self.addChild(titleText);
// Error message
var errorMsg = new Text2('A problem has been detected and Windows has been shut down to prevent damage to your computer.', {
size: 40,
fill: 0xFFFFFF
});
errorMsg.anchor.set(0.5, 0.5);
errorMsg.x = 0;
errorMsg.y = -200;
errorMsg.wordWrap = true;
errorMsg.wordWrapWidth = 1800;
self.addChild(errorMsg);
// Technical details
var techText = new Text2('VIRUS_POPUP_OVERLOAD\n\n*** STOP: 0x0000007E (0xC0000005, 0xF73E4EA4, 0xF73E4B68, 0xF73E4864)', {
size: 32,
fill: 0xFFFFFF
});
techText.anchor.set(0.5, 0.5);
techText.x = 0;
techText.y = 0;
self.addChild(techText);
// Bottom text
var bottomText = new Text2('If this is the first time you\'ve seen this stop error screen,\nrestart your computer. If this screen appears again, follow these steps:\n\nDisable or uninstall any anti-virus, disk defragmentation\nor backup utilities. Check your hard drive configuration,\nand check for any updated drivers.', {
size: 28,
fill: 0xFFFFFF
});
bottomText.anchor.set(0.5, 0.5);
bottomText.x = 0;
bottomText.y = 300;
bottomText.wordWrap = true;
bottomText.wordWrapWidth = 1800;
self.addChild(bottomText);
return self;
});
var GoodPopup = Container.expand(function () {
var self = Container.call(this);
// Create popup window
var popupWindow = self.attachAsset('popup', {
anchorX: 0.5,
anchorY: 0.5
});
// Create green header bar
var header = self.attachAsset('goodPopupHeader', {
anchorX: 0.5,
anchorY: 0.5,
y: -80
});
// Create close button
var closeBtn = self.attachAsset('closeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 220,
y: -130
});
// Add good popup text
var goodText = new Text2('CONGRATULATIONS!\n\nYou have successfully avoided 5 scam popups! Click here to receive bonus points and unlock special features!', {
size: 22,
fill: 0x000000
});
goodText.anchor.set(0.5, 0.5);
goodText.x = 0;
goodText.y = -20;
goodText.wordWrap = true;
goodText.wordWrapWidth = 450;
self.addChild(goodText);
var warningText = new Text2('Click X to close (or click to claim bonus)', {
size: 16,
fill: 0x666666
});
warningText.anchor.set(0.5, 0.5);
warningText.x = 0;
warningText.y = 80;
self.addChild(warningText);
// Add X symbol to close button
var xText = new Text2('X', {
size: 30,
fill: 0x000000
});
xText.anchor.set(0.5, 0.5);
xText.x = 220;
xText.y = -130;
self.addChild(xText);
self.down = function (x, y, obj) {
// Only close if clicking the close button area
if (x > 190 && x < 250 && y > -160 && y < -100) {
self.closePopup();
} else {
// Clicked on good content - give bonus score
self.goodClicked();
}
};
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();
}
});
};
self.goodClicked = function () {
// Remove from active popups array
for (var i = activePopups.length - 1; i >= 0; i--) {
if (activePopups[i] === self) {
activePopups.splice(i, 1);
break;
}
}
// Give enough score to unlock antivirus (1000 points minimum)
var currentScore = LK.getScore();
var scoreNeeded = Math.max(0, 1000 - currentScore);
LK.setScore(currentScore + scoreNeeded + 100); // Extra 100 bonus
scoreText.setText('Score: ' + LK.getScore());
// Visual feedback
tween(self, {
scaleX: 0,
scaleY: 0,
alpha: 0
}, {
duration: 200,
onFinish: function onFinish() {
self.destroy();
}
});
};
return self;
});
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: 220,
y: -130
});
// Scam popup messages
var scamMessages = ['Congratulations, You have won 10 Million dollars! Click this Pop-up to claim your prize!', 'URGENT: Your computer is infected! Click here to download antivirus!', 'You are the 1,000,000th visitor! Click to claim your prize!', 'Hot singles in your area want to meet you! Click now!', 'Your warranty is about to expire! Click to renew now!', 'Free iPhone! Click here to claim yours today!'];
var randomMessage = scamMessages[Math.floor(Math.random() * scamMessages.length)];
// Add scam text
var errorText = new Text2(randomMessage, {
size: 22,
fill: 0x000000
});
errorText.anchor.set(0.5, 0.5);
errorText.x = 0;
errorText.y = -20;
errorText.wordWrap = true;
errorText.wordWrapWidth = 450;
self.addChild(errorText);
var warningText = new Text2('Click X to close (or click anywhere to fall for scam)', {
size: 16,
fill: 0x666666
});
warningText.anchor.set(0.5, 0.5);
warningText.x = 0;
warningText.y = 80;
self.addChild(warningText);
// Add X symbol to close button
var xText = new Text2('X', {
size: 30,
fill: 0x000000
});
xText.anchor.set(0.5, 0.5);
xText.x = 220;
xText.y = -130;
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 < 250 || self.x > 2048 - 250) {
self.moveSpeedX *= -1;
}
if (self.y < 150 || self.y > 2732 - 150) {
self.moveSpeedY *= -1;
}
// Keep within bounds
self.x = Math.max(250, Math.min(2048 - 250, self.x));
self.y = Math.max(150, Math.min(2732 - 150, self.y));
}
};
self.down = function (x, y, obj) {
// Only close if clicking the close button area (expanded for larger button)
if (x > 190 && x < 250 && y > -160 && y < -100) {
self.closePopup();
} else if (x >= -250 && x <= 250 && y >= -100 && y <= -60) {
// Clicked on red header bar
self.redHeaderClicked();
} else {
// Clicked on scam content - lose points and chance of crash
self.scamClicked();
}
};
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;
}
}
// Increment red popup clicks counter
redPopupClicks++;
// 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();
}
});
};
self.redHeaderClicked = function () {
// Increment red header clicks counter
redHeaderClicks++;
// Flash red to show click was registered
tween(header, {
tint: 0xFFFFFF
}, {
duration: 100,
onFinish: function onFinish() {
tween(header, {
tint: 0xFF0000
}, {
duration: 100
});
}
});
// If clicked 5 times, spawn green popup and erase all red popups
if (redHeaderClicks >= 5) {
redHeaderClicks = 0; // Reset counter
// Remove all red popups (VirusPopup instances)
for (var i = activePopups.length - 1; i >= 0; i--) {
if (activePopups[i] instanceof VirusPopup) {
activePopups[i].destroy();
activePopups.splice(i, 1);
}
}
// Spawn green popup
var goodPopup = new GoodPopup();
goodPopup.x = Math.random() * (2048 - 500) + 250;
goodPopup.y = Math.random() * (2732 - 300) + 150;
activePopups.push(goodPopup);
game.addChild(goodPopup);
// Entrance animation for green popup
goodPopup.scaleX = 0;
goodPopup.scaleY = 0;
goodPopup.alpha = 0;
tween(goodPopup, {
scaleX: 1,
scaleY: 1,
alpha: 1
}, {
duration: 300
});
}
};
self.scamClicked = function () {
// Remove from active popups array
for (var i = activePopups.length - 1; i >= 0; i--) {
if (activePopups[i] === self) {
activePopups.splice(i, 1);
break;
}
}
// Drain 10 score (but don't go below 0)
var newScore = Math.max(0, LK.getScore() - 10);
LK.setScore(newScore);
scoreText.setText('Score: ' + LK.getScore());
// 1 in 1000 chance of crash
if (Math.random() < 0.001) {
showBlueScreen();
return;
}
// Visual feedback for scam click
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;
var blueScreenShown = false;
var redPopupClicks = 0;
var redHeaderClicks = 0;
// Function to show blue screen before game over
function showBlueScreen() {
if (blueScreenShown) return;
blueScreenShown = true;
var blueScreen = new BlueScreen();
blueScreen.x = 1024;
blueScreen.y = 1366;
game.addChild(blueScreen);
// Show blue screen for 3 seconds then game over
LK.setTimeout(function () {
LK.showGameOver();
}, 3000);
}
function showRebootSequence() {
// Clear all popups
for (var i = activePopups.length - 1; i >= 0; i--) {
activePopups[i].destroy();
}
activePopups = [];
// Create black screen
var rebootScreen = game.addChild(LK.getAsset('popup', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 6,
scaleY: 12,
tint: 0x000000
}));
rebootScreen.x = 1024;
rebootScreen.y = 1366;
// Show "Rebooting..." text
var rebootText = new Text2('Rebooting...', {
size: 80,
fill: 0xFFFFFF
});
rebootText.anchor.set(0.5, 0.5);
rebootText.x = 1024;
rebootText.y = 1366;
game.addChild(rebootText);
// After 2 seconds, show completion message
LK.setTimeout(function () {
rebootText.setText('Thanks for playing!');
// After another 2 seconds, show win
LK.setTimeout(function () {
LK.showYouWin();
}, 2000);
}, 2000);
}
// 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;
// Spawn green popup if 5 red popups have been clicked
if (redPopupClicks >= 5 && LK.getScore() < 1000) {
popup = new GoodPopup();
redPopupClicks = 0; // Reset counter
// Spawn antivirus popup if score >= 1000
} else if (LK.getScore() >= 1000) {
popup = new AntivirusPopup();
} else {
popup = new VirusPopup();
}
// Random position
popup.x = Math.random() * (2048 - 500) + 250;
popup.y = Math.random() * (2732 - 300) + 150;
// Enable movement if score >= 100 (only for virus popups)
if (LK.getScore() >= 100 && popup instanceof VirusPopup) {
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.tint = 0xff0000;
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.tint = 0x000000;
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) {
showBlueScreen();
}
// 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);