User prompt
It’s a secret you tap the white and shows key board
User prompt
Please fix the bug: 'undefined is not an object (evaluating 'codeModalContainer.addChild')' in or related to this line: 'codeModalContainer.addChild(letterGuideText);' Line Number: 556
User prompt
Make a gui for the button code and it will have a text bar if you type LeBron it will give you 1 billion dollars
User prompt
Make code button bigger
User prompt
Make a button that says code and if you type bro it will make you go to level 99
User prompt
Show what level rod you have
User prompt
fx buttons
User prompt
make a invatory gui that showsthe fish
User prompt
and when you get to level 100 it resets
User prompt
make 100 levels
User prompt
when you upgrade make the fishing rod chang color and make it were you get more money ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
show how musch money you have
User prompt
Please fix the bug: 'Timeout.tick error: Invalid value. Only literals or 1-level deep objects/arrays containing literals are allowed.' in or related to this line: 'storage.inventory = inventory;' Line Number: 238 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Tap Fisher Tycoon
Initial prompt
Make a game where you tap and you fish for fish and then you sell to upgrade your fishing rod to get better fish.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Fish = Container.expand(function (fishType) {
var self = Container.call(this);
var fishTypes = {
'common': {
asset: 'commonFish',
value: 5,
name: 'Sardine'
},
'uncommon': {
asset: 'uncommonFish',
value: 15,
name: 'Bass'
},
'rare': {
asset: 'rareFish',
value: 50,
name: 'Tuna'
},
'legendary': {
asset: 'legendaryFish',
value: 200,
name: 'Golden Fish'
}
};
self.fishData = fishTypes[fishType] || fishTypes['common'];
self.fishType = fishType || 'common';
var fishGraphics = self.attachAsset(self.fishData.asset, {
anchorX: 0.5,
anchorY: 0.5
});
self.getValue = function () {
return self.fishData.value;
};
self.getName = function () {
return self.fishData.name;
};
return self;
});
var FishingRod = Container.expand(function () {
var self = Container.call(this);
var rodGraphics = self.attachAsset('fishingRod', {
anchorX: 0.5,
anchorY: 0
});
var lineGraphics = self.attachAsset('fishingLine', {
anchorX: 0.5,
anchorY: 0
});
lineGraphics.y = 300;
lineGraphics.visible = false;
var hookGraphics = self.attachAsset('hook', {
anchorX: 0.5,
anchorY: 0
});
hookGraphics.y = 700;
hookGraphics.visible = false;
self.isCasting = false;
self.castProgress = 0;
self.cast = function () {
if (self.isCasting) return;
self.isCasting = true;
self.castProgress = 0;
lineGraphics.visible = true;
hookGraphics.visible = true;
tween(self, {
castProgress: 1
}, {
duration: 1000,
easing: tween.easeOut,
onFinish: function onFinish() {
self.pullUp();
}
});
};
self.pullUp = function () {
tween(self, {
castProgress: 0
}, {
duration: 800,
easing: tween.easeIn,
onFinish: function onFinish() {
lineGraphics.visible = false;
hookGraphics.visible = false;
self.isCasting = false;
}
});
};
self.update = function () {
if (self.isCasting) {
lineGraphics.height = 400 + self.castProgress * 300;
hookGraphics.y = 700 + self.castProgress * 300;
}
};
return self;
});
var UpgradeButton = Container.expand(function (upgradeType, cost, description) {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5
});
var buttonText = new Text2(description + '\n$' + cost, {
size: 32,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.upgradeType = upgradeType;
self.cost = cost;
self.description = description;
self.updateText = function (newCost) {
self.cost = newCost;
buttonText.setText(self.description + '\n$' + newCost);
};
self.down = function (x, y, obj) {
if (coins >= self.cost) {
coins -= self.cost;
LK.getSound('upgrade').play();
if (self.upgradeType === 'rod') {
rodLevel++;
self.updateText(Math.floor(self.cost * 1.5));
}
updateUI();
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Game state variables
var coins = storage.coins || 0;
var rodLevel = storage.rodLevel || 1;
// Reconstruct inventory from flattened storage
var inventory = [];
var storedTypes = storage.inventoryTypes || [];
var storedValues = storage.inventoryValues || [];
var storedNames = storage.inventoryNames || [];
for (var i = 0; i < storedTypes.length; i++) {
inventory.push({
type: storedTypes[i],
value: storedValues[i],
name: storedNames[i]
});
}
var totalFishCaught = storage.totalFishCaught || 0;
// Create water background
var water = game.attachAsset('water', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
});
// Create fishing rod
var fishingRod = game.addChild(new FishingRod());
fishingRod.x = 1024;
fishingRod.y = 200;
// Create UI elements
var coinsText = new Text2('Coins: $' + coins, {
size: 48,
fill: 0xFFFFFF
});
coinsText.anchor.set(0, 0);
coinsText.x = 120; // Position away from top-left menu icon
LK.gui.topLeft.addChild(coinsText);
var rodLevelText = new Text2('Rod Level: ' + rodLevel, {
size: 36,
fill: 0xFFFFFF
});
rodLevelText.anchor.set(0, 0);
LK.gui.topRight.addChild(rodLevelText);
rodLevelText.y = 60;
var inventoryText = new Text2('Fish Caught: ' + inventory.length, {
size: 36,
fill: 0xFFFFFF
});
inventoryText.anchor.set(0, 0);
LK.gui.topRight.addChild(inventoryText);
inventoryText.y = 110;
// Create upgrade button
var rodUpgrade = game.addChild(new UpgradeButton('rod', 100, 'Upgrade Rod'));
rodUpgrade.x = 1024;
rodUpgrade.y = 2500;
// Create sell button
var sellButtonGraphics = game.attachAsset('sellButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 300,
y: 2500
});
var sellButtonText = new Text2('Sell All Fish', {
size: 32,
fill: 0xFFFFFF
});
sellButtonText.anchor.set(0.5, 0.5);
sellButtonGraphics.addChild(sellButtonText);
// Fish spawn area
var fishSpawnArea = {
x: 400,
y: 1400,
width: 1200,
height: 800
};
// Arrays to track game objects
var caughtFish = [];
var fishingTimer = 0;
function updateUI() {
coinsText.setText('Coins: $' + coins);
rodLevelText.setText('Rod Level: ' + rodLevel);
inventoryText.setText('Fish Caught: ' + inventory.length);
// Save to storage - flatten inventory for storage compatibility
storage.coins = coins;
storage.rodLevel = rodLevel;
// Store inventory as separate arrays
var inventoryTypes = [];
var inventoryValues = [];
var inventoryNames = [];
for (var i = 0; i < inventory.length; i++) {
inventoryTypes.push(inventory[i].type);
inventoryValues.push(inventory[i].value);
inventoryNames.push(inventory[i].name);
}
storage.inventoryTypes = inventoryTypes;
storage.inventoryValues = inventoryValues;
storage.inventoryNames = inventoryNames;
storage.totalFishCaught = totalFishCaught;
}
function getFishTypeByRodLevel() {
var random = Math.random();
if (rodLevel >= 4 && random < 0.05) return 'legendary';
if (rodLevel >= 3 && random < 0.15) return 'rare';
if (rodLevel >= 2 && random < 0.3) return 'uncommon';
return 'common';
}
function spawnFish() {
var fishType = getFishTypeByRodLevel();
var fish = new Fish(fishType);
fish.x = fishSpawnArea.x + Math.random() * fishSpawnArea.width;
fish.y = fishSpawnArea.y + Math.random() * fishSpawnArea.height;
game.addChild(fish);
caughtFish.push(fish);
inventory.push({
type: fishType,
value: fish.getValue(),
name: fish.getName()
});
totalFishCaught++;
// Animate fish jump
var originalY = fish.y;
tween(fish, {
y: originalY - 100
}, {
duration: 500,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(fish, {
y: originalY
}, {
duration: 500,
easing: tween.easeIn,
onFinish: function onFinish() {
tween(fish, {
alpha: 0
}, {
duration: 1000,
onFinish: function onFinish() {
fish.destroy();
var index = caughtFish.indexOf(fish);
if (index > -1) {
caughtFish.splice(index, 1);
}
}
});
}
});
}
});
LK.getSound('catch').play();
updateUI();
}
// Game tap handler
game.down = function (x, y, obj) {
if (!fishingRod.isCasting) {
fishingRod.cast();
LK.getSound('splash').play();
// Chance to catch fish based on rod level
var catchChance = 0.3 + rodLevel * 0.1;
if (Math.random() < catchChance) {
LK.setTimeout(function () {
spawnFish();
}, 1200);
}
}
};
// Sell button handler
sellButtonGraphics.down = function (x, y, obj) {
if (inventory.length > 0) {
var totalValue = 0;
for (var i = 0; i < inventory.length; i++) {
totalValue += inventory[i].value;
}
coins += totalValue;
inventory = [];
// Clear visible fish
for (var j = 0; j < caughtFish.length; j++) {
if (caughtFish[j] && caughtFish[j].destroy) {
caughtFish[j].destroy();
}
}
caughtFish = [];
updateUI();
LK.effects.flashScreen(0x00FF00, 500);
}
};
// Auto-save every 5 seconds
var autoSaveTimer = LK.setInterval(function () {
storage.coins = coins;
storage.rodLevel = rodLevel;
// Store inventory as separate arrays
var inventoryTypes = [];
var inventoryValues = [];
var inventoryNames = [];
for (var i = 0; i < inventory.length; i++) {
inventoryTypes.push(inventory[i].type);
inventoryValues.push(inventory[i].value);
inventoryNames.push(inventory[i].name);
}
storage.inventoryTypes = inventoryTypes;
storage.inventoryValues = inventoryValues;
storage.inventoryNames = inventoryNames;
storage.totalFishCaught = totalFishCaught;
}, 5000);
game.update = function () {
// Update fishing rod animation
if (fishingRod && fishingRod.update) {
fishingRod.update();
}
// Update upgrade button cost display
if (rodUpgrade && rodUpgrade.cost !== 100 * Math.pow(1.5, rodLevel - 1)) {
var newCost = Math.floor(100 * Math.pow(1.5, rodLevel - 1));
rodUpgrade.updateText(newCost);
}
}; ===================================================================
--- original.js
+++ change.js
@@ -177,9 +177,10 @@
size: 48,
fill: 0xFFFFFF
});
coinsText.anchor.set(0, 0);
-LK.gui.topRight.addChild(coinsText);
+coinsText.x = 120; // Position away from top-left menu icon
+LK.gui.topLeft.addChild(coinsText);
var rodLevelText = new Text2('Rod Level: ' + rodLevel, {
size: 36,
fill: 0xFFFFFF
});