User prompt
Update as needed with: // Update cursor position calculation function updateCursorPosition() { if (!gameState.logText || !gameState.cursor) { return; } var lastLogEntry = gameState.terminal.log[gameState.terminal.log.length - 1] || ""; var lastLine = lastLogEntry.split("\n").pop(); var textWidth = lastLine.length * 14 * TEXT_SIZE_MULTIPLIER; gameState.cursor.x = 50 + textWidth; var totalLines = 0; gameState.terminal.log.forEach(function(entry) { totalLines += entry.split("\n").length + 1; }); // Adjust cursor Y position based on new terminal positioning var baseY = 2732 * 0.15; // Match terminal output Y position gameState.cursor.y = baseY + (totalLines - 1) * 30 * TEXT_SIZE_MULTIPLIER; }
User prompt
Update as needed with: // Updated button creation with dynamic width function createCommandButton(text, callback, width) { var button = new Container(); // Add button background with dynamic width var bg = LK.getAsset('buttonBg', { width: width, height: 100, color: 0x333333 }); bg.anchor.set(0.5, 0.5); button.addChild(bg); // Add text var textObj = new Text2(text, { size: 30 * TEXT_SIZE_MULTIPLIER, fill: 0x00ff00 }); textObj.anchor.set(0.5, 0.5); button.addChild(textObj); // Make interactive button.interactive = true; button.down = function() { button.scale.set(0.95); }; button.up = function() { button.scale.set(1); if (callback) { callback(); } }; return button; }
User prompt
Update as needed with: // Update command prompts with dynamic sizing and adjusted positioning function createCommandPrompts() { if (gameState.promptContainer) { game.removeChild(gameState.promptContainer); } var promptContainer = new Container(); promptContainer.x = 2048 / 2; promptContainer.y = 2732 * 0.75; // Moved to 75% from top game.addChild(promptContainer); gameState.promptContainer = promptContainer; // Get current command set and select 5 random commands var commands = getCurrentCommands(); var availableCommands = shuffleArray(commands).slice(0, 5); // Create END DAY button with dynamic width var endDayText = "END DAY"; var endDayWidth = calculateButtonWidth(endDayText); var endDayButton = createCommandButton(endDayText, function() { endDay(); }, endDayWidth); endDayButton.x = 600; endDayButton.y = 50; promptContainer.addChild(endDayButton); // Create command buttons with dynamic widths availableCommands.forEach(function(command, index) { var buttonText = ">" + command.text; var buttonWidth = calculateButtonWidth(buttonText); var button = createCommandButton(buttonText, function() { if (gameState.commandsUsed < 3) { executeCommand(command); } else { addToTerminalLogWithEffect("ERROR: Maximum commands (3) already used for today"); } }, buttonWidth); button.x = -600; button.y = 50 + index * 120; promptContainer.addChild(button); }); }
Code edit (1 edits merged)
Please save this source code
User prompt
Update with: function createTerminal() { // Create main terminal container var terminal = new Container(); game.addChild(terminal); gameState.terminalContainer = terminal; // Create full screen background - moved down 5% var bg = LK.getAsset('terminalBg', { width: 2048, height: 2732, x: 0, y: 2732 * 0.05 // Move down 5% }); terminal.addChild(bg); // Create status line - moved down additional 5% var statusLine = new Text2("", { size: 30 * TEXT_SIZE_MULTIPLIER, fill: 0x00ff00 }); statusLine.x = 50; statusLine.y = 2732 * 0.10; // Moved to 10% from top terminal.addChild(statusLine); gameState.statusLineText = statusLine; // Create main terminal output - adjusted accordingly var logText = new Text2("", { size: 24 * TEXT_SIZE_MULTIPLIER, fill: 0x00ff00, align: 'left', wordWrap: true, wordWrapWidth: 1900 }); logText.x = 50; logText.y = 2732 * 0.15; // Moved to 15% from top terminal.addChild(logText); gameState.logText = logText; // Create blinking cursor with adjusted position var cursor = new Text2("_", { size: 24 * TEXT_SIZE_MULTIPLIER, fill: 0x00ff00 }); cursor.x = logText.x; cursor.y = logText.y; terminal.addChild(cursor); gameState.cursor = cursor; LK.setInterval(function() { cursor.visible = !cursor.visible; }, 500); }
Code edit (2 edits merged)
Please save this source code
User prompt
Add: function shuffleArray(array) { for (let i = array.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [array[i], array[j]] = [array[j], array[i]]; } return array; }
User prompt
Update with: function getCurrentCommands() { var availableCommands = []; // Add base commands availableCommands = availableCommands.concat(commandSets.initial); // Add platform-specific commands if (gameState.conceptCards.platform) { var platformCommands = commandSets['platform_' + gameState.conceptCards.platform.toLowerCase()]; if (platformCommands) { availableCommands = availableCommands.concat(platformCommands); } } // Add combination-specific commands if (gameState.conceptCards.platform && gameState.conceptCards.visual) { var combinationKey = gameState.conceptCards.platform + "_" + gameState.conceptCards.visual; var combinationSet = combinationCommands[combinationKey]; if (combinationSet) { availableCommands = availableCommands.concat(combinationSet); } } // Add day-specific commands if (gameState.day > 5) { availableCommands = availableCommands.concat(getLateGameCommands()); } return availableCommands; }
User prompt
Add: var combinationCommands = { "VR_ASCII": [ { text: "Implement 3D text rendering", response: "Converting ASCII to volumetric data...", vibePoints: 15, coherenceImpact: 20, bugChance: 0.4 }, { text: "Add depth perception", response: "Calculating character z-index...", vibePoints: 10, coherenceImpact: 15, bugChance: 0.3 } // Add more specific combinations ] };
User prompt
Update as needed with: var commandSets = { initial: [ // Basic commands { text: "Make it run faster", response: "Attempting to accelerate undefined systems...", vibePoints: 10, coherenceImpact: 15, bugChance: 0.3 }, { text: "Optimize code flow", response: "Restructuring algorithmic pathways...", vibePoints: 15, coherenceImpact: 10, bugChance: 0.2 }, { text: "Debug system", response: "Scanning for anomalies...", vibePoints: 5, coherenceImpact: 5, bugChance: 0.1 }, { text: "Implement AI assistance", response: "WARNING: AI recursion detected", vibePoints: -5, coherenceImpact: 20, bugChance: 0.4 }, { text: "Refactor codebase", response: "Restructuring core systems...", vibePoints: 20, coherenceImpact: 25, bugChance: 0.5 }, { text: "Apply design patterns", response: "Implementing architectural frameworks...", vibePoints: 15, coherenceImpact: 15, bugChance: 0.3 }, { text: "Enable quantum computing", response: "ERROR: Quantum decoherence detected", vibePoints: -10, coherenceImpact: 30, bugChance: 0.6 } ], // Platform-specific commands platform_vr: [ { text: "Reduce motion sickness", response: "Implementing anti-nausea protocols...", vibePoints: 15, coherenceImpact: 10, bugChance: 0.2 }, { text: "Enhance hand tracking", response: "Calibrating spatial recognition...", vibePoints: 20, coherenceImpact: 15, bugChance: 0.3 }, { text: "Add haptic feedback", response: "Integrating tactile response systems...", vibePoints: 10, coherenceImpact: 20, bugChance: 0.4 }, { text: "Optimize frame rate", response: "Adjusting refresh cycle timing...", vibePoints: 15, coherenceImpact: 15, bugChance: 0.3 }, { text: "Enable room scaling", response: "Calculating spatial dimensions...", vibePoints: 10, coherenceImpact: 25, bugChance: 0.4 }, { text: "Implement gesture controls", response: "Mapping kinetic inputs...", vibePoints: 15, coherenceImpact: 20, bugChance: 0.4 }, { text: "Add virtual mirrors", response: "WARNING: Reality recursion detected", vibePoints: -5, coherenceImpact: 30, bugChance: 0.6 } ] };
User prompt
Replace with: function createCommandPrompts() { // Clear existing prompts if (gameState.promptContainer) { game.removeChild(gameState.promptContainer); } // Create new prompt container var promptContainer = new Container(); promptContainer.x = 2048 / 2; promptContainer.y = 2732 * 0.7; game.addChild(promptContainer); gameState.promptContainer = promptContainer; // Get current command set var commands = getCurrentCommands(); // Randomly select 5 commands from the available pool var availableCommands = shuffleArray(commands).slice(0, 5); // Add END DAY button in fixed position var endDayButton = createCommandButton("END DAY", function() { endDay(); }); endDayButton.x = 600; endDayButton.y = 50; promptContainer.addChild(endDayButton); // Create clickable command buttons availableCommands.forEach(function(command, index) { var button = createCommandButton(">" + command.text, function() { if (gameState.commandsUsed < 3) { executeCommand(command); } else { addToTerminalLogWithEffect("ERROR: Maximum commands (3) already used for today"); } }); button.x = -600; button.y = 50 + index * 120; promptContainer.addChild(button); }); }
User prompt
Update as needed with: function createCommandPrompts() { // Clear existing prompts if (gameState.promptContainer) { game.removeChild(gameState.promptContainer); } // Create new prompt container and center it horizontally var promptContainer = new Container(); promptContainer.x = 2048 / 2; // Center the container horizontally promptContainer.y = 2732 * 0.7; game.addChild(promptContainer); gameState.promptContainer = promptContainer; // Create command background centered on container var commandBg = LK.getAsset('buttonBg', { width: 2048, height: 2732 * 0.3, anchorX: 0.5, // Center the background color: 0x111111 }); promptContainer.addChild(commandBg); // Get current command set var commands = getCurrentCommands(); // Add END DAY button first in fixed position var endDayButton = createCommandButton("END DAY", function() { endDay(); }); endDayButton.x = 600; // Position relative to container center endDayButton.y = 50; promptContainer.addChild(endDayButton); // Create clickable command buttons with proper spacing commands.forEach(function(command, index) { var button = createCommandButton(">" + command.text, function() { executeCommand(command); }); button.x = -300; // Position relative to container center button.y = 50 + (index * 120); promptContainer.addChild(button); }); }
Code edit (1 edits merged)
Please save this source code
User prompt
Replace with: function createCommandPrompts() { // Clear existing prompts if (gameState.promptContainer) { game.removeChild(gameState.promptContainer); } // Create new prompt container var promptContainer = new Container(); // Position at bottom 30% of screen promptContainer.y = 2732 * 0.7; game.addChild(promptContainer); gameState.promptContainer = promptContainer; // Create command background var commandBg = LK.getAsset('buttonBg', { width: 2048, height: 2732 * 0.3, color: 0x111111 }); promptContainer.addChild(commandBg); // Get current command set var commands = getCurrentCommands(); // Add END DAY button first in fixed position var endDayButton = createCommandButton("END DAY", function() { endDay(); }); endDayButton.x = 2048 - 300; // Right aligned endDayButton.y = 50; // Top of command area promptContainer.addChild(endDayButton); // Create clickable command buttons with proper spacing commands.forEach(function(command, index) { var button = createCommandButton(">" + command.text, function() { executeCommand(command); }); button.x = 50; // Left margin button.y = 50 + (index * 120); // 120px spacing for touch targets promptContainer.addChild(button); }); }
User prompt
Replace createbutton with: function createCommandButton(text, callback) { var button = new Container(); // Add button background for touch area var bg = LK.getAsset('buttonBg', { width: 400, height: 100, color: 0x333333 }); button.addChild(bg); // Add text var textObj = new Text2(text, { size: 30 * TEXT_SIZE_MULTIPLIER, fill: 0x00ff00 }); textObj.anchor.set(0.5, 0.5); textObj.x = bg.width / 2; textObj.y = bg.height / 2; button.addChild(textObj); // Make interactive button.interactive = true; button.down = function() { // Scale effect for touch feedback button.scale.set(0.95); }; button.up = function() { button.scale.set(1); if (callback) { callback(); } }; return button; }
User prompt
update as needed with: function showConceptSelection(category) { // Create selection container var selectionContainer = new Container(); selectionContainer.x = 2048 / 2; selectionContainer.y = 2732 / 2; game.addChild(selectionContainer); // Create background var bg = LK.getAsset('terminalBg', { width: 1800, height: 1200, anchorX: 0.5, anchorY: 0.5 }); selectionContainer.addChild(bg); // Create title var title = new Text2("SELECT " + category.toUpperCase(), { size: 40 * TEXT_SIZE_MULTIPLIER, fill: 0x00ff00 }); title.anchor.set(0.5, 0); title.y = -500; selectionContainer.addChild(title); // Get and display options var options = conceptOptions[category]; var selectedOptions = []; while (selectedOptions.length < 3 && options.length > 0) { var index = Math.floor(Math.random() * options.length); selectedOptions.push(options[index]); options.splice(index, 1); } selectedOptions.forEach((option, index) => { var button = createButton(">" + option, () => { gameState.conceptCards[category] = option; game.removeChild(selectionContainer); // Sequence the post-selection events addToTerminalLogWithEffect("SELECTED " + category.toUpperCase() + ": " + option, () => { LK.setTimeout(() => { addToTerminalLogWithEffect("INITIALIZING COMMAND INTERFACE...", () => { LK.setTimeout(() => { createCommandPrompts(); // Create commands only after initialization text updateTerminal(); }, 500); }); }, 500); }); }); button.x = 0; button.y = -200 + index * 200; selectionContainer.addChild(button); }); }
User prompt
update as needed with: function createTerminal() { // Create main terminal container var terminal = new Container(); game.addChild(terminal); gameState.terminalContainer = terminal; // Create full screen background var bg = LK.getAsset('terminalBg', { width: 2048, height: 2732, x: 0, y: 0 }); terminal.addChild(bg); // Create status line - moved down by 5% var statusLine = new Text2("", { size: 30 * TEXT_SIZE_MULTIPLIER, fill: 0x00ff00 }); statusLine.x = 50; statusLine.y = 150; // Changed from 50 terminal.addChild(statusLine); gameState.statusLineText = statusLine; // Create main terminal output - adjusted accordingly var logText = new Text2("", { size: 24 * TEXT_SIZE_MULTIPLIER, fill: 0x00ff00, align: 'left', wordWrap: true, wordWrapWidth: 1900 }); logText.x = 50; logText.y = 250; // Changed from 150 terminal.addChild(logText); gameState.logText = logText; // Create blinking cursor var cursor = new Text2("_", { size: 24 * TEXT_SIZE_MULTIPLIER, fill: 0x00ff00 }); cursor.x = logText.x; cursor.y = logText.y; terminal.addChild(cursor); gameState.cursor = cursor; // Make cursor blink LK.setInterval(() => { cursor.visible = !cursor.visible; }, 500); // NOTE: Removed createCommandPrompts() from here // Commands will now only be created after platform selection }
Code edit (5 edits merged)
Please save this source code
User prompt
update as needed with: function showConceptSelection(category) { // [Previous showConceptSelection code...] // Modify the button callback: var button = createButton(">" + option, () => { gameState.conceptCards[category] = option; addToTerminalLogWithEffect("SELECTED " + category.toUpperCase() + ": " + option, () => { LK.setTimeout(() => { addToTerminalLogWithEffect("INITIALIZING COMMAND INTERFACE...", () => { LK.setTimeout(() => { createCommandPrompts(); // Now commands appear after initialization text }, 500); }); }, 500); }); game.removeChild(selectionContainer); updateTerminal(); }); }
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Sprite is not a constructor' in or related to this line: 'var separator = new Sprite();' Line Number: 299
User prompt
Please fix the bug: 'TypeError: Sprite is not a constructor' in or related to this line: 'var screen = new Sprite();' Line Number: 242
User prompt
Please fix the bug: 'TypeError: Sprite is not a constructor' in or related to this line: 'var monitor = new Sprite();' Line Number: 235
User prompt
Please fix the bug: 'Sprite is not a constructor' in or related to this line: 'var overlay = new Sprite();' Line Number: 964
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Initialize Game
****/
// Core game setup with improved text sizes
/****
* Core Game Systems
****/
// Initialize game object
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Text size multiplier for readability
var TEXT_SIZE_MULTIPLIER = 2;
// Game states
var STATES = {
TITLE: 'title',
PLAYING: 'playing',
GAME_OVER: 'gameOver'
};
// Game state object
var gameState = {
state: STATES.TITLE,
day: 1,
maxDays: 10,
vibePoints: 100,
codeCoherence: 100,
bugs: 0,
commandsUsed: 0,
maxCommandsPerDay: 3,
terminal: {
log: [],
statusLine: "",
currentTask: "",
featureTags: []
},
conceptCards: {
platform: null,
visual: null,
genre: null,
mechanic: null,
feature: null
}
};
// Concept options
var conceptOptions = {
platform: ["Mobile", "VR", "Console", "PC", "Smart Fridge", "Smart Watch", "Metaverse"],
visual: ["Pixel Art", "ASCII", "Hand-drawn", "Corporate PowerPoint", "Low-poly", "Claymation"],
genre: ["Horror", "Dating Sim", "RPG", "Educational", "Battle Royale", "Idle Clicker"],
mechanic: ["Gacha", "Physics-based", "Deckbuilding", "Match-3", "Auto-battler"],
feature: ["Cloud Save", "Microtransactions", "AI Companions", "Procedural Generation", "NFT Integration"]
};
// Available commands based on development stage
var commandSets = {
initial: [
// Basic commands
{
text: "Make it run faster",
response: "Attempting to accelerate undefined systems...",
vibePoints: 10,
coherenceImpact: 15,
bugChance: 0.3
}, {
text: "Optimize code flow",
response: "Restructuring algorithmic pathways...",
vibePoints: 15,
coherenceImpact: 10,
bugChance: 0.2
}, {
text: "Debug system",
response: "Scanning for anomalies...",
vibePoints: 5,
coherenceImpact: 5,
bugChance: 0.1
}, {
text: "Implement AI assistance",
response: "WARNING: AI recursion detected",
vibePoints: -5,
coherenceImpact: 20,
bugChance: 0.4
}, {
text: "Refactor codebase",
response: "Restructuring core systems...",
vibePoints: 20,
coherenceImpact: 25,
bugChance: 0.5
}, {
text: "Apply design patterns",
response: "Implementing architectural frameworks...",
vibePoints: 15,
coherenceImpact: 15,
bugChance: 0.3
}, {
text: "Enable quantum computing",
response: "ERROR: Quantum decoherence detected",
vibePoints: -10,
coherenceImpact: 30,
bugChance: 0.6
}],
// Platform-specific commands
platform_vr: [{
text: "Reduce motion sickness",
response: "Implementing anti-nausea protocols...",
vibePoints: 15,
coherenceImpact: 10,
bugChance: 0.2
}, {
text: "Enhance hand tracking",
response: "Calibrating spatial recognition...",
vibePoints: 20,
coherenceImpact: 15,
bugChance: 0.3
}, {
text: "Add haptic feedback",
response: "Integrating tactile response systems...",
vibePoints: 10,
coherenceImpact: 20,
bugChance: 0.4
}, {
text: "Optimize frame rate",
response: "Adjusting refresh cycle timing...",
vibePoints: 15,
coherenceImpact: 15,
bugChance: 0.3
}, {
text: "Enable room scaling",
response: "Calculating spatial dimensions...",
vibePoints: 10,
coherenceImpact: 25,
bugChance: 0.4
}, {
text: "Implement gesture controls",
response: "Mapping kinetic inputs...",
vibePoints: 15,
coherenceImpact: 20,
bugChance: 0.4
}, {
text: "Add virtual mirrors",
response: "WARNING: Reality recursion detected",
vibePoints: -5,
coherenceImpact: 30,
bugChance: 0.6
}]
};
var combinationCommands = {
"VR_ASCII": [{
text: "Implement 3D text rendering",
response: "Converting ASCII to volumetric data...",
vibePoints: 15,
coherenceImpact: 20,
bugChance: 0.4
}, {
text: "Add depth perception",
response: "Calculating character z-index...",
vibePoints: 10,
coherenceImpact: 15,
bugChance: 0.3
}
// Add more specific combinations
]
};
/****
* Terminal Interface
****/
function createTerminal() {
// Create main terminal container
var terminal = new Container();
game.addChild(terminal);
gameState.terminalContainer = terminal;
// Create full screen background - moved down 5%
var bg = LK.getAsset('terminalBg', {
width: 2048,
height: 2732,
x: 0,
y: 2732 * 0.05 // Move down 5%
});
terminal.addChild(bg);
// Create status line - moved down additional 5%
var statusLine = new Text2("", {
size: 30 * TEXT_SIZE_MULTIPLIER,
fill: 0x00ff00
});
statusLine.x = 50;
statusLine.y = 2732 * 0.10; // Moved to 10% from top
terminal.addChild(statusLine);
gameState.statusLineText = statusLine;
// Create main terminal output - adjusted accordingly
var logText = new Text2("", {
size: 24 * TEXT_SIZE_MULTIPLIER,
fill: 0x00ff00,
align: 'left',
wordWrap: true,
wordWrapWidth: 1900
});
logText.x = 50;
logText.y = 2732 * 0.15; // Moved to 15% from top
terminal.addChild(logText);
gameState.logText = logText;
// Create blinking cursor with adjusted position
var cursor = new Text2("_", {
size: 24 * TEXT_SIZE_MULTIPLIER,
fill: 0x00ff00
});
cursor.x = logText.x;
cursor.y = logText.y; // Initial position, updateTerminal will correct it later
terminal.addChild(cursor);
gameState.cursor = cursor;
// Make cursor blink
LK.setInterval(function () {
if (gameState.cursor) {
// Check if cursor exists before accessing visibility
gameState.cursor.visible = !gameState.cursor.visible;
}
}, 500);
// NOTE: Removed createCommandPrompts() from here
// Commands will now only be created after platform selection
}
// Update command prompts with dynamic sizing and adjusted positioning
function createCommandPrompts() {
if (gameState.promptContainer) {
game.removeChild(gameState.promptContainer);
}
var promptContainer = new Container();
promptContainer.x = 2048 / 2;
promptContainer.y = 2732 * 0.75; // Moved to 75% from top
game.addChild(promptContainer);
gameState.promptContainer = promptContainer;
// Get current command set and select 5 random commands
var commands = getCurrentCommands();
var availableCommands = shuffleArray(commands).slice(0, 5);
// Create END DAY button with dynamic width
var endDayText = "END DAY";
var endDayWidth = calculateButtonWidth(endDayText);
var endDayButton = createCommandButton(endDayText, function () {
endDay();
}, endDayWidth);
endDayButton.x = 600;
endDayButton.y = 50;
promptContainer.addChild(endDayButton);
// Create command buttons with dynamic widths
availableCommands.forEach(function (command, index) {
var buttonText = ">" + command.text;
var buttonWidth = calculateButtonWidth(buttonText);
var button = createCommandButton(buttonText, function () {
if (gameState.commandsUsed < 3) {
executeCommand(command);
} else {
addToTerminalLogWithEffect("ERROR: Maximum commands (3) already used for today");
}
}, buttonWidth);
button.x = -600;
button.y = 50 + index * 120;
promptContainer.addChild(button);
});
}
function getCurrentCommands() {
var availableCommands = [];
// Add base commands
availableCommands = availableCommands.concat(commandSets.initial);
// Add platform-specific commands
if (gameState.conceptCards.platform) {
var platformCommands = commandSets['platform_' + gameState.conceptCards.platform.toLowerCase()];
if (platformCommands) {
availableCommands = availableCommands.concat(platformCommands);
}
}
// Add combination-specific commands
if (gameState.conceptCards.platform && gameState.conceptCards.visual) {
var combinationKey = gameState.conceptCards.platform + "_" + gameState.conceptCards.visual;
var combinationSet = combinationCommands[combinationKey];
if (combinationSet) {
availableCommands = availableCommands.concat(combinationSet);
}
}
// Add day-specific commands
if (gameState.day > 5) {
availableCommands = availableCommands.concat(getLateGameCommands());
}
return availableCommands;
}
function executeCommand(command) {
if (gameState.commandsUsed >= gameState.maxCommandsPerDay) {
addToTerminalLogWithEffect("ERROR: Daily command limit reached");
return;
}
// Apply command effects
gameState.vibePoints = Math.max(0, gameState.vibePoints + command.vibePoints);
gameState.codeCoherence = Math.max(0, gameState.codeCoherence - command.coherenceImpact);
gameState.commandsUsed++;
// Add to terminal log
addToTerminalLogWithEffect(">" + command.text);
// Show response
LK.setTimeout(function () {
addToTerminalLogWithEffect(command.response);
checkForBugs(command);
updateTerminal();
checkGameState();
}, 500);
}
function addToTerminalLogWithEffect(text, callback) {
var typingState = {
text: text,
position: 0,
currentText: ""
};
var logIndex = gameState.terminal.log.length;
gameState.terminal.log.push("");
function type() {
if (typingState.position < typingState.text.length) {
typingState.currentText += typingState.text[typingState.position];
gameState.terminal.log[logIndex] = typingState.currentText;
updateTerminal();
typingState.position++;
LK.setTimeout(type, 50);
} else if (callback) {
callback();
}
}
type();
}
function updateTerminal() {
// Update status line
var conceptString = "";
for (var category in gameState.conceptCards) {
if (gameState.conceptCards[category]) {
conceptString += "#" + gameState.conceptCards[category].replace(/\s+/g, '') + " ";
}
}
var statusText = "DAY: " + gameState.day + "/" + gameState.maxDays + " | VIBES: " + gameState.vibePoints + "%" + " | COHERENCE: " + gameState.codeCoherence + "%" + " | BUGS: " + gameState.bugs + " | " + conceptString;
gameState.statusLineText.setText(statusText);
// Update main terminal log
gameState.logText.setText(gameState.terminal.log.join('\n\n'));
// Update cursor position
updateCursorPosition();
}
function updateCursorPosition() {
if (!gameState.logText || !gameState.cursor) {
return;
}
var lastLogEntry = gameState.terminal.log[gameState.terminal.log.length - 1] || "";
var lastLine = lastLogEntry.split("\n").pop();
var textWidth = lastLine.length * 14 * TEXT_SIZE_MULTIPLIER;
gameState.cursor.x = 50 + textWidth;
var totalLines = 0;
gameState.terminal.log.forEach(function (entry) {
totalLines += entry.split("\n").length + 1;
});
// Adjust cursor Y position based on new terminal positioning
var baseY = 2732 * 0.15; // Match terminal output Y position
gameState.cursor.y = baseY + (totalLines - 1) * 30 * TEXT_SIZE_MULTIPLIER;
}
/****
* Game Flow
****/
function showConceptSelection(category) {
// Create selection container
var selectionContainer = new Container();
selectionContainer.x = 2048 / 2;
selectionContainer.y = 2732 / 2;
game.addChild(selectionContainer);
// Create background
var bg = LK.getAsset('terminalBg', {
width: 1800,
height: 1200,
anchorX: 0.5,
anchorY: 0.5
});
selectionContainer.addChild(bg);
// Create title
var title = new Text2("SELECT " + category.toUpperCase(), {
size: 40 * TEXT_SIZE_MULTIPLIER,
fill: 0x00ff00
});
title.anchor.set(0.5, 0);
title.y = -500;
selectionContainer.addChild(title);
// Get and display options
var options = conceptOptions[category].slice(); // Use slice to avoid modifying the original array
var selectedOptions = [];
while (selectedOptions.length < 3 && options.length > 0) {
var index = Math.floor(Math.random() * options.length);
selectedOptions.push(options[index]);
options.splice(index, 1); // Remove selected option from the copy
}
selectedOptions.forEach(function (option, index) {
var button = createCommandButton(">" + option, function () {
// Changed createButton to createCommandButton
gameState.conceptCards[category] = option;
game.removeChild(selectionContainer);
// Sequence the post-selection events
addToTerminalLogWithEffect("SELECTED " + category.toUpperCase() + ": " + option, function () {
LK.setTimeout(function () {
addToTerminalLogWithEffect("INITIALIZING COMMAND INTERFACE...", function () {
LK.setTimeout(function () {
createCommandPrompts(); // Create commands only after initialization text
updateTerminal(); // Update terminal *after* prompts are created
}, 500);
});
}, 500);
});
});
button.x = 0; // Keep x centered relative to container
button.y = -200 + index * 150; // Adjusted spacing for button height
selectionContainer.addChild(button);
});
}
function createCommandButton(text, callback) {
var button = new Container();
// Add button background with dynamic width
var bg = LK.getAsset('buttonBg', {
width: width,
// Use the provided width parameter
height: 100,
color: 0x333333 // Using shape color as fallback
});
bg.anchor.set(0.5, 0.5); // Center anchor for easier positioning
button.addChild(bg);
// Add text
var textObj = new Text2(text, {
size: 30 * TEXT_SIZE_MULTIPLIER,
fill: 0x00ff00
});
textObj.anchor.set(0.5, 0.5);
// Position text in the center of the background
// textObj.x = bg.width / 2; // Not needed with centered background and text anchors
// textObj.y = bg.height / 2;
button.addChild(textObj);
// Make interactive
button.interactive = true;
button.down = function () {
// Scale effect for touch feedback
button.scale.set(0.95);
};
button.up = function () {
button.scale.set(1);
if (callback) {
callback();
}
};
return button;
}
// Launch sequence functions
function showLaunchScreen() {
// Black overlay
var overlay = LK.getAsset('overlayBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2
});
game.addChild(overlay);
// "Booting up" text
var bootText = new Text2("BOOTING VIBE CODER OS v1.0...", {
size: 40 * TEXT_SIZE_MULTIPLIER,
fill: 0x00ff00
});
bootText.anchor.set(0.5, 0.5);
bootText.x = 2048 / 2;
bootText.y = 2732 / 2;
game.addChild(bootText);
// Simulate boot sequence
LK.setTimeout(function () {
bootText.setText(bootText.text + "\nINITIALIZING TERMINAL...");
LK.setTimeout(function () {
bootText.setText(bootText.text + "\nLOADING VIBE DATABASE...");
LK.setTimeout(function () {
bootText.setText(bootText.text + "\nCONNECTING TO AI SUBSYSTEMS...");
LK.setTimeout(function () {
bootText.setText(bootText.text + "\nREADY!");
LK.setTimeout(function () {
// Fade out
tween(overlay, {
alpha: 0
}, {
duration: 500,
onFinish: function onFinish() {
game.removeChild(overlay);
game.removeChild(bootText);
showTitleScreen();
}
});
}, 800);
}, 800);
}, 800);
}, 800);
}, 800);
}
function showTitleScreen() {
// Clear screen
while (game.children.length > 0) {
game.removeChild(game.children[0]);
}
// Set state
gameState.state = STATES.TITLE;
// Create background
var background = LK.getAsset('overlayBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2
});
game.addChild(background);
// Create title
var title = new Text2("VIBE CODER", {
size: 120 * TEXT_SIZE_MULTIPLIER,
fill: 0x00ff00
});
title.anchor.set(0.5, 0.5);
title.x = 2048 / 2;
title.y = 800;
game.addChild(title);
// Create subtitle
var subtitle = new Text2("The AI Coding Simulator", {
size: 60 * TEXT_SIZE_MULTIPLIER,
fill: 0x00ff00
});
subtitle.anchor.set(0.5, 0.5);
subtitle.x = 2048 / 2;
subtitle.y = 1000;
game.addChild(subtitle);
// Create start button
var startButton = createCommandButton(">START", function () {
// Changed createButton to createCommandButton
initGameWithIntro();
});
startButton.x = 2048 / 2;
startButton.y = 1400;
game.addChild(startButton);
}
function initGameWithIntro() {
// Clear screen with fade effect
var fadeOverlay = LK.getAsset('overlayBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2,
alpha: 0
});
game.addChild(fadeOverlay);
// Fade to black
tween(fadeOverlay, {
alpha: 1
}, {
duration: 500,
onFinish: function onFinish() {
// Clear screen and init game state
while (game.children.length > 0) {
game.removeChild(game.children[0]);
}
initGame();
// Fade from black
fadeOverlay.alpha = 1;
game.addChild(fadeOverlay);
tween(fadeOverlay, {
alpha: 0
}, {
duration: 500,
onFinish: function onFinish() {
game.removeChild(fadeOverlay);
}
});
}
});
}
// Helper function to calculate button width based on text length
function calculateButtonWidth(text) {
var minWidth = 400; // Minimum button width
var charWidth = 20 * TEXT_SIZE_MULTIPLIER; // Approximate width per character
var calculatedWidth = text.length * charWidth;
return Math.max(minWidth, calculatedWidth + 80); // Add padding
}
function shuffleArray(array) {
for (var i = array.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var _ref = [array[j], array[i]];
array[i] = _ref[0];
array[j] = _ref[1];
}
return array;
}
function endDay() {
gameState.day++;
if (gameState.day > gameState.maxDays) {
evaluateProject();
return;
}
gameState.commandsUsed = 0;
gameState.codeCoherence = Math.min(100, gameState.codeCoherence + 10);
addToTerminalLogWithEffect("DAY " + gameState.day + " INITIALIZED");
updateTerminal();
// Check if it's a concept selection day
var conceptDays = {
1: 'platform',
3: 'visual',
5: 'genre',
7: 'mechanic',
9: 'feature'
};
if (conceptDays[gameState.day]) {
LK.setTimeout(function () {
showConceptSelection(conceptDays[gameState.day]);
}, 500);
}
}
function checkForBugs(command) {
var bugChance = command.bugChance * (1 + (100 - gameState.codeCoherence) / 100);
if (Math.random() < bugChance) {
gameState.bugs++;
addToTerminalLogWithEffect("WARNING: Bug detected in system");
}
}
function checkGameState() {
if (gameState.bugs >= 10) {
gameOver("CRITICAL FAILURE: TOO MANY BUGS");
return;
}
if (gameState.codeCoherence <= 0) {
gameOver("FATAL ERROR: CODE COHERENCE LOST");
return;
}
if (gameState.commandsUsed >= gameState.maxCommandsPerDay) {
addToTerminalLogWithEffect("NOTICE: Daily command limit reached. END DAY to continue.");
}
}
function evaluateProject() {
var score = gameState.vibePoints * 0.4 + Object.values(gameState.conceptCards).filter(Boolean).length * 10 + (10 - gameState.bugs) * 5 + gameState.codeCoherence * 0.2;
score = Math.round(Math.min(100, score));
gameOver("PROJECT COMPLETE!\nFINAL SCORE: " + score + "/100\n\n" + generateReview(score));
}
function generateReview(score) {
// [Previous review generation code remains the same]
}
function gameOver(message) {
gameState.state = STATES.GAME_OVER;
addToTerminalLogWithEffect(message);
addToTerminalLogWithEffect("\n>PRESS ANY KEY TO RESTART");
// Simple click anywhere to restart
var overlay = new Container();
overlay.width = 2048;
overlay.height = 2732;
overlay.interactive = true;
overlay.down = initGame;
game.addChild(overlay);
}
function initGame() {
// Reset game state
gameState = {
state: STATES.PLAYING,
day: 1,
maxDays: 10,
vibePoints: 100,
codeCoherence: 100,
bugs: 0,
commandsUsed: 0,
maxCommandsPerDay: 3,
terminal: {
log: [],
statusLine: "",
currentTask: "",
featureTags: []
},
conceptCards: {
platform: null,
visual: null,
genre: null,
mechanic: null,
feature: null
}
};
createTerminal();
// Sequence the initial text
LK.setTimeout(function () {
addToTerminalLogWithEffect("VIBE CODER OS v1.0", function () {
LK.setTimeout(function () {
addToTerminalLogWithEffect("INITIALIZING NEW PROJECT...", function () {
LK.setTimeout(function () {
addToTerminalLogWithEffect("SELECT PLATFORM TO BEGIN", function () {
LK.setTimeout(function () {
showConceptSelection('platform');
}, 500);
});
}, 500);
});
}, 500);
});
}, 500);
}
// Start with launch screen
showLaunchScreen(); ===================================================================
--- original.js
+++ change.js
@@ -353,9 +353,11 @@
var totalLines = 0;
gameState.terminal.log.forEach(function (entry) {
totalLines += entry.split("\n").length + 1;
});
- gameState.cursor.y = 150 + (totalLines - 1) * 30 * TEXT_SIZE_MULTIPLIER;
+ // Adjust cursor Y position based on new terminal positioning
+ var baseY = 2732 * 0.15; // Match terminal output Y position
+ gameState.cursor.y = baseY + (totalLines - 1) * 30 * TEXT_SIZE_MULTIPLIER;
}
/****
* Game Flow
****/
vibebeat1
Music
vibebeat2
Music
vibebeat3
Music
vibebeat4
Music
vibebeat5
Music
vibebeat6
Music
buttonsound
Sound effect
endday
Sound effect
startsound
Sound effect
bugsquish
Sound effect
conceptbutton
Sound effect
wheelstart
Sound effect
wheelspin
Sound effect
wheelstop
Sound effect
keytype
Sound effect