Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'self.parent.addChild(self);' Line Number: 114
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'self.parent.addChild(self);' Line Number: 113
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'self.parent.addChild(self);' Line Number: 113
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'self.parent.addChild(self);' Line Number: 113
User prompt
Please fix the bug: 'TypeError: undefined is not an object (evaluating 'child.text.includes')' in or related to this line: 'if (child instanceof Text2 && child.text.includes("Required Features")) {' Line Number: 771
Code edit (1 edits merged)
Please save this source code
User prompt
Vibe Coder
Initial prompt
## Project: "Vibe Coder" Game Boilerplate ### Core Requirements Create a fully playable single-game experience of "Vibe Coder" where the player acts as a developer who doesn't know how to code but uses "vibe prompts" to get an AI to generate code for them. Focus only on core gameplay with one complete game cycle. ### Game Structure #### Setup Phase - **Project Assignment:** Player receives a random project type with specific requirements - **Initial State:** Player starts with 10 Vibe Points, empty codebase (0 lines), Context Collapse at 0% - **Time Limit:** 10 in-game days until deadline #### Main Gameplay Loop - **Turn Structure:** Each turn represents one workday - **Card Draw:** Player draws 5 prompt cards each day - **Actions:** Player can play 1-3 cards per turn - **End Turn:** Player manually ends turn when desired ### Core Mechanics #### Card Playing - **Card Selection:** Player selects cards from hand to play - **Effect Resolution:** Each played card: 1. Adds specific number of code lines to project 2. Awards Vibe Points 3. Increases Context Collapse risk 4. May trigger special effects #### Context Collapse System - **Collapse Meter:** Visual meter showing 0-100% - **Calculation:** Each card adds (Lines × Complexity Factor) to the meter - **Thresholds:** At 30%, 50%, 75%, and 90%, different bug risks activate - **Bug Generation:** When thresholds are crossed, chance to generate bug cards #### Bug Management - **Bug Types:** Syntax Error, Logic Bug, Hallucination, Amnesia - **Resolution Options:** 1. Spend Vibe Points to fix instantly 2. Use special cards to fix bugs 3. Dedicate a turn to debugging (fixing all bugs of one type) - **Effects:** Bugs block features, add phantom code, or delete existing code ### User Interface Requirements #### Main Screen Elements - **Top Bar:** Project type, days remaining, progress toward minimum line requirement - **Left Side:** Vibe Points counter (prominent display) - **Center:** Visual representation of codebase (stylized blocks representing code) - **Right Side:** Context Collapse meter with threshold markers - **Bottom:** Card hand (5 card slots) - **Bug Area:** Visual representation of active bugs affecting the codebase #### Card Design - **Card Layout:** Title, effect description, lines of code added, vibe points earned - **Visual Differentiation:** Different card types have distinct visual styles - **Animation:** Cards should have subtle hover effects and play animations when used ### Assets Needed #### Core Visual Elements - **Cards:** ~30 unique prompt cards with humorous text - **Bugs:** 4 distinct bug type visualizations - **Codebase:** Visual representation that grows as code is added - **UI Elements:** Meters, counters, buttons in a tech/coding theme - **Backgrounds:** Office environment with computer #### Audio Elements - **Sound Effects:** Card draw, card play, bug appearance, bug fix, turn end - **Background Music:** One tech/coding themed track - **Alert Sounds:** For bug generation and critical events ### Game Data #### Card Database (Minimum 30 cards) Example entries: 1. **"Just make the player jump, you know what I mean"** - Adds 20 lines of code - +2 Vibe Points - Complexity Factor: 1.0 - Category: Movement 2. **"Make everything pixel art but HD"** - Adds 30 lines of code - +4 Vibe Points - Complexity Factor: 0.8 - Category: Graphics 3. **"Copy that battle royale circle thing"** - Adds 50 lines of code - +5 Vibe Points - Complexity Factor: 1.2 - Category: Gameplay 4. **"Let me clarify that..."** - Fix any one Syntax Error or Logic Bug - Complexity Factor: 0.5 - Category: Utility #### Project Types (Minimum 5) Example entries: 1. **Mobile Clicker Game** - Line Requirement: 200 - Feature Needs: UI, Animation, Progression - Special: High Vibe requirement 2. **Simple Platformer** - Line Requirement: 350 - Feature Needs: Movement, Physics, Level Design - Special: Low bug tolerance ### Technical Implementation Focus #### Priority Features 1. **Complete Game Loop:** Setup → play cards → manage bugs → end condition 2. **Context Collapse System:** Working meter with bug generation 3. **Card Management:** Draw, play, and resolve card effects 4. **Bug System:** Generation, effects, and resolution options 5. **Win/Loss Conditions:** Project completion or deadline reached #### Secondary Features (implement if time allows) 1. **Visual Code Representation:** Stylized view of the growing codebase 2. **Bug Animations:** Visual feedback for bugs affecting code 3. **Day Transition:** Brief animation between workdays 4. **End Report:** Final evaluation of the project
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Bug = Container.expand(function () {
var self = Container.call(this);
var bugGraphic = self.attachAsset('bug', {
anchorX: 0.5,
anchorY: 0.5
});
self.codeLinesCost = Math.floor(Math.random() * 10) + 5;
self.vibePointsCost = Math.floor(Math.random() * 3) + 1;
var costText = new Text2("-" + self.codeLinesCost + " lines\n-" + self.vibePointsCost + " VP", {
size: 24,
fill: 0xFFFFFF
});
costText.anchor.set(0.5, 0.5);
self.addChild(costText);
self.down = function (x, y, obj) {
if (gameState.vibePoints >= self.vibePointsCost) {
// Fix bug
gameState.codeLines -= self.codeLinesCost;
gameState.vibePoints -= self.vibePointsCost;
gameState.bugs--;
LK.getSound('bugFix').play();
updateStatsDisplay();
// Remove bug with effect
tween(self, {
scaleX: 0,
scaleY: 0,
alpha: 0
}, {
duration: 300,
onFinish: function onFinish() {
self.parent.removeChild(self);
self.destroy();
}
});
}
};
return self;
});
var Card = Container.expand(function (type, promptText, codeLines, vibePoints, contextImpact, bugChance) {
var self = Container.call(this);
self.type = type || 'basic';
self.promptText = promptText || "Just a vibe, you know?";
self.codeLines = codeLines || 10;
self.vibePoints = vibePoints || 1;
self.contextImpact = contextImpact || 5;
self.bugChance = bugChance || 0.2;
// Card background
var cardBg = self.attachAsset('card', {
anchorX: 0.5,
anchorY: 0.5
});
// Card text
self.titleText = new Text2(self.type.toUpperCase(), {
size: 40,
fill: 0x000000
});
self.titleText.anchor.set(0.5, 0);
self.titleText.x = 0;
self.titleText.y = -220;
self.addChild(self.titleText);
self.promptTextObj = new Text2(self.promptText, {
size: 30,
fill: 0x000000
});
self.promptTextObj.anchor.set(0.5, 0);
self.promptTextObj.x = 0;
self.promptTextObj.y = -160;
self.promptTextObj.width = 350;
self.addChild(self.promptTextObj);
// Card stats
var statsText = "Code Lines: " + self.codeLines + "\n" + "Vibe Points: " + self.vibePoints + "\n" + "Context Impact: " + self.contextImpact + "\n" + "Bug Chance: " + Math.round(self.bugChance * 100) + "%";
self.statsTextObj = new Text2(statsText, {
size: 30,
fill: 0x000000
});
self.statsTextObj.anchor.set(0.5, 0);
self.statsTextObj.x = 0;
self.statsTextObj.y = 50;
self.addChild(self.statsTextObj);
self.down = function (x, y, obj) {
if (!self.isDragging && gameState.phase === 'playing') {
self.isDragging = true;
self.dragOffsetX = x - self.x;
self.dragOffsetY = y - self.y;
// Set the global dragNode to this card
dragNode = self;
// Bring to front
if (self.parent) {
var parent = self.parent;
parent.removeChild(self);
// Only try to add back if we still have the same parent
if (parent === self.parent || !self.parent) {
parent.addChild(self);
}
}
// Scale up slightly
tween(self, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 200
});
}
};
self.up = function (x, y, obj) {
if (self.isDragging) {
self.isDragging = false;
tween(self, {
scaleX: 1,
scaleY: 1
}, {
duration: 200
});
// Check if card was dropped on the project area
if (y < projectAreaY && gameState.canPlayCard) {
playCard(self);
} else if (self.parent) {
// Return to hand only if card still has a parent
tween(self, {
x: self.originalX,
y: self.originalY
}, {
duration: 300
});
}
}
};
return self;
});
var DayIndicator = Container.expand(function () {
var self = Container.call(this);
var circle = self.attachAsset('dayIndicator', {
anchorX: 0.5,
anchorY: 0.5
});
self.dayText = new Text2("DAY\n1", {
size: 50,
fill: 0xFFFFFF
});
self.dayText.anchor.set(0.5, 0.5);
self.addChild(self.dayText);
self.updateDay = function (day) {
self.dayText.setText("DAY\n" + day);
// Pulse animation
tween(self, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 300,
onFinish: function onFinish() {
tween(self, {
scaleX: 1,
scaleY: 1
}, {
duration: 300
});
}
});
};
return self;
});
var MenuButton = Container.expand(function (text, callback) {
var self = Container.call(this);
var buttonBg = self.attachAsset('menuButton', {
anchorX: 0.5,
anchorY: 0.5
});
var buttonText = new Text2(text, {
size: 40,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.down = function (x, y, obj) {
tween(self, {
scaleX: 0.95,
scaleY: 0.95
}, {
duration: 100
});
};
self.up = function (x, y, obj) {
tween(self, {
scaleX: 1,
scaleY: 1
}, {
duration: 100,
onFinish: function onFinish() {
if (callback) {
callback();
}
}
});
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1e2329
});
/****
* Game Code
****/
// Game constants
var MAX_DAYS = 10;
var TARGET_CODE_LINES = 1000;
var MAX_CONTEXT_COLLAPSE = 100;
var HAND_SIZE = 5;
var MAX_BUGS = 10;
// Game state variables
var gameState = {
day: 1,
codeLines: 0,
vibePoints: 5,
contextCollapse: 0,
bugs: 0,
phase: 'menu',
// 'menu', 'playing', 'dayEnd', 'gameOver'
canPlayCard: true,
features: {
ui: false,
database: false,
api: false,
security: false
}
};
// Card position constants
var projectAreaY = 2732 * 0.6;
var handY = 2732 - 300;
var deckX = 200;
var deckY = handY;
// Card templates
var cardTemplates = [
// Basic cards
{
type: 'basic',
promptText: "Make it work like that app, you know the one",
codeLines: 15,
vibePoints: 1,
contextImpact: 5,
bugChance: 0.2
}, {
type: 'basic',
promptText: "Just spaghetti code it for now",
codeLines: 25,
vibePoints: 1,
contextImpact: 15,
bugChance: 0.4
}, {
type: 'basic',
promptText: "It should be like... clean and efficient",
codeLines: 12,
vibePoints: 2,
contextImpact: 3,
bugChance: 0.1
}, {
type: 'basic',
promptText: "Use that coding pattern with the factory thing",
codeLines: 20,
vibePoints: 2,
contextImpact: 8,
bugChance: 0.2
},
// UI cards
{
type: 'UI',
promptText: "Make it look like Apple but not too much",
codeLines: 30,
vibePoints: 3,
contextImpact: 10,
bugChance: 0.2,
feature: 'ui'
}, {
type: 'UI',
promptText: "I want that Material Design vibe but more flat",
codeLines: 35,
vibePoints: 3,
contextImpact: 12,
bugChance: 0.3,
feature: 'ui'
},
// Database cards
{
type: 'Database',
promptText: "Store stuff efficiently, you know?",
codeLines: 40,
vibePoints: 4,
contextImpact: 15,
bugChance: 0.3,
feature: 'database'
}, {
type: 'Database',
promptText: "Like SQL but without actual SQL",
codeLines: 45,
vibePoints: 4,
contextImpact: 20,
bugChance: 0.4,
feature: 'database'
},
// API cards
{
type: 'API',
promptText: "Make endpoints that just work",
codeLines: 35,
vibePoints: 3,
contextImpact: 12,
bugChance: 0.25,
feature: 'api'
}, {
type: 'API',
promptText: "RESTful but also GraphQL-ish",
codeLines: 40,
vibePoints: 4,
contextImpact: 15,
bugChance: 0.3,
feature: 'api'
},
// Security cards
{
type: 'Security',
promptText: "Make it unhackable please",
codeLines: 25,
vibePoints: 3,
contextImpact: 10,
bugChance: 0.2,
feature: 'security'
}, {
type: 'Security',
promptText: "Do that OAuth thing everyone uses",
codeLines: 30,
vibePoints: 3,
contextImpact: 12,
bugChance: 0.25,
feature: 'security'
},
// Special cards
{
type: 'refactor',
promptText: "Clean up that spaghetti code, please",
codeLines: 5,
vibePoints: 2,
contextImpact: -20,
bugChance: 0.1
}, {
type: 'coffee',
promptText: "Need caffeine to think straight",
codeLines: 0,
vibePoints: 3,
contextImpact: 0,
bugChance: 0
}, {
type: 'debug',
promptText: "Find and squash all those little bugs",
codeLines: -10,
vibePoints: 3,
contextImpact: -5,
bugChance: -0.5
}];
// Current hand and deck of cards
var currentHand = [];
var cardDeck = [];
var discardPile = [];
var bugContainer;
// UI Elements
var statsText;
var contextBar;
var progressBar;
var dayIndicator;
var endDayButton;
var deckVisual;
// Initialize the game
function initializeGame() {
gameState = {
day: 1,
codeLines: 0,
vibePoints: 5,
contextCollapse: 0,
bugs: 0,
phase: 'playing',
canPlayCard: true,
features: {
ui: false,
database: false,
api: false,
security: false
}
};
// Clear existing elements
while (game.children.length > 0) {
game.removeChild(game.children[0]);
}
// Reset card collections
currentHand = [];
cardDeck = [];
discardPile = [];
// Create background
var background = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2
});
game.addChild(background);
// Create UI elements
createUI();
// Create bug container
bugContainer = new Container();
bugContainer.x = 2048 / 2;
bugContainer.y = 500;
game.addChild(bugContainer);
// Initialize deck
initializeDeck();
// Draw initial hand
drawHand();
// Update stats display
updateStatsDisplay();
// Play background music
LK.playMusic('gameMusic');
}
function createUI() {
// Stats display
statsText = new Text2("Code Lines: 0 / " + TARGET_CODE_LINES + "\nVibe Points: 5\nBugs: 0/" + MAX_BUGS, {
size: 40,
fill: 0xFFFFFF
});
statsText.anchor.set(0, 0);
statsText.x = 150;
statsText.y = 150;
game.addChild(statsText);
// Project title
var projectTitle = new Text2("PROJECT: VIBE CODER", {
size: 60,
fill: 0xFFFFFF
});
projectTitle.anchor.set(0.5, 0);
projectTitle.x = 2048 / 2;
projectTitle.y = 50;
game.addChild(projectTitle);
// Context collapse bar background
var contextBarBg = LK.getAsset('progressBarBg', {
anchorX: 0,
anchorY: 0.5,
x: 224,
y: 300
});
game.addChild(contextBarBg);
// Context collapse bar
contextBar = LK.getAsset('progressBar', {
anchorX: 0,
anchorY: 0.5,
x: 224,
y: 300,
width: 0
});
game.addChild(contextBar);
// Context bar label
var contextLabel = new Text2("Context Collapse:", {
size: 30,
fill: 0xFFFFFF
});
contextLabel.anchor.set(0, 0.5);
contextLabel.x = 150;
contextLabel.y = 300;
game.addChild(contextLabel);
// Progress bar background
var progressBarBg = LK.getAsset('progressBarBg', {
anchorX: 0,
anchorY: 0.5,
x: 224,
y: 380
});
game.addChild(progressBarBg);
// Progress bar
progressBar = LK.getAsset('progressBar', {
anchorX: 0,
anchorY: 0.5,
x: 224,
y: 380,
width: 0
});
game.addChild(progressBar);
// Progress bar label
var progressLabel = new Text2("Project Progress:", {
size: 30,
fill: 0xFFFFFF
});
progressLabel.anchor.set(0, 0.5);
progressLabel.x = 150;
progressLabel.y = 380;
game.addChild(progressLabel);
// Day indicator
dayIndicator = new DayIndicator();
dayIndicator.x = 1848;
dayIndicator.y = 200;
game.addChild(dayIndicator);
// End day button
endDayButton = new MenuButton("END DAY", endDay);
endDayButton.x = 1848;
endDayButton.y = 400;
game.addChild(endDayButton);
// Project area separator
var separator = new Text2("───────────────────────────────────────────────", {
size: 40,
fill: 0xFFFFFF
});
separator.anchor.set(0.5, 0.5);
separator.x = 2048 / 2;
separator.y = projectAreaY;
game.addChild(separator);
// Project area label
var projectAreaLabel = new Text2("PROJECT AREA", {
size: 30,
fill: 0xFFFFFF
});
projectAreaLabel.anchor.set(0.5, 0);
projectAreaLabel.x = 2048 / 2;
projectAreaLabel.y = projectAreaY - 80;
game.addChild(projectAreaLabel);
// Features checklist
var featuresText = new Text2("Required Features:\n□ UI Framework\n□ Database\n□ API Integration\n□ Security", {
size: 30,
fill: 0xFFFFFF
});
featuresText.anchor.set(0, 0);
featuresText.x = 1600;
featuresText.y = 150;
game.addChild(featuresText);
// Deck visual
deckVisual = LK.getAsset('deck', {
anchorX: 0.5,
anchorY: 0.5,
x: deckX,
y: deckY
});
game.addChild(deckVisual);
// Deck label
var deckLabel = new Text2("DECK", {
size: 30,
fill: 0xFFFFFF
});
deckLabel.anchor.set(0.5, 0);
deckLabel.x = deckX;
deckLabel.y = deckY + 270;
game.addChild(deckLabel);
// Hand area label
var handLabel = new Text2("YOUR HAND", {
size: 30,
fill: 0xFFFFFF
});
handLabel.anchor.set(0.5, 0);
handLabel.x = 2048 / 2;
handLabel.y = handY - 280;
game.addChild(handLabel);
}
function initializeDeck() {
// Create a copy of all card templates
cardDeck = [];
// Add multiple copies of each card template to the deck
cardTemplates.forEach(function (template) {
// Add more basic cards
var count = template.type === 'basic' ? 3 : template.type === 'refactor' || template.type === 'coffee' || template.type === 'debug' ? 1 : 2;
for (var i = 0; i < count; i++) {
cardDeck.push(Object.assign({}, template));
}
});
// Shuffle the deck
shuffleDeck(cardDeck);
}
function shuffleDeck(deck) {
for (var i = deck.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var _ref = [deck[j], deck[i]];
deck[i] = _ref[0];
deck[j] = _ref[1];
}
}
function drawHand() {
// Clear current hand from display
currentHand.forEach(function (card) {
if (card.parent) {
card.parent.removeChild(card);
}
});
// Check if we need to reshuffle the discard pile
if (cardDeck.length < HAND_SIZE && discardPile.length > 0) {
// Add discard pile back to deck and shuffle
cardDeck = cardDeck.concat(discardPile);
discardPile = [];
shuffleDeck(cardDeck);
// Animate the deck
tween(deckVisual, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 300,
onFinish: function onFinish() {
tween(deckVisual, {
scaleX: 1,
scaleY: 1
}, {
duration: 300
});
}
});
}
// Draw up to hand size
while (currentHand.length < HAND_SIZE && cardDeck.length > 0) {
var cardTemplate = cardDeck.pop();
var card = new Card(cardTemplate.type, cardTemplate.promptText, cardTemplate.codeLines, cardTemplate.vibePoints, cardTemplate.contextImpact, cardTemplate.bugChance);
// Add feature property if it exists
if (cardTemplate.feature) {
card.feature = cardTemplate.feature;
}
currentHand.push(card);
game.addChild(card);
}
// Position cards in hand
positionCardsInHand();
}
function positionCardsInHand() {
var cardWidth = 400;
var spacing = 50;
var totalWidth = currentHand.length * cardWidth + (currentHand.length - 1) * spacing;
var startX = (2048 - totalWidth) / 2 + cardWidth / 2;
currentHand.forEach(function (card, index) {
card.x = startX + index * (cardWidth + spacing);
card.y = handY;
card.originalX = card.x;
card.originalY = card.y;
card.isDragging = false;
});
}
function playCard(card) {
// Deduct vibe points cost
gameState.vibePoints -= card.vibePoints;
// Update code lines
gameState.codeLines += card.codeLines;
// Update context collapse
gameState.contextCollapse += card.contextImpact;
if (gameState.contextCollapse < 0) {
gameState.contextCollapse = 0;
}
if (gameState.contextCollapse > MAX_CONTEXT_COLLAPSE) {
gameState.contextCollapse = MAX_CONTEXT_COLLAPSE;
}
// Add feature if card has one
if (card.feature) {
gameState.features[card.feature] = true;
}
// Play card sound
LK.getSound('cardPlace').play();
// Remove card from hand
var index = currentHand.indexOf(card);
if (index > -1) {
currentHand.splice(index, 1);
// Add to discard pile
discardPile.push({
type: card.type,
promptText: card.promptText,
codeLines: card.codeLines,
vibePoints: card.vibePoints,
contextImpact: card.contextImpact,
bugChance: card.bugChance,
feature: card.feature
});
}
// Animate card to center then remove
tween(card, {
x: 2048 / 2,
y: projectAreaY - 150,
alpha: 0
}, {
duration: 500,
onFinish: function onFinish() {
game.removeChild(card);
card.destroy();
// Check for bugs
checkForBugs(card.bugChance);
// Update stats
updateStatsDisplay();
// Reposition remaining cards
positionCardsInHand();
// Draw a new card
drawHand();
// Check win/loss conditions
checkGameState();
}
});
}
function checkForBugs(bugChance) {
// Adjust bug chance based on context collapse
var adjustedBugChance = bugChance + gameState.contextCollapse / MAX_CONTEXT_COLLAPSE * 0.3;
// Special case for debug card
if (bugChance < 0) {
// Reduce bugs by a fixed amount
var bugsToRemove = Math.min(gameState.bugs, Math.abs(Math.floor(bugChance * 10)));
for (var i = 0; i < bugsToRemove; i++) {
if (bugContainer.children.length > 0) {
var bug = bugContainer.children[bugContainer.children.length - 1];
bugContainer.removeChild(bug);
bug.destroy();
}
}
gameState.bugs -= bugsToRemove;
return;
}
// Roll for bug
if (Math.random() < adjustedBugChance && gameState.bugs < MAX_BUGS) {
// Create a new bug
var bug = new Bug();
// Position randomly in the project area
bug.x = Math.random() * 1600 - 800; // -800 to 800
bug.y = Math.random() * 400 - 200; // -200 to 200
bugContainer.addChild(bug);
gameState.bugs++;
// Play bug sound
LK.getSound('bugAppear').play();
// Animate bug appearance
bug.scale.set(0);
tween(bug, {
scaleX: 1,
scaleY: 1
}, {
duration: 300
});
}
}
function updateStatsDisplay() {
// Update stats text
statsText.setText("Code Lines: " + gameState.codeLines + " / " + TARGET_CODE_LINES + "\nVibe Points: " + gameState.vibePoints + "\nBugs: " + gameState.bugs + "/" + MAX_BUGS);
// Update context bar
var contextWidth = gameState.contextCollapse / MAX_CONTEXT_COLLAPSE * 1600;
tween(contextBar, {
width: contextWidth
}, {
duration: 300
});
// Update progress bar
var progressWidth = Math.min(gameState.codeLines / TARGET_CODE_LINES, 1) * 1600;
tween(progressBar, {
width: progressWidth
}, {
duration: 300
});
// Update features checklist text
var featuresStatus = "Required Features:\n" + (gameState.features.ui ? "☑" : "□") + " UI Framework\n" + (gameState.features.database ? "☑" : "□") + " Database\n" + (gameState.features.api ? "☑" : "□") + " API Integration\n" + (gameState.features.security ? "☑" : "□") + " Security";
// Find and update features text
game.children.forEach(function (child) {
if (child instanceof Text2 && child.getText && typeof child.getText === 'function') {
var text = child.getText();
if (text && text.includes("Required Features")) {
child.setText(featuresStatus);
}
}
});
}
function checkGameState() {
// Check for game over conditions
if (gameState.bugs >= MAX_BUGS) {
showGameOver("Too many bugs! Your project crashed!");
return;
}
if (gameState.contextCollapse >= MAX_CONTEXT_COLLAPSE) {
showGameOver("Context collapse! Your AI forgot what it was doing!");
return;
}
// Check if player can play any more cards
var canPlayAnyCard = false;
currentHand.forEach(function (card) {
if (card.vibePoints <= gameState.vibePoints) {
canPlayAnyCard = true;
}
});
gameState.canPlayCard = canPlayAnyCard;
// Check if player needs to end their day
if (!canPlayAnyCard && cardDeck.length === 0 && discardPile.length === 0) {
endDay();
}
}
function endDay() {
if (gameState.day >= MAX_DAYS) {
// Final evaluation
evaluateProject();
} else {
// Advance to next day
gameState.day++;
dayIndicator.updateDay(gameState.day);
// Play day change sound
LK.getSound('dayChange').play();
// Discard current hand
currentHand.forEach(function (card) {
discardPile.push({
type: card.type,
promptText: card.promptText,
codeLines: card.codeLines,
vibePoints: card.vibePoints,
contextImpact: card.contextImpact,
bugChance: card.bugChance,
feature: card.feature
});
game.removeChild(card);
card.destroy();
});
currentHand = [];
// Replenish vibe points
gameState.vibePoints = 5;
// Reduce context collapse slightly
gameState.contextCollapse = Math.max(0, gameState.contextCollapse - 10);
// Draw new hand
drawHand();
// Update stats
updateStatsDisplay();
}
}
function evaluateProject() {
var featureCount = (gameState.features.ui ? 1 : 0) + (gameState.features.database ? 1 : 0) + (gameState.features.api ? 1 : 0) + (gameState.features.security ? 1 : 0);
var codeProgress = gameState.codeLines / TARGET_CODE_LINES;
// Calculate score (out of 100)
var score = codeProgress * 50 + featureCount * 10 + Math.max(0, 10 - gameState.bugs) * 2;
score = Math.round(score);
// Set the final score
LK.setScore(score);
if (score >= 80) {
showYouWin("Project Success! Score: " + score + "/100");
} else if (score >= 50) {
showGameOver("Project Submitted With Issues. Score: " + score + "/100");
} else {
showGameOver("Project Failed! Score: " + score + "/100");
}
}
function showYouWin(message) {
// Show win message
var messageText = new Text2(message, {
size: 60,
fill: 0xFFFFFF
});
messageText.anchor.set(0.5, 0.5);
messageText.x = 2048 / 2;
messageText.y = 2732 / 2 - 100;
game.addChild(messageText);
// Add some delay before showing game win
LK.setTimeout(function () {
LK.showYouWin();
}, 2000);
}
function showGameOver(message) {
// Show game over message
var messageText = new Text2(message, {
size: 60,
fill: 0xFFFFFF
});
messageText.anchor.set(0.5, 0.5);
messageText.x = 2048 / 2;
messageText.y = 2732 / 2 - 100;
game.addChild(messageText);
// Add some delay before showing game over
LK.setTimeout(function () {
LK.showGameOver();
}, 2000);
}
function showMainMenu() {
// Clear existing elements
while (game.children.length > 0) {
game.removeChild(game.children[0]);
}
// Create background
var background = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2
});
game.addChild(background);
// Title
var titleText = new Text2("VIBE CODER", {
size: 120,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 2048 / 2;
titleText.y = 600;
game.addChild(titleText);
// Subtitle
var subtitleText = new Text2("The AI Coding Simulator", {
size: 60,
fill: 0x4A86E8
});
subtitleText.anchor.set(0.5, 0.5);
subtitleText.x = 2048 / 2;
subtitleText.y = 700;
game.addChild(subtitleText);
// Description
var descText = new Text2("Build a project in 10 days using vague AI prompts.\nBalance code lines, vibe points, and technical debt.\nAvoid bugs and context collapse!", {
size: 40,
fill: 0xFFFFFF
});
descText.anchor.set(0.5, 0.5);
descText.x = 2048 / 2;
descText.y = 900;
game.addChild(descText);
// Start button
var startButton = new MenuButton("START GAME", initializeGame);
startButton.x = 2048 / 2;
startButton.y = 1200;
game.addChild(startButton);
// Play music
LK.playMusic('gameMusic', {
fade: {
start: 0,
end: 0.3,
duration: 1000
}
});
}
// Game drag state
var dragNode = null;
// Global move handler
function handleMove(x, y, obj) {
if (dragNode && dragNode.isDragging) {
dragNode.x = x - dragNode.dragOffsetX;
dragNode.y = y - dragNode.dragOffsetY;
}
}
// Game event handlers
game.move = handleMove;
game.down = function (x, y, obj) {
// This is handled by individual card objects
};
game.up = function (x, y, obj) {
// This is handled by individual card objects
};
// Initialize with main menu
showMainMenu(); ===================================================================
--- original.js
+++ change.js
@@ -90,8 +90,10 @@
if (!self.isDragging && gameState.phase === 'playing') {
self.isDragging = true;
self.dragOffsetX = x - self.x;
self.dragOffsetY = y - self.y;
+ // Set the global dragNode to this card
+ dragNode = self;
// Bring to front
if (self.parent) {
var parent = self.parent;
parent.removeChild(self);
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