User prompt
can barı daha yukarda
User prompt
1 mayın sadece 1 kez patlayabilir ve patladığında yok olur
User prompt
mayınlar balığa tek atmıyor can barını 1/3 kadar azaltıyor
User prompt
Ana karakterimiz artık bir can barı var mayınlar tek seferde öldürmyüro
User prompt
süre ekranda görünür olsun lütfen
User prompt
60 saniye süre sınırı ekle süre sonunda oyun bitsin eğer süre sonunda 1000 puan üzerindeyse kazansın değilse kaybetsin
User prompt
lütfen ana karakterimizi daha detaylı çiz
User prompt
midyeyi farklı renklerle beraber gerçek bir midyeye benzet yalvarırım sana
User prompt
midyeye gölge ekle ağzı gövdesi belli olsun
User prompt
midyenin ağzını açma efekti gerçekçi olsun lütfen midyeye detay ekle ve inci çok daha büyük olsun ağzını kapatması 2 saniye sürsün
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'visible')' in or related to this line: 'if (clam.pearl.visible && player.intersects(clam.pearl)) {' Line Number: 547
User prompt
Please fix the bug: 'ReferenceError: clam is not defined' in or related to this line: 'if (clam.pearl.visible && player.intersects(clam.pearl)) {' Line Number: 546
User prompt
çok daha büyük yap ve kahverengi olsun ağzını açınca içinden beyaz bir inci çıksın ve onu yiyebileyim
User prompt
midyeyi göremiyorum devasa yap
User prompt
midyeyi görünür ve aşağıda yap büyük olsun
User prompt
kalkan varken ölümsüzüz ama kalkan ilk 3 saniyeden sonra yok olur
User prompt
kalkan ana karakterde
User prompt
Çok daha büyük ve mavi
User prompt
doğunca 3 saniyeliğine bir kalkan etkin ve bu kalkan görünür büyük mavi
User prompt
kalkanı sil
User prompt
kalkanı göremiyorum görünür yap büyük mavi saydam bir kalkan
User prompt
kalkanı görünür yap mavi büyük bir kalkan
User prompt
küçük balıklar daha çok spawn olur ve doğunca ilk 3 saniye kalkana sahibim kalkan varken oyunu kaybetmem
User prompt
+200 puan olan herşeyi sil
User prompt
200 puanı geçince final boss gelmedi ?
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1", {
highScore: 0
});
/****
* Classes
****/
var Clam = Container.expand(function () {
var self = Container.call(this);
// Clam body
var body = self.attachAsset('mine', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.0
});
// Pearl
var pearl = LK.getAsset('eyeball', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -body.height / 2 - 10,
scaleX: 0.5,
scaleY: 0.5,
visible: false
});
self.addChild(pearl);
// Open and release pearl every 10 seconds
var releasePearl = function releasePearl() {
pearl.visible = true;
LK.setTimeout(function () {
pearl.visible = false;
}, 1000);
};
LK.setInterval(releasePearl, 10000);
return self;
});
var Fish = Container.expand(function (type, level) {
var self = Container.call(this);
// Setup fish properties based on type
self.fishType = type || 'smallFish';
self.fishLevel = level || 1;
// Size multiplier based on level
var sizeMultiplier = 1;
if (self.fishLevel === 2) {
sizeMultiplier = 1.5;
}
if (self.fishLevel === 3) {
sizeMultiplier = 2;
}
// Fish body
var assetId = self.fishType;
var body = self.attachAsset(assetId, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: sizeMultiplier * (Math.random() * 0.2 + 0.9),
// Vary size slightly for realism
scaleY: sizeMultiplier * (Math.random() * 0.2 + 0.9),
// Vary size slightly for realism
tint: 0x8A2BE2 // Add a more realistic purple tint
});
// Tail
var tailColor = self.fishType === 'smallFish' ? 0xffb967 : self.fishType === 'mediumFish' ? 0xff6c67 : 0xc267ff;
var tail = LK.getAsset('tail', {
anchorX: 1.0,
anchorY: 0.5,
x: -body.width / 2,
y: 0,
scaleX: sizeMultiplier * (Math.random() * 0.3 + 0.8),
// Vary size slightly for realism
scaleY: sizeMultiplier * (Math.random() * 0.3 + 0.8),
// Vary size slightly for realism
tint: 0x8A2BE2,
// Add a more realistic purple tint
texture: 'fishTailTexture' // Add texture for realism
});
tail.tint = tailColor;
self.addChild(tail);
// Mouth
var mouth = LK.getAsset('eyeball', {
anchorX: 0.5,
anchorY: 0.5,
x: body.width / 2,
y: body.height / 4,
scaleX: sizeMultiplier * 0.5,
scaleY: sizeMultiplier * 0.2,
tint: 0x000000
});
self.addChild(mouth);
// Eye
var eye = self.attachAsset('eyeball', {
anchorX: 0.5,
anchorY: 0.5,
x: body.width / 4,
y: -body.height / 4,
scaleX: sizeMultiplier,
scaleY: sizeMultiplier
});
// Pupil
var pupil = self.attachAsset('pupil', {
anchorX: 0.5,
anchorY: 0.5,
x: body.width / 4 + 2,
y: -body.height / 4,
scaleX: sizeMultiplier,
scaleY: sizeMultiplier
});
// Movement variables
self.speedX = (Math.random() * 2 + 1) * (Math.random() < 0.5 ? 1 : -1);
self.speedY = (Math.random() - 0.5) * 1.5;
// Animation
var _animateTail = function animateTail() {
tween(tail, {
scaleX: sizeMultiplier * 0.6
}, {
duration: 300,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(tail, {
scaleX: sizeMultiplier * 0.8
}, {
duration: 300,
easing: tween.easeInOut,
onFinish: _animateTail
});
}
});
};
_animateTail();
// Update method called automatically by LK engine
self.update = function () {
// Move fish
self.x += self.speedX;
self.y += self.speedY;
// Update rotation based on direction
if (self.speedX < 0) {
self.scale.x = -1;
} else {
self.scale.x = 1;
}
// Bounce off edges
if (self.x < 0) {
self.x = 0;
self.speedX *= -1;
} else if (self.x > 2048) {
self.x = 2048;
self.speedX *= -1;
}
// Limit vertical movement more subtly
if (self.y < 0) {
self.y = 0;
self.speedY *= -1;
} else if (self.y > 2732) {
self.y = 2732;
self.speedY *= -1;
}
// Ensure fish stay within bounds
self.x = Math.max(0, Math.min(self.x, 2048));
self.y = Math.max(0, Math.min(self.y, 2732));
// Occasionally change vertical direction
if (Math.random() < 0.01) {
self.speedY = (Math.random() - 0.5) * 1.5;
}
};
return self;
});
var GoldFish = Container.expand(function () {
var self = Container.call(this);
// GoldFish body
var body = self.attachAsset('smallFish', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.0,
scaleY: 1.0,
tint: 0xFFD700 // Gold color
});
// Movement variables
self.speedX = (Math.random() * 3 + 2) * (Math.random() < 0.5 ? 1 : -1);
self.speedY = (Math.random() - 0.5) * 2.0;
// Update method called automatically by LK engine
self.update = function () {
// Move goldfish
self.x += self.speedX;
self.y += self.speedY;
// Bounce off edges
if (self.x < 0 || self.x > 2048) {
self.speedX *= -1;
}
if (self.y < 0 || self.y > 2732) {
self.speedY *= -1;
}
};
return self;
});
var Mine = Container.expand(function () {
var self = Container.call(this);
// Mine body
var body = self.attachAsset('mine', {
anchorX: 0.5,
anchorY: 0.5
});
// Add spikes
for (var i = 0; i < 8; i++) {
var angle = i / 8 * Math.PI * 2;
var spike = LK.getAsset('mine', {
anchorX: 0.5,
anchorY: 0.5,
width: 15,
height: 3,
x: Math.cos(angle) * 25,
y: Math.sin(angle) * 25,
rotation: angle
});
self.addChild(spike);
}
// Small pulse animation
var _animatePulse = function animatePulse() {
tween(body, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(body, {
scaleX: 1,
scaleY: 1
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: _animatePulse
});
}
});
};
_animatePulse();
return self;
});
var PlayerFish = Container.expand(function () {
var self = Container.call(this);
// Fish body
var body = self.attachAsset('playerFish', {
anchorX: 0.5,
anchorY: 0.5
});
// Tail
var tail = self.attachAsset('tail', {
anchorX: 1.0,
anchorY: 0.5,
x: -body.width / 2,
y: 0
});
// Eye
var eye = self.attachAsset('eyeball', {
anchorX: 0.5,
anchorY: 0.5,
x: body.width / 4,
y: -body.height / 4
});
// Pupil
var pupil = self.attachAsset('pupil', {
anchorX: 0.5,
anchorY: 0.5,
x: body.width / 4 + 2,
y: -body.height / 4
});
// Size/Level properties
self.level = 1;
self.initialWidth = body.width;
self.initialHeight = body.height;
// Movement target
self.targetX = null;
self.targetY = null;
self.speed = 5;
// Animation
var _animateTail2 = function animateTail() {
tween(tail, {
scaleX: 0.7
}, {
duration: 300,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(tail, {
scaleX: 1
}, {
duration: 300,
easing: tween.easeInOut,
onFinish: _animateTail2
});
}
});
};
_animateTail2();
// Growth function
self.grow = function () {
self.level++;
// Calculate new size based on level (capped at level 5)
var growthFactor = Math.min(self.level * 0.25 + 1, 2.5);
tween(body, {
width: self.initialWidth * growthFactor,
height: self.initialHeight * growthFactor
}, {
duration: 500,
easing: tween.easeOut
});
tween(tail, {
width: tail.width * 1.2,
height: tail.height * 1.2,
x: -(self.initialWidth * growthFactor) / 2
}, {
duration: 500,
easing: tween.easeOut
});
tween(eye, {
x: self.initialWidth * growthFactor / 4,
y: -(self.initialHeight * growthFactor) / 4
}, {
duration: 500,
easing: tween.easeOut
});
tween(pupil, {
x: self.initialWidth * growthFactor / 4 + 2,
y: -(self.initialHeight * growthFactor) / 4
}, {
duration: 500,
easing: tween.easeOut
});
// Play level up sound
LK.getSound('levelUp').play();
};
// Update method called automatically by LK engine
self.update = function () {
if (self.targetX !== null && self.targetY !== null) {
// Calculate direction vector
var dx = self.targetX - self.x;
var dy = self.targetY - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
// If we're close enough to the target, stop moving
if (distance < self.speed) {
self.x = self.targetX;
self.y = self.targetY;
self.targetX = null;
self.targetY = null;
} else {
// Move towards target
self.x += dx / distance * self.speed;
self.y += dy / distance * self.speed;
// Rotate fish in the direction of movement
var angle = Math.atan2(dy, dx);
// Only flip horizontally, no rotation
if (dx < 0) {
self.scale.x = -1;
} else {
self.scale.x = 1;
}
}
}
// Keep fish in bounds
if (self.x < 0) {
self.x = 0;
}
if (self.y < 0) {
self.y = 0;
}
if (self.x > 2048) {
self.x = 2048;
}
if (self.y > 2732) {
self.y = 2732;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x202438 // Dark blue cave background
});
/****
* Game Code
****/
var player = null;
var fishes = [];
var mines = [];
var score = 0;
var gameActive = true;
var shield = {
parent: null
}; // Define a shield object with a parent property
// Background cave elements
var cave = game.addChild(LK.getAsset('cave', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
}));
// Initialize player fish
player = new PlayerFish();
player.x = 2048 / 2;
player.y = 2732 / 2;
game.addChild(player);
// UI
var scoreTxt = new Text2('Score: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(1, 0);
LK.gui.topRight.addChild(scoreTxt);
scoreTxt.x = -20;
scoreTxt.y = 20;
var levelTxt = new Text2('Level: 1', {
size: 60,
fill: 0xFFFFFF
});
levelTxt.anchor.set(0, 0);
LK.gui.topRight.addChild(levelTxt);
levelTxt.x = -levelTxt.width - 20;
levelTxt.y = 90;
var highScoreTxt = new Text2('High Score: ' + storage.highScore, {
size: 50,
fill: 0xFFDD00
});
highScoreTxt.anchor.set(0, 0);
LK.gui.topRight.addChild(highScoreTxt);
highScoreTxt.x = -highScoreTxt.width - 20;
highScoreTxt.y = 160;
// Initialize game elements
function initializeGame() {
// Add a clam to the game
var clam = new Clam();
clam.x = 2048 / 2;
clam.y = 2732 - 100;
clam.visible = true; // Make the clam visible
game.addChild(clam);
// Initialize player score and level
score = 0;
scoreTxt.setText('Score: ' + score);
player.level = 1;
player.shieldActive = false;
shield.visible = false;
// Start game at stage 1
spawnFish(5, 'smallFish', 1);
spawnFish(10, 'mediumFish', 2);
spawnMines(10);
// Start playing ambient cave sound
LK.playMusic('caveAmbience', {
loop: true,
fade: {
start: 0,
end: 0.4,
duration: 1000
}
});
}
// Spawn fish
function spawnFish(count, type, level) {
for (var i = 0; i < count; i++) {
var fish = new Fish(type, level);
fish.x = Math.random() * 2048;
fish.y = Math.random() * 2732;
fishes.push(fish);
game.addChild(fish);
}
}
// Spawn mines
function spawnMines(count) {
for (var i = 0; i < count; i++) {
var mine = new Mine();
mine.x = Math.random() * 2048;
mine.y = Math.random() * 2732;
mines.push(mine);
game.addChild(mine);
}
}
// Handle player movement
function handleMove(x, y, obj) {
if (gameActive) {
player.targetX = x;
player.targetY = y;
// Ensure player moves towards the target
player.update();
}
}
// Mouse/touch events
game.down = function (x, y, obj) {
handleMove(x, y, obj);
player.speed = 10; // Increase speed when mouse is held down
};
game.move = handleMove;
game.up = function (x, y, obj) {
player.speed = 5; // Reset speed when mouse is released
};
// Main game loop
game.update = function () {
if (!gameActive) {
return;
}
// Update player movement
player.update();
for (var i = fishes.length - 1; i >= 0; i--) {
var fish = fishes[i];
if (player.intersects(fish) && !fish.eaten) {
fish.eaten = true;
fish.destroy();
fishes.splice(i, 1);
// Determine if player can eat the fish
if (player.level >= fish.fishLevel) {
// Player eats fish
fish.eaten = true;
LK.getSound('eat').play();
// Add score based on fish type
var points = fish.fishLevel * 10;
score += points;
scoreTxt.setText('Score: ' + score);
// Check if player should level up
if (score >= player.level * 50) {
player.grow();
levelTxt.setText('Level: ' + player.level);
// Spawn a replacement fish
if (fish.fishLevel === 1) {
spawnFish(1, 'smallFish', 1);
} else if (fish.fishLevel === 2) {
spawnFish(1, 'mediumFish', 2);
} else {
spawnFish(1, 'largeFish', 3);
}
}
// Update high score if needed
if (score > storage.highScore) {
storage.highScore = score;
highScoreTxt.setText('High Score: ' + storage.highScore);
}
} else if (!(fish instanceof GoldFish) && fish.fishLevel > player.level) {
// Fish eats player - game over
gameActive = false;
LK.getSound('explode').play();
// Flash player
LK.effects.flashObject(player, 0xFF0000, 1000);
// Show game over
LK.setTimeout(function () {
LK.showGameOver();
}, 1500);
}
}
}
// Check for collisions with mines
for (var j = mines.length - 1; j >= 0; j--) {
var mine = mines[j];
if (player.intersects(mine)) {
// Mine explodes - game over
gameActive = false;
LK.getSound('explode').play();
// Flash screen
LK.effects.flashScreen(0xFF0000, 1000);
// Show game over
LK.setTimeout(function () {
LK.showGameOver();
}, 1500);
}
}
// Occasionally spawn a new small fish
if (Math.random() < 0.005 && fishes.length < 20) {
spawnFish(1, 'smallFish', 1);
}
};
// Initialize the game
initializeGame(); ===================================================================
--- original.js
+++ change.js
@@ -503,28 +503,8 @@
return;
}
// Update player movement
player.update();
- // Clear all fish and mines and spawn final boss when score exceeds 200
- if (score >= 200 && player.level < 2) {
- player.level = 2;
- // Clear all fish
- for (var i = fishes.length - 1; i >= 0; i--) {
- fishes[i].destroy();
- fishes.splice(i, 1);
- }
- // Clear all mines
- for (var j = mines.length - 1; j >= 0; j--) {
- mines[j].destroy();
- mines.splice(j, 1);
- }
- // Spawn final boss
- var finalBoss = new Fish('largeFish', 3);
- finalBoss.x = 2048 / 2;
- finalBoss.y = 2732 / 2;
- game.addChild(finalBoss);
- fishes.push(finalBoss); // Add final boss to fishes array for tracking
- }
for (var i = fishes.length - 1; i >= 0; i--) {
var fish = fishes[i];
if (player.intersects(fish) && !fish.eaten) {
fish.eaten = true;