User prompt
Long titled buttons are overlapping
User prompt
Make the spaces between each button even smaller and make sure sandbox unlocks every designs, system. Also consider adding a arrow that collapses it ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Add boat designs and consider resizing various words on the buttons because it goes past the button
User prompt
make sure article goes in front of the buttons and the higher the lifespan number the faster the days go down so players dont need to wait to see it go to zero. Also buttons are going past boundaries squeeze it a bot
User prompt
Add even more materials like alloys, graphene, heavy motor, and more like safety systems and a whole new class players could add crew type now. Make sure none of the materials or designs or safety or crew needs boats launched, only lifespan, also add a sandbox button to unlock everything ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
When players do various combos or reach a high amount of lifespan on a ship to unlock materials, propulsions, safety systems, and designs. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Add propulsion and safety systems as selectable options to boost ship lifespan even more
User prompt
Let players also have the option to add propulsion and safety systems
User prompt
Pretend survival time is in months, years, and days.
User prompt
Timelapse how long it lasted, example randomizing lifespan based on accidents.
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'var localPos = self.toLocal(obj.parent.toGlobal(obj.position));' Line Number: 83
User prompt
Still does not work.
User prompt
fix article
User prompt
Doesnt work make a modular article system also make sure article color is brown.
User prompt
Things work, but result doesn’t, make it so that after the player makes the boat a news article appears and a red x can be used to exit the article
User prompt
The Ui keeps flashing from blue to black, set ui to black and white
User prompt
Please fix the bug: 'Timeout.tick error: null is not an object (evaluating 'materialData.name')' in or related to this line: 'newsPanel.showNews(materialData.name, designData.name, survivalTime, disaster);' Line Number: 363
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'var savedLaunches = storage.get('launches') || [];' Line Number: 343
User prompt
Completely revamp building system. Were players chose one material, one design, and then see it a news article about were it died, how long it lasted and a procedurally generated reason of accident and problems
Code edit (1 edits merged)
Please save this source code
User prompt
Faithless
Initial prompt
Make a game called Faithless, about making boats and seeing horrible accidents go on with them.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var DesignButton = Container.expand(function (designType, designName, x, y) { var self = Container.call(this); self.designType = designType; self.designName = designName; self.selected = false; var background = self.attachAsset('designButton', { anchorX: 0.5, anchorY: 0.5 }); var nameText = new Text2(designName, { size: 32, fill: 0xffffff }); nameText.anchor.set(0.5, 0.5); self.addChild(nameText); self.x = x; self.y = y; self.updateVisual = function () { if (self.selected) { background.tint = 0x00ff00; } else { background.tint = 0xffffff; } }; self.down = function (x, y, obj) { selectDesign(self.designType); }; return self; }); var MaterialButton = Container.expand(function (materialType, materialName, x, y) { var self = Container.call(this); self.materialType = materialType; self.materialName = materialName; self.selected = false; var background = self.attachAsset('materialButton', { anchorX: 0.5, anchorY: 0.5 }); var nameText = new Text2(materialName, { size: 32, fill: 0xffffff }); nameText.anchor.set(0.5, 0.5); self.addChild(nameText); self.x = x; self.y = y; self.updateVisual = function () { if (self.selected) { background.tint = 0x00ff00; } else { background.tint = 0xffffff; } }; self.down = function (x, y, obj) { selectMaterial(self.materialType); }; return self; }); var NewsPanel = Container.expand(function () { var self = Container.call(this); self.visible = false; var background = self.attachAsset('newsPanel', { anchorX: 0.5, anchorY: 0.5 }); background.tint = 0xf0f0f0; var titleText = new Text2('MARITIME DISASTER REPORT', { size: 60, fill: 0x000000 }); titleText.anchor.set(0.5, 0); titleText.y = -550; self.addChild(titleText); var contentText = new Text2('', { size: 40, fill: 0x000000 }); contentText.anchor.set(0.5, 0); contentText.y = -400; self.addChild(contentText); var closeButton = self.attachAsset('materialButton', { anchorX: 0.5, anchorY: 0.5, x: 800, y: -550, scaleX: 0.5, scaleY: 0.5 }); closeButton.tint = 0xff0000; var closeText = new Text2('X', { size: 60, fill: 0xffffff }); closeText.anchor.set(0.5, 0.5); closeText.x = 800; closeText.y = -550; self.addChild(closeText); self.showNews = function (material, design, survivalTime, disaster) { var content = 'VESSEL SPECIFICATIONS:\n'; content += 'Material: ' + material + '\n'; content += 'Design: ' + design + '\n\n'; content += 'SURVIVAL TIME: ' + Math.floor(survivalTime / 60) + ' seconds\n\n'; content += 'CAUSE OF DISASTER:\n' + disaster; contentText.setText(content); self.visible = true; LK.getSound('newspaper').play(); }; self.down = function (x, y, obj) { if (self.visible) { // Check if click is near the X button (top right area) var localPos = self.toLocal(obj.parent.toGlobal(obj.position)); if (localPos.x > 700 && localPos.x < 900 && localPos.y > -600 && localPos.y < -500) { self.visible = false; } } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Game state variables var selectedMaterial = null; var selectedDesign = null; var totalBoatsLaunched = 0; var materialButtons = []; var designButtons = []; var newsPanel = null; // Material data var materials = [{ type: 'wood', name: 'Wood', durability: 50, cost: 25 }, { type: 'steel', name: 'Steel', durability: 80, cost: 45 }, { type: 'plastic', name: 'Plastic', durability: 30, cost: 15 }, { type: 'aluminum', name: 'Aluminum', durability: 70, cost: 35 }]; // Design data var designs = [{ type: 'fishing', name: 'Fishing Boat', stability: 60, speed: 40 }, { type: 'yacht', name: 'Luxury Yacht', stability: 40, speed: 80 }, { type: 'cargo', name: 'Cargo Ship', stability: 80, speed: 20 }, { type: 'speedboat', name: 'Speed Boat', stability: 30, speed: 90 }]; // Disaster scenarios var disasters = ['Structural failure due to poor material choice', 'Capsized in rough waters due to design instability', 'Engine explosion caused by manufacturing defects', 'Hull breach from collision with debris', 'Overloading beyond design capacity', 'Fire spread rapidly through cheap materials', 'Steering system malfunction in storm', 'Crew error compounded by design flaws']; // Create UI var scoreText = new Text2('Boats Launched: 0', { size: 60, fill: 0xffffff }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); var instructionText = new Text2('Select material and design, then launch your vessel to its doom!', { size: 40, fill: 0xffffff }); instructionText.anchor.set(0.5, 0); instructionText.y = 80; LK.gui.top.addChild(instructionText); // Create material selection area var materialTitle = new Text2('SELECT MATERIAL:', { size: 50, fill: 0xffffff }); materialTitle.anchor.set(0.5, 0.5); materialTitle.x = 1024; materialTitle.y = 400; game.addChild(materialTitle); // Create material buttons for (var i = 0; i < materials.length; i++) { var materialButton = new MaterialButton(materials[i].type, materials[i].name, 400 + i * 320, 550); game.addChild(materialButton); materialButtons.push(materialButton); } // Create design selection area var designTitle = new Text2('SELECT DESIGN:', { size: 50, fill: 0xffffff }); designTitle.anchor.set(0.5, 0.5); designTitle.x = 1024; designTitle.y = 800; game.addChild(designTitle); // Create design buttons for (var i = 0; i < designs.length; i++) { var designButton = new DesignButton(designs[i].type, designs[i].name, 400 + i * 320, 950); game.addChild(designButton); designButtons.push(designButton); } // Create launch button var launchButton = game.addChild(LK.getAsset('launchButton', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1350 })); var launchText = new Text2('LAUNCH VESSEL', { size: 50, fill: 0xffffff }); launchText.anchor.set(0.5, 0.5); launchText.x = 1024; launchText.y = 1350; game.addChild(launchText); // Create news panel newsPanel = new NewsPanel(); newsPanel.x = 1024; newsPanel.y = 1366; game.addChild(newsPanel); function selectMaterial(materialType) { selectedMaterial = materialType; // Update button visuals for (var i = 0; i < materialButtons.length; i++) { materialButtons[i].selected = materialButtons[i].materialType === materialType; materialButtons[i].updateVisual(); } } function selectDesign(designType) { selectedDesign = designType; // Update button visuals for (var i = 0; i < designButtons.length; i++) { designButtons[i].selected = designButtons[i].designType === designType; designButtons[i].updateVisual(); } } function getMaterialData(materialType) { for (var i = 0; i < materials.length; i++) { if (materials[i].type === materialType) { return materials[i]; } } return null; } function getDesignData(designType) { for (var i = 0; i < designs.length; i++) { if (designs[i].type === designType) { return designs[i]; } } return null; } function calculateSurvivalTime(material, design) { var materialData = getMaterialData(material); var designData = getDesignData(design); if (!materialData || !designData) return 60; // Default 1 second // Base survival time with some randomness var baseTime = 180 + Math.random() * 600; // 3-13 seconds // Material affects durability baseTime *= materialData.durability / 50; // Design affects stability baseTime *= designData.stability / 50; // Add some chaos baseTime *= 0.5 + Math.random(); return Math.floor(baseTime); } function generateDisasterReport(material, design, survivalTime) { var materialData = getMaterialData(material); var designData = getDesignData(design); var randomDisaster = disasters[Math.floor(Math.random() * disasters.length)]; // Create more specific disaster based on choices var specificCause = ''; if (materialData.durability < 40) { specificCause = 'The cheap ' + materialData.name.toLowerCase() + ' construction proved inadequate for maritime conditions. '; } else if (designData.stability < 50) { specificCause = 'The ' + designData.name.toLowerCase() + ' design showed inherent stability issues. '; } return specificCause + randomDisaster + '. The vessel lasted ' + Math.floor(survivalTime / 60) + ' seconds before meeting its inevitable fate.'; } function launchVessel() { if (!selectedMaterial || !selectedDesign) { return; // Can't launch without both selections } totalBoatsLaunched++; scoreText.setText('Boats Launched: ' + totalBoatsLaunched); // Calculate how long this boat will survive var survivalTime = calculateSurvivalTime(selectedMaterial, selectedDesign); // Generate disaster report var disaster = generateDisasterReport(selectedMaterial, selectedDesign, survivalTime); // Show launch effect LK.getSound('launch').play(); LK.effects.flashScreen(0x0000ff, 500); // Store this launch for potential leaderboard var launchData = { material: selectedMaterial, design: selectedDesign, survivalTime: survivalTime, disaster: disaster, timestamp: Date.now() }; var savedLaunches = []; try { savedLaunches = storage.get('launches') || []; } catch (e) { console.log('Storage not available, using empty array'); savedLaunches = []; } savedLaunches.push(launchData); if (savedLaunches.length > 50) { savedLaunches = savedLaunches.slice(-50); // Keep only last 50 } try { storage.set('launches', savedLaunches); } catch (e) { console.log('Could not save to storage'); } // Get material and design data before resetting selections var materialData = getMaterialData(selectedMaterial); var designData = getDesignData(selectedDesign); // Show news report after a delay LK.setTimeout(function () { newsPanel.showNews(materialData.name, designData.name, survivalTime, disaster); }, 2000); // Reset selections selectedMaterial = null; selectedDesign = null; for (var i = 0; i < materialButtons.length; i++) { materialButtons[i].selected = false; materialButtons[i].updateVisual(); } for (var i = 0; i < designButtons.length; i++) { designButtons[i].selected = false; designButtons[i].updateVisual(); } // Check for achievement if (totalBoatsLaunched >= 10) { LK.showYouWin(); } } // Event handlers launchButton.down = function (x, y, obj) { launchVessel(); }; game.update = function () { // Background stays consistently black - no flashing };
===================================================================
--- original.js
+++ change.js
@@ -89,20 +89,21 @@
self.addChild(contentText);
var closeButton = self.attachAsset('materialButton', {
anchorX: 0.5,
anchorY: 0.5,
- x: 0,
- y: 500,
- scaleX: 0.8,
- scaleY: 0.8
+ x: 800,
+ y: -550,
+ scaleX: 0.5,
+ scaleY: 0.5
});
closeButton.tint = 0xff0000;
- var closeText = new Text2('CLOSE', {
- size: 40,
+ var closeText = new Text2('X', {
+ size: 60,
fill: 0xffffff
});
closeText.anchor.set(0.5, 0.5);
- closeText.y = 500;
+ closeText.x = 800;
+ closeText.y = -550;
self.addChild(closeText);
self.showNews = function (material, design, survivalTime, disaster) {
var content = 'VESSEL SPECIFICATIONS:\n';
content += 'Material: ' + material + '\n';
@@ -114,9 +115,13 @@
LK.getSound('newspaper').play();
};
self.down = function (x, y, obj) {
if (self.visible) {
- self.visible = false;
+ // Check if click is near the X button (top right area)
+ var localPos = self.toLocal(obj.parent.toGlobal(obj.position));
+ if (localPos.x > 700 && localPos.x < 900 && localPos.y > -600 && localPos.y < -500) {
+ self.visible = false;
+ }
}
};
return self;
});