User prompt
Make it so there’s an app called corrupted and if you press it, it gives you an error with the sound
User prompt
Make the calculator work
User prompt
Make the mouse look more mousy
User prompt
Adam mouse make the mouse walk and make it so you can click on stuff in the screens for the explorer and the app icon looks like the normal one in Windows 98 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Retro OS Simulator 98
Initial prompt
Make a Windows 98 simulator
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var DesktopIcon = Container.expand(function (iconName, x, y) { var self = Container.call(this); // Create icon background for selection effect var iconBg = self.attachAsset('desktopIcon', { anchorX: 0.5, anchorY: 0.5, width: 72, height: 88 }); iconBg.alpha = 0; // Initially transparent // Create the actual icon var icon = self.attachAsset('desktopIcon', { anchorX: 0.5, anchorY: 0.5 }); // Set icon color based on type if (iconName === "My Computer") { icon.tint = 0x87CEEB; // Light blue } else if (iconName === "Recycle Bin") { icon.tint = 0x00FF00; // Green } else if (iconName === "Notepad") { icon.tint = 0xFFFFFF; // White } else if (iconName === "Calculator") { icon.tint = 0xDDDDDD; // Light gray } else if (iconName === "Explorer") { icon.tint = 0xFFD700; // Gold } else if (iconName === "Corrupted") { icon.tint = 0xFF0000; } var label = new Text2(iconName, { size: 24, fill: 0xFFFFFF }); label.anchor.set(0.5, 0); label.y = 40; self.addChild(label); self.x = x; self.y = y; self.name = iconName; self.interactive = true; self.isSelected = false; self.down = function () { // Show blue selection background iconBg.alpha = 0.3; iconBg.tint = 0x0000FF; self.isSelected = true; icon.alpha = 0.7; LK.getSound('click').play(); }; self.up = function () { icon.alpha = 1; // Double-click effect (simplified) if (self.isSelected) { createWindow(iconName); // Reset selection after opening window LK.setTimeout(function () { iconBg.alpha = 0; self.isSelected = false; }, 300); } }; return self; }); var MouseCursor = Container.expand(function () { var self = Container.call(this); // Create arrow pointer shape var cursorContainer = new Container(); self.addChild(cursorContainer); // Create white arrow outline var arrowBody = LK.getAsset('desktopIcon', { anchorX: 0, anchorY: 0, width: 20, height: 24 }); arrowBody.tint = 0xFFFFFF; arrowBody.rotation = Math.PI / 6; // Slight tilt cursorContainer.addChild(arrowBody); // Create black inner arrow (slightly smaller) var arrowInner = LK.getAsset('desktopIcon', { anchorX: 0, anchorY: 0, width: 16, height: 20 }); arrowInner.tint = 0x000000; arrowInner.x = 2; arrowInner.y = 2; arrowInner.rotation = Math.PI / 6; // Same tilt cursorContainer.addChild(arrowInner); // Create left ear var leftEar = LK.getAsset('desktopIcon', { anchorX: 0.5, anchorY: 1, width: 8, height: 12 }); leftEar.tint = 0x888888; leftEar.x = 6; leftEar.y = 0; cursorContainer.addChild(leftEar); // Create right ear var rightEar = LK.getAsset('desktopIcon', { anchorX: 0.5, anchorY: 1, width: 8, height: 12 }); rightEar.tint = 0x888888; rightEar.x = 14; rightEar.y = 0; cursorContainer.addChild(rightEar); // Track if the cursor is over a clickable element self.isOverClickable = false; // Update cursor position self.updatePosition = function (x, y) { self.x = x; self.y = y; }; // Change cursor when over clickable elements self.setPointer = function (isPointer) { self.isOverClickable = isPointer; if (isPointer) { tween(cursorContainer, { rotation: 0, scaleX: 1.1, scaleY: 1.1 }, { duration: 100 }); leftEar.tint = 0xCCCCCC; rightEar.tint = 0xCCCCCC; } else { tween(cursorContainer, { rotation: 0, scaleX: 1.0, scaleY: 1.0 }, { duration: 100 }); leftEar.tint = 0x888888; rightEar.tint = 0x888888; } }; return self; }); var StartMenu = Container.expand(function () { var self = Container.call(this); var menu = self.attachAsset('startMenu', { anchorX: 0, anchorY: 1 }); var menuItems = ["Programs", "Documents", "Settings", "Find", "Help", "Run...", "Log Off...", "Shut Down..."]; for (var i = 0; i < menuItems.length; i++) { var itemText = new Text2(menuItems[i], { size: 24, fill: 0x000000 }); itemText.x = 34; itemText.y = 10 + i * 40; self.addChild(itemText); } self.x = 0; self.y = 2732; // Bottom of screen self.visible = false; return self; }); var Window = Container.expand(function (title, width, height) { var self = Container.call(this); self.isActive = true; self.width = width || 800; self.height = height || 600; var windowBg = self.attachAsset('window', { anchorX: 0, anchorY: 0, width: self.width, height: self.height }); var titleBar = self.attachAsset('windowTitle', { anchorX: 0, anchorY: 0, width: self.width, height: 28 }); var titleText = new Text2(title, { size: 20, fill: 0xFFFFFF }); titleText.x = 10; titleText.y = 4; self.addChild(titleText); var closeButton = self.attachAsset('closeButton', { anchorX: 0, anchorY: 0 }); closeButton.x = self.width - 28; closeButton.y = 2; closeButton.interactive = true; var minimizeButton = self.attachAsset('minimizeButton', { anchorX: 0, anchorY: 0 }); minimizeButton.x = self.width - 56; minimizeButton.y = 2; minimizeButton.interactive = true; var content = self.attachAsset('programContent', { anchorX: 0, anchorY: 0, width: self.width - 20, height: self.height - 50 }); content.x = 10; content.y = 40; // Program specific content self.contentArea = new Container(); self.contentArea.x = 10; self.contentArea.y = 40; self.addChild(self.contentArea); self.isDragging = false; self.dragOffsetX = 0; self.dragOffsetY = 0; titleBar.interactive = true; titleBar.down = function (x, y) { self.isDragging = true; self.dragOffsetX = x; self.dragOffsetY = y; // Bring window to front if (self.parent) { var index = self.parent.children.indexOf(self); if (index >= 0) { // Remove from current position self.parent.children.splice(index, 1); // Add to end (top) self.parent.children.push(self); } } }; titleBar.up = function () { self.isDragging = false; }; closeButton.down = function () { closeButton.alpha = 0.7; LK.getSound('click').play(); }; closeButton.up = function () { closeWindow(self); }; minimizeButton.down = function () { minimizeButton.alpha = 0.7; LK.getSound('click').play(); }; minimizeButton.up = function () { minimizeButton.alpha = 1; minimizeWindow(self); }; return self; }); var NotepadWindow = Window.expand(function () { var self = Window.call(this, "Notepad", 700, 500); var textArea = new Text2("Start typing here...", { size: 24, fill: 0x000000 }); textArea.x = 10; textArea.y = 10; self.contentArea.addChild(textArea); return self; }); var ExplorerWindow = Window.expand(function () { var self = Window.call(this, "File Explorer", 800, 600); var folderStructure = ["My Documents", "My Computer", "Network Neighborhood", "Recycle Bin"]; for (var i = 0; i < folderStructure.length; i++) { // Create a container for each folder item to handle interactions var folderItem = new Container(); folderItem.interactive = true; folderItem.x = 10; folderItem.y = i * 60 + 10; var folderIcon = LK.getAsset('desktopIcon', { anchorX: 0, anchorY: 0, width: 48, height: 48 }); folderIcon.tint = 0xFFFF00; folderIcon.x = 0; folderIcon.y = 0; var folderName = new Text2(folderStructure[i], { size: 20, fill: 0x000000 }); folderName.x = 60; folderName.y = 14; folderItem.addChild(folderIcon); folderItem.addChild(folderName); // Add click functionality folderItem.name = folderStructure[i]; folderItem.lastSelected = false; folderItem.down = function () { this.children[0].tint = 0xCCCC00; // Darker yellow when clicked LK.getSound('click').play(); }; folderItem.up = function () { this.children[0].tint = 0xFFFF00; // Back to normal yellow // Open a new Explorer window or perform folder-specific action if (this.name === "My Computer") { createWindow("Explorer"); } else if (this.name === "Recycle Bin") { var emptyBinWindow = new Window("Empty Recycle Bin?", 400, 200); emptyBinWindow.x = (2048 - 400) / 2; emptyBinWindow.y = (2732 - 200) / 2; game.addChild(emptyBinWindow); activeWindows.push(emptyBinWindow); } }; self.contentArea.addChild(folderItem); } return self; }); // Red for corrupted app var CorruptedWindow = Window.expand(function () { var self = Window.call(this, "Error", 500, 300); var errorMessage = new Text2("A fatal exception has occurred.\nThe current application will be terminated.\n\nPress OK to close this window.", { size: 24, fill: 0x000000 }); errorMessage.x = 20; errorMessage.y = 30; self.contentArea.addChild(errorMessage); var okButton = new Container(); okButton.interactive = true; okButton.x = 200; okButton.y = 180; var buttonGraphic = LK.getAsset('startButton', { anchorX: 0.5, anchorY: 0.5, width: 100, height: 40 }); buttonGraphic.tint = 0xDDDDDD; var buttonText = new Text2("OK", { size: 24, fill: 0x000000 }); buttonText.anchor.set(0.5, 0.5); buttonText.x = 0; buttonText.y = 0; okButton.addChild(buttonGraphic); okButton.addChild(buttonText); okButton.down = function () { buttonGraphic.tint = 0xAAAAAA; LK.getSound('click').play(); }; okButton.up = function () { buttonGraphic.tint = 0xDDDDDD; closeWindow(self); }; self.contentArea.addChild(okButton); return self; }); var CalculatorWindow = Window.expand(function () { var self = Window.call(this, "Calculator", 300, 400); var currentValue = "0"; var previousValue = ""; var operation = ""; var resetDisplay = false; var display = new Text2("0", { size: 36, fill: 0x000000 }); display.x = 10; display.y = 10; self.contentArea.addChild(display); function updateDisplay() { display.setText(currentValue); } function calculate() { var prev = parseFloat(previousValue); var current = parseFloat(currentValue); var result = 0; switch (operation) { case "+": result = prev + current; break; case "-": result = prev - current; break; case "*": result = prev * current; break; case "/": result = prev / current; break; } return result.toString(); } function handleButtonClick(label) { LK.getSound('click').play(); if (label >= "0" && label <= "9") { if (currentValue === "0" || resetDisplay) { currentValue = label; resetDisplay = false; } else { currentValue += label; } updateDisplay(); } else if (label === ".") { if (!currentValue.includes(".")) { currentValue += "."; updateDisplay(); } } else if (["+", "-", "*", "/"].includes(label)) { previousValue = currentValue; operation = label; resetDisplay = true; } else if (label === "=") { if (previousValue && operation) { currentValue = calculate(); previousValue = ""; operation = ""; resetDisplay = true; updateDisplay(); } } } var buttonLabels = ["7", "8", "9", "/", "4", "5", "6", "*", "1", "2", "3", "-", "0", ".", "=", "+"]; var buttonSize = 60; var padding = 5; var buttonsPerRow = 4; for (var i = 0; i < buttonLabels.length; i++) { var buttonX = i % buttonsPerRow * (buttonSize + padding) + 10; var buttonY = Math.floor(i / buttonsPerRow) * (buttonSize + padding) + 60; var buttonBg = new Container(); buttonBg.interactive = true; buttonBg.x = buttonX; buttonBg.y = buttonY; var buttonGraphic = LK.getAsset('desktopIcon', { anchorX: 0, anchorY: 0, width: buttonSize, height: buttonSize }); buttonGraphic.tint = 0xDDDDDD; var buttonText = new Text2(buttonLabels[i], { size: 30, fill: 0x000000 }); buttonText.anchor.set(0.5, 0.5); buttonText.x = buttonSize / 2; buttonText.y = buttonSize / 2; // Store the button label for the event handlers buttonBg.name = buttonLabels[i]; // Add click handling buttonBg.down = function () { this.children[0].tint = 0xAAAAAA; // Darken on press }; buttonBg.up = function () { this.children[0].tint = 0xDDDDDD; // Restore color handleButtonClick(this.name); }; buttonBg.addChild(buttonGraphic); buttonBg.addChild(buttonText); self.contentArea.addChild(buttonBg); } return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x008080 }); /**** * Game Code ****/ // Global variables var activeWindows = []; var startMenuOpen = false; var dragTarget = null; var savedWindowPositions = {}; // Create the desktop background var desktop = game.addChild(LK.getAsset('desktop', { anchorX: 0, anchorY: 0, width: 2048, height: 2732 })); // Create the taskbar var taskbar = game.addChild(LK.getAsset('taskbar', { anchorX: 0, anchorY: 1, width: 2048, height: 50 })); taskbar.y = 2732; // Create the start button var startButton = game.addChild(LK.getAsset('startButton', { anchorX: 0, anchorY: 1, width: 100, height: 40 })); startButton.x = 5; startButton.y = 2732 - 5; startButton.interactive = true; // Create the start menu var startMenu = game.addChild(new StartMenu()); // Add "Start" text to start button var startText = new Text2("Start", { size: 24, fill: 0x000000 }); startText.x = 35; startText.y = 2732 - 35; game.addChild(startText); // Create desktop icons var icons = [{ name: "My Computer", x: 100, y: 100 }, { name: "Recycle Bin", x: 100, y: 200 }, { name: "Notepad", x: 100, y: 300 }, { name: "Calculator", x: 100, y: 400 }, { name: "Explorer", x: 100, y: 500 }, { name: "Corrupted", x: 100, y: 600 }]; icons.forEach(function (icon) { var desktopIcon = new DesktopIcon(icon.name, icon.x, icon.y); game.addChild(desktopIcon); }); // Create time display in taskbar var timeDisplay = new Text2(getCurrentTime(), { size: 24, fill: 0x000000 }); timeDisplay.anchor.set(1, 0.5); timeDisplay.x = 2048 - 10; timeDisplay.y = 2732 - 25; game.addChild(timeDisplay); // Handle desktop clicks desktop.interactive = true; desktop.down = function () { if (startMenuOpen) { toggleStartMenu(); } }; // Start button handling startButton.down = function () { startButton.alpha = 0.7; LK.getSound('click').play(); }; startButton.up = function () { startButton.alpha = 1; toggleStartMenu(); }; // Game update function game.update = function () { // Update time display every second if (LK.ticks % 60 === 0) { timeDisplay.setText(getCurrentTime()); } // Handle window dragging if (dragTarget && dragTarget.isDragging) { dragTarget.x = lastMoveX - dragTarget.dragOffsetX; dragTarget.y = lastMoveY - dragTarget.dragOffsetY; // Keep windows within screen bounds dragTarget.x = Math.max(0, Math.min(2048 - dragTarget.width, dragTarget.x)); dragTarget.y = Math.max(0, Math.min(2732 - 50 - dragTarget.height, dragTarget.y)); } }; // Track mouse/touch position var lastMoveX = 0; var lastMoveY = 0; game.move = function (x, y) { lastMoveX = x; lastMoveY = y; }; // Handle global mouse up game.up = function () { if (dragTarget) { dragTarget.isDragging = false; dragTarget = null; } }; // Helper functions function toggleStartMenu() { startMenuOpen = !startMenuOpen; startMenu.visible = startMenuOpen; if (startMenuOpen) { LK.getSound('click').play(); } } function createWindow(type) { var newWindow; switch (type) { case "Notepad": newWindow = new NotepadWindow(); break; case "Calculator": newWindow = new CalculatorWindow(); break; case "Explorer": case "My Computer": newWindow = new ExplorerWindow(); break; case "Corrupted": LK.getSound('error').play(); newWindow = new CorruptedWindow(); break; default: newWindow = new Window(type, 600, 400); } // Position window - either from saved position or center if (savedWindowPositions[type]) { newWindow.x = savedWindowPositions[type].x; newWindow.y = savedWindowPositions[type].y; } else { newWindow.x = (2048 - newWindow.width) / 2; newWindow.y = (2732 - 50 - newWindow.height) / 2; } // Add Windows 98 style opening animation newWindow.scale.x = 0.1; newWindow.scale.y = 0.1; // Add to active windows and game activeWindows.push(newWindow); game.addChild(newWindow); // Animate window opening tween(newWindow, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.easeOut }); // Set as drag target dragTarget = newWindow; // Close start menu if open if (startMenuOpen) { toggleStartMenu(); } // Play sound LK.getSound('click').play(); return newWindow; } function closeWindow(window) { // Save position savedWindowPositions[window.children[1].text] = { x: window.x, y: window.y }; // Remove from active windows var index = activeWindows.indexOf(window); if (index > -1) { activeWindows.splice(index, 1); } // Remove from game game.removeChild(window); window.destroy(); // Clear drag target if it was this window if (dragTarget === window) { dragTarget = null; } } function minimizeWindow(window) { // Just hide for now - in a real implementation we'd add a taskbar button window.visible = false; // Remove from active windows but don't destroy var index = activeWindows.indexOf(window); if (index > -1) { activeWindows.splice(index, 1); } } function getCurrentTime() { var date = new Date(); var hours = date.getHours(); var minutes = date.getMinutes(); var ampm = hours >= 12 ? 'PM' : 'AM'; hours = hours % 12; hours = hours ? hours : 12; minutes = minutes < 10 ? '0' + minutes : minutes; return hours + ':' + minutes + ' ' + ampm; } // Create mouse cursor var mouseCursor = new MouseCursor(); game.addChild(mouseCursor); // Check if cursor is over a clickable element function updateCursorStyle() { var isOverClickable = false; // Check if over a desktop icon for (var i = 0; i < game.children.length; i++) { var child = game.children[i]; if (child instanceof DesktopIcon && lastMoveX >= child.x - 32 && lastMoveX <= child.x + 32 && lastMoveY >= child.y - 32 && lastMoveY <= child.y + 32) { isOverClickable = true; break; } } // Check if over explorer items in open windows for (var j = 0; j < activeWindows.length; j++) { var window = activeWindows[j]; if (window instanceof ExplorerWindow) { for (var k = 0; k < window.contentArea.children.length; k++) { var item = window.contentArea.children[k]; if (item.interactive && lastMoveX >= window.x + window.contentArea.x + item.x && lastMoveX <= window.x + window.contentArea.x + item.x + 150 && lastMoveY >= window.y + window.contentArea.y + item.y && lastMoveY <= window.y + window.contentArea.y + item.y + 50) { isOverClickable = true; break; } } } } // Update cursor style mouseCursor.setPointer(isOverClickable); } // Extend game.move to update mouse cursor var originalMove = game.move; game.move = function (x, y) { originalMove(x, y); mouseCursor.updatePosition(x, y); updateCursorStyle(); }; // Play startup sound LK.setTimeout(function () { LK.getSound('startup').play(); }, 500);
===================================================================
--- original.js
+++ change.js
@@ -32,8 +32,10 @@
} else if (iconName === "Calculator") {
icon.tint = 0xDDDDDD; // Light gray
} else if (iconName === "Explorer") {
icon.tint = 0xFFD700; // Gold
+ } else if (iconName === "Corrupted") {
+ icon.tint = 0xFF0000;
}
var label = new Text2(iconName, {
size: 24,
fill: 0xFFFFFF
@@ -322,8 +324,49 @@
self.contentArea.addChild(folderItem);
}
return self;
});
+// Red for corrupted app
+var CorruptedWindow = Window.expand(function () {
+ var self = Window.call(this, "Error", 500, 300);
+ var errorMessage = new Text2("A fatal exception has occurred.\nThe current application will be terminated.\n\nPress OK to close this window.", {
+ size: 24,
+ fill: 0x000000
+ });
+ errorMessage.x = 20;
+ errorMessage.y = 30;
+ self.contentArea.addChild(errorMessage);
+ var okButton = new Container();
+ okButton.interactive = true;
+ okButton.x = 200;
+ okButton.y = 180;
+ var buttonGraphic = LK.getAsset('startButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 100,
+ height: 40
+ });
+ buttonGraphic.tint = 0xDDDDDD;
+ var buttonText = new Text2("OK", {
+ size: 24,
+ fill: 0x000000
+ });
+ buttonText.anchor.set(0.5, 0.5);
+ buttonText.x = 0;
+ buttonText.y = 0;
+ okButton.addChild(buttonGraphic);
+ okButton.addChild(buttonText);
+ okButton.down = function () {
+ buttonGraphic.tint = 0xAAAAAA;
+ LK.getSound('click').play();
+ };
+ okButton.up = function () {
+ buttonGraphic.tint = 0xDDDDDD;
+ closeWindow(self);
+ };
+ self.contentArea.addChild(okButton);
+ return self;
+});
var CalculatorWindow = Window.expand(function () {
var self = Window.call(this, "Calculator", 300, 400);
var currentValue = "0";
var previousValue = "";
@@ -500,8 +543,12 @@
}, {
name: "Explorer",
x: 100,
y: 500
+}, {
+ name: "Corrupted",
+ x: 100,
+ y: 600
}];
icons.forEach(function (icon) {
var desktopIcon = new DesktopIcon(icon.name, icon.x, icon.y);
game.addChild(desktopIcon);
@@ -580,8 +627,12 @@
case "Explorer":
case "My Computer":
newWindow = new ExplorerWindow();
break;
+ case "Corrupted":
+ LK.getSound('error').play();
+ newWindow = new CorruptedWindow();
+ break;
default:
newWindow = new Window(type, 600, 400);
}
// Position window - either from saved position or center