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); var icon = self.attachAsset('desktopIcon', { anchorX: 0.5, anchorY: 0.5 }); 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.down = function () { icon.alpha = 0.7; LK.getSound('click').play(); }; self.up = function () { icon.alpha = 1; createWindow(iconName); }; 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++) { var folderIcon = LK.getAsset('desktopIcon', { anchorX: 0, anchorY: 0, width: 48, height: 48 }); folderIcon.tint = 0xFFFF00; folderIcon.x = 10; folderIcon.y = i * 60 + 10; var folderName = new Text2(folderStructure[i], { size: 20, fill: 0x000000 }); folderName.x = 70; folderName.y = i * 60 + 24; self.contentArea.addChild(folderIcon); self.contentArea.addChild(folderName); } return self; }); var CalculatorWindow = Window.expand(function () { var self = Window.call(this, "Calculator", 300, 400); var display = new Text2("0", { size: 36, fill: 0x000000 }); display.x = 10; display.y = 10; self.contentArea.addChild(display); 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 = LK.getAsset('desktopIcon', { anchorX: 0, anchorY: 0, width: buttonSize, height: buttonSize }); buttonBg.x = buttonX; buttonBg.y = buttonY; buttonBg.tint = 0xDDDDDD; var buttonText = new Text2(buttonLabels[i], { size: 30, fill: 0x000000 }); buttonText.anchor.set(0.5, 0.5); buttonText.x = buttonX + buttonSize / 2; buttonText.y = buttonY + buttonSize / 2; self.contentArea.addChild(buttonBg); self.contentArea.addChild(buttonText); } 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 }]; 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; 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 to active windows activeWindows.push(newWindow); game.addChild(newWindow); // 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; } // Play startup sound LK.setTimeout(function () { LK.getSound('startup').play(); }, 500);
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,437 @@
-/****
+/****
+* 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);
+ var icon = self.attachAsset('desktopIcon', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ 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.down = function () {
+ icon.alpha = 0.7;
+ LK.getSound('click').play();
+ };
+ self.up = function () {
+ icon.alpha = 1;
+ createWindow(iconName);
+ };
+ 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++) {
+ var folderIcon = LK.getAsset('desktopIcon', {
+ anchorX: 0,
+ anchorY: 0,
+ width: 48,
+ height: 48
+ });
+ folderIcon.tint = 0xFFFF00;
+ folderIcon.x = 10;
+ folderIcon.y = i * 60 + 10;
+ var folderName = new Text2(folderStructure[i], {
+ size: 20,
+ fill: 0x000000
+ });
+ folderName.x = 70;
+ folderName.y = i * 60 + 24;
+ self.contentArea.addChild(folderIcon);
+ self.contentArea.addChild(folderName);
+ }
+ return self;
+});
+var CalculatorWindow = Window.expand(function () {
+ var self = Window.call(this, "Calculator", 300, 400);
+ var display = new Text2("0", {
+ size: 36,
+ fill: 0x000000
+ });
+ display.x = 10;
+ display.y = 10;
+ self.contentArea.addChild(display);
+ 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 = LK.getAsset('desktopIcon', {
+ anchorX: 0,
+ anchorY: 0,
+ width: buttonSize,
+ height: buttonSize
+ });
+ buttonBg.x = buttonX;
+ buttonBg.y = buttonY;
+ buttonBg.tint = 0xDDDDDD;
+ var buttonText = new Text2(buttonLabels[i], {
+ size: 30,
+ fill: 0x000000
+ });
+ buttonText.anchor.set(0.5, 0.5);
+ buttonText.x = buttonX + buttonSize / 2;
+ buttonText.y = buttonY + buttonSize / 2;
+ self.contentArea.addChild(buttonBg);
+ self.contentArea.addChild(buttonText);
+ }
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ 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
+}];
+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;
+ 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 to active windows
+ activeWindows.push(newWindow);
+ game.addChild(newWindow);
+ // 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;
+}
+// Play startup sound
+LK.setTimeout(function () {
+ LK.getSound('startup').play();
+}, 500);
\ No newline at end of file