User prompt
Make the player get 1000 crystals if their house looks very good
User prompt
make the buttons bigger
User prompt
change the text from build your dream home to build blueberry a home
User prompt
change change the text from budget to crystals
User prompt
when the make the text disappear when the cube was bought
User prompt
the buttons are not clickable and they don't do anything
User prompt
the buttons are really hard to click and they're very tiny
Code edit (1 edits merged)
Please save this source code
User prompt
Dream House Builder
Initial prompt
make a house building simulator
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var GridCell = Container.expand(function (gridX, gridY) { var self = Container.call(this); self.gridX = gridX; self.gridY = gridY; self.occupied = false; self.room = null; var cellGraphics = self.attachAsset('foundation', { anchorX: 0.5, anchorY: 0.5 }); cellGraphics.alpha = 0.3; self.highlight = function () { cellGraphics.alpha = 0.8; cellGraphics.tint = 0x00FF00; }; self.unhighlight = function () { cellGraphics.alpha = 0.3; cellGraphics.tint = 0xFFFFFF; }; self.setOccupied = function (room) { self.occupied = true; self.room = room; cellGraphics.alpha = 0.1; }; return self; }); var Room = Container.expand(function (roomType) { var self = Container.call(this); self.roomType = roomType; self.isPlaced = false; self.gridX = -1; self.gridY = -1; var colors = { bedroom: 0x87CEEB, kitchen: 0xFFB347, bathroom: 0x98FB98, livingroom: 0xDDA0DD }; var costs = { bedroom: 150, kitchen: 200, bathroom: 120, livingroom: 180 }; self.cost = costs[roomType]; var roomGraphics = self.attachAsset(roomType, { anchorX: 0.5, anchorY: 0.5 }); var roomText = new Text2(roomType.toUpperCase(), { size: 28, fill: 0x000000 }); roomText.anchor.set(0.5, 0.5); self.addChild(roomText); var costText = new Text2(self.cost + ' crystals', { size: 24, fill: 0x000000 }); costText.anchor.set(0.5, 0.5); costText.y = 35; self.addChild(costText); self.highlight = function () { roomGraphics.alpha = 0.8; tween(roomGraphics, { scaleX: 1.1, scaleY: 1.1 }, { duration: 200 }); }; self.unhighlight = function () { roomGraphics.alpha = 1.0; tween(roomGraphics, { scaleX: 1.0, scaleY: 1.0 }, { duration: 200 }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x228B22 }); /**** * Game Code ****/ // Game constants var GRID_SIZE = 180; var GRID_ROWS = 6; var GRID_COLS = 8; var GRID_START_X = 450; var GRID_START_Y = 400; var SIDEBAR_WIDTH = 400; // Game variables var budget = 1000; var score = 0; var draggedRoom = null; var grid = []; var sidebarRooms = []; var placedRooms = []; var objectives = []; var completedObjectives = []; // UI elements var budgetText = new Text2('Crystals: ' + budget, { size: 80, fill: 0xFFFFFF }); budgetText.anchor.set(0, 0); budgetText.x = 120; budgetText.y = 50; LK.gui.topLeft.addChild(budgetText); var scoreText = new Text2('Score: ' + score, { size: 80, fill: 0xFFFFFF }); scoreText.anchor.set(1, 0); LK.gui.topRight.addChild(scoreText); var objectiveText = new Text2('Build blueberry a home!', { size: 60, fill: 0xFFFFFF }); objectiveText.anchor.set(0.5, 0); LK.gui.top.addChild(objectiveText); // Create sidebar var sidebar = game.attachAsset('sidebar', { anchorX: 0, anchorY: 0, x: 0, y: 0 }); var sidebarTitle = new Text2('ROOMS', { size: 60, fill: 0xFFFFFF }); sidebarTitle.anchor.set(0.5, 0); sidebarTitle.x = SIDEBAR_WIDTH / 2; sidebarTitle.y = 100; game.addChild(sidebarTitle); // Create room types in sidebar var roomTypes = ['bedroom', 'kitchen', 'bathroom', 'livingroom']; for (var i = 0; i < roomTypes.length; i++) { var room = new Room(roomTypes[i]); room.x = SIDEBAR_WIDTH / 2; room.y = 250 + i * 180; sidebarRooms.push(room); game.addChild(room); } // Create grid for (var row = 0; row < GRID_ROWS; row++) { grid[row] = []; for (var col = 0; col < GRID_COLS; col++) { var cell = new GridCell(col, row); cell.x = GRID_START_X + col * GRID_SIZE; cell.y = GRID_START_Y + row * GRID_SIZE; grid[row][col] = cell; game.addChild(cell); } } // Initialize objectives objectives = [{ text: 'Place a bedroom', type: 'place', roomType: 'bedroom', completed: false, points: 50 }, { text: 'Place a kitchen', type: 'place', roomType: 'kitchen', completed: false, points: 50 }, { text: 'Place a bathroom', type: 'place', roomType: 'bathroom', completed: false, points: 50 }, { text: 'Connect bathroom to bedroom', type: 'adjacent', room1: 'bathroom', room2: 'bedroom', completed: false, points: 100 }]; function updateBudgetDisplay() { budgetText.setText('Crystals: ' + budget); } function updateScoreDisplay() { scoreText.setText('Score: ' + score); } function updateObjectiveDisplay() { var incomplete = objectives.filter(function (obj) { return !obj.completed; }); if (incomplete.length > 0) { objectiveText.setText(incomplete[0].text); } else { objectiveText.setText('All objectives complete!'); } } function getGridPosition(x, y) { var col = Math.floor((x - GRID_START_X + GRID_SIZE / 2) / GRID_SIZE); var row = Math.floor((y - GRID_START_Y + GRID_SIZE / 2) / GRID_SIZE); if (col >= 0 && col < GRID_COLS && row >= 0 && row < GRID_ROWS) { return { col: col, row: row }; } return null; } function isValidPlacement(gridPos) { if (!gridPos) return false; return !grid[gridPos.row][gridPos.col].occupied; } function placeRoom(room, gridPos) { if (!isValidPlacement(gridPos) || budget < room.cost) { LK.getSound('error').play(); return false; } budget -= room.cost; score += 25; var cell = grid[gridPos.row][gridPos.col]; cell.setOccupied(room); room.x = cell.x; room.y = cell.y; room.isPlaced = true; room.gridX = gridPos.col; room.gridY = gridPos.row; placedRooms.push(room); // Hide text when room is placed for (var child = 0; child < room.children.length; child++) { if (room.children[child] instanceof Text2) { room.children[child].visible = false; } } // Create new room in sidebar var newRoom = new Room(room.roomType); newRoom.x = SIDEBAR_WIDTH / 2; newRoom.y = room.y; sidebarRooms.push(newRoom); game.addChild(newRoom); updateBudgetDisplay(); updateScoreDisplay(); checkObjectives(); LK.getSound('place').play(); if (budget <= 0) { LK.setTimeout(function () { LK.showGameOver(); }, 1000); } return true; } function checkObjectives() { for (var i = 0; i < objectives.length; i++) { var obj = objectives[i]; if (obj.completed) continue; if (obj.type === 'place') { var hasRoom = placedRooms.some(function (room) { return room.roomType === obj.roomType; }); if (hasRoom) { obj.completed = true; score += obj.points; updateScoreDisplay(); } } else if (obj.type === 'adjacent') { var room1 = placedRooms.find(function (room) { return room.roomType === obj.room1; }); var room2 = placedRooms.find(function (room) { return room.roomType === obj.room2; }); if (room1 && room2) { var dx = Math.abs(room1.gridX - room2.gridX); var dy = Math.abs(room1.gridY - room2.gridY); if (dx === 1 && dy === 0 || dx === 0 && dy === 1) { obj.completed = true; score += obj.points; updateScoreDisplay(); } } } } updateObjectiveDisplay(); // Check win condition var allComplete = objectives.every(function (obj) { return obj.completed; }); if (allComplete && score >= 400) { LK.setTimeout(function () { LK.showYouWin(); }, 1000); } } function handleMove(x, y, obj) { if (draggedRoom) { draggedRoom.x = x; draggedRoom.y = y; // Highlight valid drop zones var gridPos = getGridPosition(x, y); for (var row = 0; row < GRID_ROWS; row++) { for (var col = 0; col < GRID_COLS; col++) { grid[row][col].unhighlight(); } } if (gridPos && isValidPlacement(gridPos) && budget >= draggedRoom.cost) { grid[gridPos.row][gridPos.col].highlight(); } } } game.move = handleMove; game.down = function (x, y, obj) { // Check if clicking on a room in sidebar for (var i = 0; i < sidebarRooms.length; i++) { var room = sidebarRooms[i]; // Check if click position is within room bounds var roomLeft = room.x - 75; // room width/2 = 150/2 = 75 var roomRight = room.x + 75; var roomTop = room.y - 75; // room height/2 = 150/2 = 75 var roomBottom = room.y + 75; if (x >= roomLeft && x <= roomRight && y >= roomTop && y <= roomBottom) { if (budget >= room.cost) { draggedRoom = room; room.highlight(); // Remove from sidebar array but keep in game for dragging sidebarRooms.splice(i, 1); break; } } } }; game.up = function (x, y, obj) { if (draggedRoom) { var gridPos = getGridPosition(x, y); if (gridPos && placeRoom(draggedRoom, gridPos)) { // Successfully placed } else { // Return to sidebar draggedRoom.x = SIDEBAR_WIDTH / 2; draggedRoom.y = 250 + roomTypes.indexOf(draggedRoom.roomType) * 180; sidebarRooms.push(draggedRoom); } draggedRoom.unhighlight(); // Clear all highlights for (var row = 0; row < GRID_ROWS; row++) { for (var col = 0; col < GRID_COLS; col++) { grid[row][col].unhighlight(); } } draggedRoom = null; } }; game.update = function () { // Update LK score for leaderboard LK.setScore(score); };
===================================================================
--- original.js
+++ change.js
@@ -129,9 +129,9 @@
fill: 0xFFFFFF
});
scoreText.anchor.set(1, 0);
LK.gui.topRight.addChild(scoreText);
-var objectiveText = new Text2('Build your dream house!', {
+var objectiveText = new Text2('Build blueberry a home!', {
size: 60,
fill: 0xFFFFFF
});
objectiveText.anchor.set(0.5, 0);