User prompt
ekranın en aşağısında bir çanta olsun çantaya tuttuğumuz balıklar girsin çantaya bastığımızda ise karşımıza bir ekran çıksın ekranda tuttuğumuz balıklar ve yanındada fiyatları olsun ve birde kayığı sağdaki kulubenin tam yanına geldiğimizde kulubeye tıklarsak karşımıza bir ekran çıksın ekranın sol tarafında tuttuğumuz balıkları oraya satabileceğimiz bir yer sağda ise olta ve yem satın alabilelim tam 15 tane olta olsun oltalar seviyelerine göre pağalılaşsın ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
User prompt
karakterimizin altında bir kayık olsun tuttuğumuz balıklar bu kayığa girsin kayık sürülebilsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
ekrandaki mavi gölün sağ ve solunada basınca oltayı sağa ve solada atsın sadece ortaya değil gölün her yerine etkileşim olsun
User prompt
aim falan olmasın mause ile gölün neresine 3 kez basarsak oraya atsın kancayı
User prompt
gölün herhangi bir yerine 3 kez bastığımızda kancayı oraya atsın
User prompt
Please fix the bug: 'storage.getInt is not a function' in or related to this line: 'var playerMoney = storage.getInt('playerMoney', 100);' Line Number: 239 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
balıkçı adamın sağında kulube olsun o kulubede yemler olsun yemlerin kalitesine göre fiyatı değişsin
User prompt
yeni 2 balık türü daha yap
Code edit (1 edits merged)
Please save this source code
User prompt
Lake Fishing Adventure
Initial prompt
bana bir göl yap ve bizim elimizdede bir olta olsun
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Bag = Container.expand(function () {
var self = Container.call(this);
// Create bag graphics
var bagBody = self.attachAsset('bag', {
anchorX: 0.5,
anchorY: 1
});
var bagHandle = self.attachAsset('bagHandle', {
anchorX: 0.5,
anchorY: 1,
x: 0,
y: -100
});
// Store fish in bag
self.fishInventory = [];
self.addFish = function (fishType, points) {
self.fishInventory.push({
type: fishType,
points: points,
price: Math.floor(points / 2)
});
};
self.down = function () {
showInventory();
};
return self;
});
var Bait = Container.expand(function (type) {
var self = Container.call(this);
self.baitType = type || 'basic';
var baitAsset;
if (self.baitType === 'basic') {
baitAsset = self.attachAsset('basicBait', {
anchorX: 0.5,
anchorY: 0.5
});
self.price = 10;
self.catchChance = 1.0;
self.name = 'Basic Bait';
} else if (self.baitType === 'premium') {
baitAsset = self.attachAsset('premiumBait', {
anchorX: 0.5,
anchorY: 0.5
});
self.price = 25;
self.catchChance = 1.5;
self.name = 'Premium Bait';
} else if (self.baitType === 'golden') {
baitAsset = self.attachAsset('goldenBait', {
anchorX: 0.5,
anchorY: 0.5
});
self.price = 50;
self.catchChance = 2.0;
self.name = 'Golden Bait';
}
return self;
});
var Boat = Container.expand(function () {
var self = Container.call(this);
// Create boat hull
var boatHull = self.attachAsset('boat', {
anchorX: 0.5,
anchorY: 0.5
});
// Array to hold caught fish
self.caughtFish = [];
// Boat movement properties
self.speed = 3;
self.isMoving = false;
self.targetX = 0;
// Method to add fish to boat
self.addFish = function (fish) {
// Position fish in boat
var fishInBoat = self.addChild(fish);
var offset = self.caughtFish.length * 25 - 50; // Spread fish across boat
fishInBoat.x = offset;
fishInBoat.y = -20;
fishInBoat.scaleX = 0.6;
fishInBoat.scaleY = 0.6;
self.caughtFish.push(fishInBoat);
};
// Method to move boat to target position
self.moveTo = function (targetX) {
if (targetX < 100) targetX = 100;
if (targetX > 1948) targetX = 1948;
self.targetX = targetX;
self.isMoving = true;
};
self.update = function () {
if (self.isMoving) {
var distance = self.targetX - self.x;
if (Math.abs(distance) > self.speed) {
self.x += distance > 0 ? self.speed : -self.speed;
} else {
self.x = self.targetX;
self.isMoving = false;
}
}
};
return self;
});
var Cabin = Container.expand(function () {
var self = Container.call(this);
// Cabin structure
var cabin = self.attachAsset('cabin', {
anchorX: 0.5,
anchorY: 1
});
var roof = self.attachAsset('cabinRoof', {
anchorX: 0.5,
anchorY: 1,
y: -180
});
var door = self.attachAsset('cabinDoor', {
anchorX: 0.5,
anchorY: 1,
y: -50
});
// Bait displays
self.basicBaitDisplay = self.addChild(new Bait('basic'));
self.basicBaitDisplay.x = -60;
self.basicBaitDisplay.y = -140;
self.premiumBaitDisplay = self.addChild(new Bait('premium'));
self.premiumBaitDisplay.x = -20;
self.premiumBaitDisplay.y = -140;
self.goldenBaitDisplay = self.addChild(new Bait('golden'));
self.goldenBaitDisplay.x = 20;
self.goldenBaitDisplay.y = -140;
// Make baits interactive
self.basicBaitDisplay.down = function () {
purchaseBait('basic');
};
self.premiumBaitDisplay.down = function () {
purchaseBait('premium');
};
self.goldenBaitDisplay.down = function () {
purchaseBait('golden');
};
return self;
});
var Fish = Container.expand(function (type) {
var self = Container.call(this);
self.fishType = type || 'small';
var fishAsset;
if (self.fishType === 'small') {
fishAsset = self.attachAsset('smallFish', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 1 + Math.random() * 2;
self.points = 10;
} else if (self.fishType === 'medium') {
fishAsset = self.attachAsset('mediumFish', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 0.5 + Math.random() * 1.5;
self.points = 25;
} else if (self.fishType === 'tropical') {
fishAsset = self.attachAsset('tropicalFish', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 1.5 + Math.random() * 2;
self.points = 35;
} else if (self.fishType === 'rare') {
fishAsset = self.attachAsset('rareFish', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 0.2 + Math.random() * 0.8;
self.points = 100;
} else {
fishAsset = self.attachAsset('largeFish', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 0.3 + Math.random() * 1;
self.points = 50;
}
self.directionX = Math.random() > 0.5 ? 1 : -1;
self.directionY = (Math.random() - 0.5) * 0.5;
self.startX = self.x;
self.swimDistance = 300 + Math.random() * 400;
self.update = function () {
self.x += self.speed * self.directionX;
self.y += self.speed * self.directionY;
// Turn around if swam too far
if (Math.abs(self.x - self.startX) > self.swimDistance) {
self.directionX *= -1;
fishAsset.scaleX = self.directionX;
self.startX = self.x;
}
// Keep fish in water bounds
if (self.x < 50) {
self.x = 50;
self.directionX = 1;
fishAsset.scaleX = 1;
}
if (self.x > 1998) {
self.x = 1998;
self.directionX = -1;
fishAsset.scaleX = -1;
}
if (self.y < waterSurface + 100) {
self.y = waterSurface + 100;
self.directionY = Math.abs(self.directionY);
}
if (self.y > waterSurface + 1200) {
self.y = waterSurface + 1200;
self.directionY = -Math.abs(self.directionY);
}
};
return self;
});
var FishingLine = Container.expand(function () {
var self = Container.call(this);
self.lineGraphics = self.attachAsset('fishingLine', {
anchorX: 0.5,
anchorY: 0
});
self.hook = self.addChild(new Container());
self.hookGraphics = self.hook.attachAsset('hook', {
anchorX: 0.5,
anchorY: 0.5
});
self.bobber = self.addChild(new Container());
self.bobberGraphics = self.bobber.attachAsset('bobber', {
anchorX: 0.5,
anchorY: 0.5
});
self.isVisible = false;
self.visible = false;
self.showLine = function (startX, startY, endX, endY) {
self.x = startX;
self.y = startY;
var distance = Math.sqrt((endX - startX) * (endX - startX) + (endY - startY) * (endY - startY));
var angle = Math.atan2(endY - startY, endX - startX);
self.lineGraphics.height = distance;
self.lineGraphics.rotation = angle + Math.PI / 2;
self.hook.x = 0;
self.hook.y = distance;
self.bobber.x = 0;
self.bobber.y = distance - 20;
self.isVisible = true;
self.visible = true;
};
self.hideLine = function () {
self.isVisible = false;
self.visible = false;
};
return self;
});
var Shop = Container.expand(function () {
var self = Container.call(this);
// Shop background
var shopBg = self.attachAsset('cabin', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 2.5
});
self.visible = false;
self.isOpen = false;
self.fishingRods = [];
for (var i = 0; i < 15; i++) {
self.fishingRods.push({
level: i + 1,
price: 50 + i * 25,
catchBonus: 1 + i * 0.1
});
}
self.open = function () {
self.visible = true;
self.isOpen = true;
game.isPaused = true;
};
self.close = function () {
self.visible = false;
self.isOpen = false;
game.isPaused = false;
};
self.down = function (x, y) {
if (x > 0) {
// Right side - buy rods and bait
var rodIndex = Math.floor((y + 200) / 50);
if (rodIndex >= 0 && rodIndex < 15) {
var rod = self.fishingRods[rodIndex];
if (playerMoney >= rod.price) {
playerMoney -= rod.price;
storage.playerMoney = playerMoney;
currentRodLevel = rod.level;
storage.rodLevel = currentRodLevel;
moneyTxt.setText('Money: ' + playerMoney);
}
}
} else {
// Left side - sell fish
if (inventoryBag.fishInventory.length > 0) {
var fish = inventoryBag.fishInventory.pop();
playerMoney += fish.price;
storage.playerMoney = playerMoney;
moneyTxt.setText('Money: ' + playerMoney);
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Game variables
var waterSurface = 600;
var fish = [];
var isCasting = false;
var isReeling = false;
var castStartX = 0;
var castStartY = 0;
var hookedFish = null;
var reelProgress = 0;
var clickCount = 0;
var lastClickX = 0;
var lastClickY = 0;
var targetCastX = 0;
var targetCastY = 0;
var clickTimeout = null;
// Bait system variables
var playerMoney = storage.playerMoney || 100;
var currentBait = 'basic';
var baitCount = {
basic: storage.basicBait || 5,
premium: storage.premiumBait || 0,
golden: storage.goldenBait || 0
};
var currentRodLevel = storage.rodLevel || 1;
var inventoryOpen = false;
var shopOpen = false;
// Create water
var water = game.addChild(LK.getAsset('water', {
anchorX: 0,
anchorY: 0,
x: 0,
y: waterSurface
}));
// Create boat
var boat = game.addChild(new Boat());
boat.x = 1024;
boat.y = waterSurface - 30;
// Create player on boat
var player = boat.addChild(LK.getAsset('player', {
anchorX: 0.5,
anchorY: 1,
x: 0,
y: -30
}));
// Create fishing rod on boat
var fishingRod = boat.addChild(LK.getAsset('fishingRod', {
anchorX: 0.5,
anchorY: 1,
x: 0,
y: -20
}));
// Create fishing line
var fishingLine = game.addChild(new FishingLine());
// Create cabin on the right side
var cabin = game.addChild(new Cabin());
cabin.x = 1600;
cabin.y = waterSurface;
// Create inventory bag at bottom of screen
var inventoryBag = game.addChild(new Bag());
inventoryBag.x = 1024;
inventoryBag.y = 2732;
// Create shop interface
var shop = game.addChild(new Shop());
shop.x = 1024;
shop.y = 1366;
// Create UI
var scoreTxt = new Text2('Score: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
var instructionTxt = new Text2('Tap 3 times on lake to cast your line!', {
size: 40,
fill: 0xFFFFFF
});
instructionTxt.anchor.set(0.5, 0);
instructionTxt.y = 80;
LK.gui.top.addChild(instructionTxt);
var moneyTxt = new Text2('Money: ' + playerMoney, {
size: 50,
fill: 0xFFD700
});
moneyTxt.anchor.set(1, 0);
LK.gui.topRight.addChild(moneyTxt);
var baitTxt = new Text2('Bait: ' + currentBait.charAt(0).toUpperCase() + currentBait.slice(1) + ' (' + baitCount[currentBait] + ')', {
size: 40,
fill: 0xFFFFFF
});
baitTxt.anchor.set(1, 0);
baitTxt.y = 60;
LK.gui.topRight.addChild(baitTxt);
var cabinInfoTxt = new Text2('Visit cabin to buy baits!\nBasic: 10 Premium: 25 Golden: 50', {
size: 30,
fill: 0xFFFFFF
});
cabinInfoTxt.anchor.set(0, 1);
cabinInfoTxt.y = -20;
LK.gui.bottomLeft.addChild(cabinInfoTxt);
var rodLevelTxt = new Text2('Rod Level: ' + currentRodLevel, {
size: 40,
fill: 0xFFD700
});
rodLevelTxt.anchor.set(0, 0);
rodLevelTxt.y = 120;
LK.gui.topLeft.addChild(rodLevelTxt);
// Purchase bait function
function purchaseBait(baitType) {
var bait = new Bait(baitType);
if (playerMoney >= bait.price) {
playerMoney -= bait.price;
baitCount[baitType] += 1;
// Save to storage
storage.playerMoney = playerMoney;
storage[baitType + 'Bait'] = baitCount[baitType];
// Update UI
moneyTxt.setText('Money: ' + playerMoney);
baitTxt.setText('Bait: ' + currentBait.charAt(0).toUpperCase() + currentBait.slice(1) + ' (' + baitCount[currentBait] + ')');
instructionTxt.setText('Bought ' + bait.name + '!');
LK.setTimeout(function () {
instructionTxt.setText('Tap 3 times on lake to cast your line!');
}, 1500);
} else {
instructionTxt.setText('Not enough money!');
LK.setTimeout(function () {
instructionTxt.setText('Tap 3 times on lake to cast your line!');
}, 1500);
}
}
// Show inventory function
function showInventory() {
if (inventoryOpen) return;
inventoryOpen = true;
// Create inventory display
var inventoryBg = game.addChild(LK.getAsset('cabin', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
scaleX: 4,
scaleY: 3
}));
var inventoryTitle = new Text2('Fish Inventory', {
size: 60,
fill: 0xFFFFFF
});
inventoryTitle.anchor.set(0.5, 0.5);
inventoryTitle.x = 1024;
inventoryTitle.y = 800;
game.addChild(inventoryTitle);
// Display fish and prices
for (var i = 0; i < inventoryBag.fishInventory.length; i++) {
var fish = inventoryBag.fishInventory[i];
var fishText = new Text2(fish.type + ' - $' + fish.price, {
size: 40,
fill: 0xFFFFFF
});
fishText.anchor.set(0.5, 0.5);
fishText.x = 1024;
fishText.y = 900 + i * 60;
game.addChild(fishText);
}
// Close button
var closeBtn = game.addChild(LK.getAsset('bag', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1800
}));
closeBtn.down = function () {
// Remove inventory display
game.removeChild(inventoryBg);
game.removeChild(inventoryTitle);
game.removeChild(closeBtn);
inventoryOpen = false;
};
}
// Show shop function
function showShop() {
if (shopOpen) return;
shopOpen = true;
shop.open();
}
// Switch bait function
function switchBait() {
var baitTypes = ['basic', 'premium', 'golden'];
var currentIndex = baitTypes.indexOf(currentBait);
for (var i = 1; i <= baitTypes.length; i++) {
var nextIndex = (currentIndex + i) % baitTypes.length;
var nextBait = baitTypes[nextIndex];
if (baitCount[nextBait] > 0) {
currentBait = nextBait;
baitTxt.setText('Bait: ' + currentBait.charAt(0).toUpperCase() + currentBait.slice(1) + ' (' + baitCount[currentBait] + ')');
break;
}
}
}
// Spawn initial fish
function spawnFish() {
var fishType;
var rand = Math.random();
if (rand < 0.4) {
fishType = 'small';
} else if (rand < 0.65) {
fishType = 'medium';
} else if (rand < 0.8) {
fishType = 'tropical';
} else if (rand < 0.95) {
fishType = 'large';
} else {
fishType = 'rare';
}
var newFish = game.addChild(new Fish(fishType));
newFish.x = Math.random() * 1948 + 50;
newFish.y = waterSurface + 150 + Math.random() * 1000;
newFish.startX = newFish.x;
fish.push(newFish);
}
// Spawn initial fish
for (var i = 0; i < 8; i++) {
spawnFish();
}
// Cast fishing line
function castLine(targetX, targetY) {
if (isCasting || isReeling) return;
if (baitCount[currentBait] <= 0) {
instructionTxt.setText('No bait! Visit the cabin to buy more.');
LK.setTimeout(function () {
instructionTxt.setText('Tap 3 times on lake to cast your line!');
}, 2000);
return;
}
isCasting = true;
// Use bait
baitCount[currentBait] -= 1;
storage[currentBait + 'Bait'] = baitCount[currentBait];
baitTxt.setText('Bait: ' + currentBait.charAt(0).toUpperCase() + currentBait.slice(1) + ' (' + baitCount[currentBait] + ')');
var rodTipX = boat.x + fishingRod.x;
var rodTipY = boat.y + fishingRod.y - 180;
fishingLine.showLine(rodTipX, rodTipY, targetX, targetY);
LK.getSound('cast').play();
// Animate casting
tween(fishingRod, {
rotation: Math.PI / 6
}, {
duration: 200
});
LK.setTimeout(function () {
LK.getSound('splash').play();
// Check if hook is near any fish
checkForFish(targetX, targetY);
LK.setTimeout(function () {
if (!hookedFish) {
reelIn();
}
}, 2000);
}, 300);
}
// Check if hook caught a fish
function checkForFish(hookX, hookY) {
var bait = new Bait(currentBait);
var catchRadius = 60 * bait.catchChance;
for (var i = 0; i < fish.length; i++) {
var currentFish = fish[i];
var distance = Math.sqrt((currentFish.x - hookX) * (currentFish.x - hookX) + (currentFish.y - hookY) * (currentFish.y - hookY));
if (distance < catchRadius) {
// Better bait increases chance of catching rare fish
var catchChance = Math.random() * bait.catchChance;
if (catchChance > 0.5 || currentFish.fishType !== 'rare') {
hookedFish = currentFish;
reelProgress = 0;
isReeling = true;
LK.getSound('catch').play();
instructionTxt.setText('Tap rapidly to reel in!');
// Flash the hooked fish
LK.effects.flashObject(hookedFish, 0xFFFF00, 500);
break;
}
}
}
}
// Reel in the line
function reelIn() {
if (hookedFish) {
// Increase score
LK.setScore(LK.getScore() + hookedFish.points);
scoreTxt.setText('Score: ' + LK.getScore());
// Give money based on fish value
var moneyEarned = Math.floor(hookedFish.points / 2);
playerMoney += moneyEarned;
storage.playerMoney = playerMoney;
moneyTxt.setText('Money: ' + playerMoney);
// Add fish to boat instead of destroying it
var caughtFish = null;
for (var i = fish.length - 1; i >= 0; i--) {
if (fish[i] === hookedFish) {
caughtFish = fish[i];
fish.splice(i, 1);
break;
}
}
if (caughtFish) {
// Remove fish from game container
game.removeChild(caughtFish);
// Add to boat
boat.addFish(caughtFish);
// Add to inventory bag
inventoryBag.addFish(caughtFish.fishType, caughtFish.points);
}
// Spawn new fish
spawnFish();
hookedFish = null;
reelProgress = 0;
}
// Reset fishing state
fishingLine.hideLine();
tween(fishingRod, {
rotation: 0
}, {
duration: 300
});
isCasting = false;
isReeling = false;
instructionTxt.setText('Tap 3 times on lake to cast your line!');
}
// Game events
game.down = function (x, y, obj) {
if (isReeling && hookedFish) {
reelProgress += 20;
if (reelProgress >= 100) {
reelIn();
}
return;
}
// Check if boat is near cabin for shop interaction
if (!isCasting && !isReeling && Math.abs(boat.x - cabin.x) < 100 && x > 1400 && x < 1800 && y < waterSurface + 100) {
showShop();
return;
}
// Switch bait on tap (when not casting or reeling)
if (!isCasting && !isReeling && x > 1500) {
switchBait();
return;
}
if (!isCasting && !isReeling) {
// Check if click is in water area (entire lake surface)
if (y > waterSurface && x >= 0 && x <= 2048) {
// Move boat to clicked location first
boat.moveTo(x);
// Clear previous timeout if exists
if (clickTimeout) {
LK.clearTimeout(clickTimeout);
clickTimeout = null;
}
// Check if this is a new click sequence (different location or too much time passed)
var distance = Math.sqrt((x - lastClickX) * (x - lastClickX) + (y - lastClickY) * (y - lastClickY));
if (distance > 100) {
clickCount = 1;
targetCastX = x;
targetCastY = y;
} else {
clickCount++;
}
lastClickX = x;
lastClickY = y;
// Update instruction text
instructionTxt.setText('Click ' + (3 - clickCount) + ' more times at same spot to cast!');
// If 3 clicks reached, cast the line
if (clickCount >= 3) {
castLine(targetCastX, targetCastY);
clickCount = 0;
} else {
// Set timeout to reset click count if no more clicks
clickTimeout = LK.setTimeout(function () {
clickCount = 0;
instructionTxt.setText('Tap 3 times on lake to cast your line!');
clickTimeout = null;
}, 2000);
}
}
}
};
game.up = function (x, y, obj) {
// Removed drag-to-cast functionality - now using 3-tap system
};
// Spawn new fish periodically
var fishSpawnTimer = 0;
game.update = function () {
// Update boat
boat.update();
// Update all fish
for (var i = 0; i < fish.length; i++) {
fish[i].update();
}
// Spawn new fish occasionally
fishSpawnTimer++;
if (fishSpawnTimer > 600 && fish.length < 12) {
// Every 10 seconds at 60fps
spawnFish();
fishSpawnTimer = 0;
}
// Move hooked fish towards rod
if (hookedFish && isReeling) {
var targetX = boat.x + fishingRod.x;
var targetY = boat.y + fishingRod.y - 100;
var moveSpeed = 0.02;
hookedFish.x += (targetX - hookedFish.x) * moveSpeed;
hookedFish.y += (targetY - hookedFish.y) * moveSpeed;
// Auto-reel if fish gets close enough
var distance = Math.sqrt((hookedFish.x - targetX) * (hookedFish.x - targetX) + (hookedFish.y - targetY) * (hookedFish.y - targetY));
if (distance < 50) {
reelIn();
}
}
};
// Play ambient music
LK.playMusic('ambience'); ===================================================================
--- original.js
+++ change.js
@@ -6,8 +6,35 @@
/****
* Classes
****/
+var Bag = Container.expand(function () {
+ var self = Container.call(this);
+ // Create bag graphics
+ var bagBody = self.attachAsset('bag', {
+ anchorX: 0.5,
+ anchorY: 1
+ });
+ var bagHandle = self.attachAsset('bagHandle', {
+ anchorX: 0.5,
+ anchorY: 1,
+ x: 0,
+ y: -100
+ });
+ // Store fish in bag
+ self.fishInventory = [];
+ self.addFish = function (fishType, points) {
+ self.fishInventory.push({
+ type: fishType,
+ points: points,
+ price: Math.floor(points / 2)
+ });
+ };
+ self.down = function () {
+ showInventory();
+ };
+ return self;
+});
var Bait = Container.expand(function (type) {
var self = Container.call(this);
self.baitType = type || 'basic';
var baitAsset;
@@ -233,8 +260,63 @@
self.visible = false;
};
return self;
});
+var Shop = Container.expand(function () {
+ var self = Container.call(this);
+ // Shop background
+ var shopBg = self.attachAsset('cabin', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 3,
+ scaleY: 2.5
+ });
+ self.visible = false;
+ self.isOpen = false;
+ self.fishingRods = [];
+ for (var i = 0; i < 15; i++) {
+ self.fishingRods.push({
+ level: i + 1,
+ price: 50 + i * 25,
+ catchBonus: 1 + i * 0.1
+ });
+ }
+ self.open = function () {
+ self.visible = true;
+ self.isOpen = true;
+ game.isPaused = true;
+ };
+ self.close = function () {
+ self.visible = false;
+ self.isOpen = false;
+ game.isPaused = false;
+ };
+ self.down = function (x, y) {
+ if (x > 0) {
+ // Right side - buy rods and bait
+ var rodIndex = Math.floor((y + 200) / 50);
+ if (rodIndex >= 0 && rodIndex < 15) {
+ var rod = self.fishingRods[rodIndex];
+ if (playerMoney >= rod.price) {
+ playerMoney -= rod.price;
+ storage.playerMoney = playerMoney;
+ currentRodLevel = rod.level;
+ storage.rodLevel = currentRodLevel;
+ moneyTxt.setText('Money: ' + playerMoney);
+ }
+ }
+ } else {
+ // Left side - sell fish
+ if (inventoryBag.fishInventory.length > 0) {
+ var fish = inventoryBag.fishInventory.pop();
+ playerMoney += fish.price;
+ storage.playerMoney = playerMoney;
+ moneyTxt.setText('Money: ' + playerMoney);
+ }
+ }
+ };
+ return self;
+});
/****
* Initialize Game
****/
@@ -267,8 +349,11 @@
basic: storage.basicBait || 5,
premium: storage.premiumBait || 0,
golden: storage.goldenBait || 0
};
+var currentRodLevel = storage.rodLevel || 1;
+var inventoryOpen = false;
+var shopOpen = false;
// Create water
var water = game.addChild(LK.getAsset('water', {
anchorX: 0,
anchorY: 0,
@@ -298,8 +383,16 @@
// Create cabin on the right side
var cabin = game.addChild(new Cabin());
cabin.x = 1600;
cabin.y = waterSurface;
+// Create inventory bag at bottom of screen
+var inventoryBag = game.addChild(new Bag());
+inventoryBag.x = 1024;
+inventoryBag.y = 2732;
+// Create shop interface
+var shop = game.addChild(new Shop());
+shop.x = 1024;
+shop.y = 1366;
// Create UI
var scoreTxt = new Text2('Score: 0', {
size: 60,
fill: 0xFFFFFF
@@ -332,8 +425,15 @@
});
cabinInfoTxt.anchor.set(0, 1);
cabinInfoTxt.y = -20;
LK.gui.bottomLeft.addChild(cabinInfoTxt);
+var rodLevelTxt = new Text2('Rod Level: ' + currentRodLevel, {
+ size: 40,
+ fill: 0xFFD700
+});
+rodLevelTxt.anchor.set(0, 0);
+rodLevelTxt.y = 120;
+LK.gui.topLeft.addChild(rodLevelTxt);
// Purchase bait function
function purchaseBait(baitType) {
var bait = new Bait(baitType);
if (playerMoney >= bait.price) {
@@ -355,8 +455,62 @@
instructionTxt.setText('Tap 3 times on lake to cast your line!');
}, 1500);
}
}
+// Show inventory function
+function showInventory() {
+ if (inventoryOpen) return;
+ inventoryOpen = true;
+ // Create inventory display
+ var inventoryBg = game.addChild(LK.getAsset('cabin', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 1024,
+ y: 1366,
+ scaleX: 4,
+ scaleY: 3
+ }));
+ var inventoryTitle = new Text2('Fish Inventory', {
+ size: 60,
+ fill: 0xFFFFFF
+ });
+ inventoryTitle.anchor.set(0.5, 0.5);
+ inventoryTitle.x = 1024;
+ inventoryTitle.y = 800;
+ game.addChild(inventoryTitle);
+ // Display fish and prices
+ for (var i = 0; i < inventoryBag.fishInventory.length; i++) {
+ var fish = inventoryBag.fishInventory[i];
+ var fishText = new Text2(fish.type + ' - $' + fish.price, {
+ size: 40,
+ fill: 0xFFFFFF
+ });
+ fishText.anchor.set(0.5, 0.5);
+ fishText.x = 1024;
+ fishText.y = 900 + i * 60;
+ game.addChild(fishText);
+ }
+ // Close button
+ var closeBtn = game.addChild(LK.getAsset('bag', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 1024,
+ y: 1800
+ }));
+ closeBtn.down = function () {
+ // Remove inventory display
+ game.removeChild(inventoryBg);
+ game.removeChild(inventoryTitle);
+ game.removeChild(closeBtn);
+ inventoryOpen = false;
+ };
+}
+// Show shop function
+function showShop() {
+ if (shopOpen) return;
+ shopOpen = true;
+ shop.open();
+}
// Switch bait function
function switchBait() {
var baitTypes = ['basic', 'premium', 'golden'];
var currentIndex = baitTypes.indexOf(currentBait);
@@ -478,8 +632,10 @@
// Remove fish from game container
game.removeChild(caughtFish);
// Add to boat
boat.addFish(caughtFish);
+ // Add to inventory bag
+ inventoryBag.addFish(caughtFish.fishType, caughtFish.points);
}
// Spawn new fish
spawnFish();
hookedFish = null;
@@ -504,8 +660,13 @@
reelIn();
}
return;
}
+ // Check if boat is near cabin for shop interaction
+ if (!isCasting && !isReeling && Math.abs(boat.x - cabin.x) < 100 && x > 1400 && x < 1800 && y < waterSurface + 100) {
+ showShop();
+ return;
+ }
// Switch bait on tap (when not casting or reeling)
if (!isCasting && !isReeling && x > 1500) {
switchBait();
return;
yeşil balık. In-Game asset. 2d. High contrast. No shadows
gri balık sinirli. In-Game asset. 2d. High contrast. No shadows
olta. In-Game asset. 2d. High contrast. No shadows
mavi hamsi. In-Game asset. 2d. High contrast. No shadows
sarı balık. In-Game asset. 2d. High contrast. No shadows
gri büyük balık. In-Game asset. 2d. High contrast. No shadows
kayık. In-Game asset. 2d. High contrast. No shadows
çanta. In-Game asset. 2d. High contrast. No shadows
çatısız kulübe ama dümdüz ekrana bakan. In-Game asset. 2d. High contrast. No shadows
ahşap çatı ama dümdüz ekrana bakan. In-Game asset. 2d. High contrast. No shadows
palyaço balığı. In-Game asset. 2d. High contrast. No shadows
melek balığı. In-Game asset. 2d. High contrast. No shadows
yosun. In-Game asset. 2d. High contrast. No shadows
baloncuk açık renk. In-Game asset. 2d. High contrast. No shadows
bulut. In-Game asset. 2d. High contrast. No shadows
balıkçı ama elinde hiç bir şey olmasın. In-Game asset. 2d. High contrast. No shadows
çakıl taşı. In-Game asset. 2d. High contrast. No shadows