User prompt
arkaplana detaylar ekle süngerbop dünyası gibi
User prompt
daha büyükl
User prompt
çok daha büyük kalkan
User prompt
daha büyük ve daha saydam
User prompt
daha büyük
User prompt
Kalkanın çapı büyük olmalı
User prompt
kalkanı büyüt balıktan büyük ve yarı saydam olmalı
User prompt
kalkanı görünür yap ve mavi yuvarlak olsun
User prompt
ilk doğduğumda 3 saniye olacak bir kalkan yap ve bu kalkan varken ölümsüzüm
User prompt
2. kısım geldiğinde sürekli yeşil ışık yanıyor win değil stage 2 yazsın ve bu sefer etrafta büyük ahtapotlar ve küçük balıklar olsun biraz da yosun
User prompt
200 puanı geçince you win yazmasın bana yeni bir map yarat alt kısmı mercanlarla dolu olan bir yer ordaki balıklar ve mayınlar stage 2 de olmasın
User prompt
200 puan olunca stage 2 ye geçsin
User prompt
balıklara ağız ekler misin ve kuyrukları daha gerçekçi olsun
User prompt
Please fix the bug: 'ReferenceError: shield is not defined' in or related to this line: 'if (player.intersects(fish) && !shield.parent) {' Line Number: 437
User prompt
geri al
User prompt
mercanı göremiyorum yaptığın son hamleyi geri al ve , mapin alt kısmına mercanlar ekle renkli olsun
User prompt
denizin dibine mercan ekle
User prompt
mousa a basılı tutunca balığım hızlansın
User prompt
kalkan daha geniş olsun
User prompt
kalkan aktifse ölmiyim
User prompt
kalkan daha geniş bir alan kaplasın hafif saydam mavi olsun
User prompt
doğduğumda 3 saniyeliğine bir kalkan olsun mavi ve beni yiyemesinler
User prompt
skor kılçık olmasın vazgeçtim ilk hali iyi
User prompt
skor kılçık olarak gözüksün ve kılçık giderek büyüsün farklı sembollerle göster
Code edit (1 edits merged)
Please save this source code
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { highScore: 0 }); /**** * Classes ****/ 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, scaleY: sizeMultiplier }); // 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 * 0.8, scaleY: sizeMultiplier * 0.8 }); tail.tint = tailColor; self.addChild(tail); // 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 > 2048) { self.speedX *= -1; } // Limit vertical movement more subtly if (self.y < 0 || self.y > 2732) { self.speedY *= -1; } // Occasionally change vertical direction if (Math.random() < 0.01) { self.speedY = (Math.random() - 0.5) * 1.5; } }; 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 ****/ // Game variables var player = null; var fishes = []; var mines = []; var score = 0; var gameActive = true; // 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(0, 0); LK.gui.topRight.addChild(scoreTxt); scoreTxt.x = -scoreTxt.width - 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() { // Spawn initial fish spawnFish(10, 'smallFish', 1); spawnFish(5, 'mediumFish', 2); spawnFish(3, 'largeFish', 3); // Spawn mines spawnMines(8); // 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; } } // Mouse/touch events game.down = function (x, y, obj) { handleMove(x, y, obj); }; game.move = handleMove; // Main game loop game.update = function () { if (!gameActive) { return; } // Check for collisions with fish for (var i = fishes.length - 1; i >= 0; i--) { var fish = fishes[i]; if (player.intersects(fish)) { // Determine if player can eat the fish if (player.level >= fish.fishLevel) { // Player eats fish LK.getSound('eat').play(); // Add score based on fish level var points = fish.fishLevel * 10; score += points; scoreTxt.setText('Score: ' + score); // Remove fish fish.destroy(); fishes.splice(i, 1); // 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 { // 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();
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1", {
highScore: 0
});
/****
* Classes
****/
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,
scaleY: sizeMultiplier
});
// 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 * 0.8,
scaleY: sizeMultiplier * 0.8
});
tail.tint = tailColor;
self.addChild(tail);
// 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 > 2048) {
self.speedX *= -1;
}
// Limit vertical movement more subtly
if (self.y < 0 || self.y > 2732) {
self.speedY *= -1;
}
// Occasionally change vertical direction
if (Math.random() < 0.01) {
self.speedY = (Math.random() - 0.5) * 1.5;
}
};
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
****/
// Game variables
var player = null;
var fishes = [];
var mines = [];
var score = 0;
var gameActive = true;
// 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(0, 0);
LK.gui.topRight.addChild(scoreTxt);
scoreTxt.x = -scoreTxt.width - 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() {
// Spawn initial fish
spawnFish(10, 'smallFish', 1);
spawnFish(5, 'mediumFish', 2);
spawnFish(3, 'largeFish', 3);
// Spawn mines
spawnMines(8);
// 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;
}
}
// Mouse/touch events
game.down = function (x, y, obj) {
handleMove(x, y, obj);
};
game.move = handleMove;
// Main game loop
game.update = function () {
if (!gameActive) {
return;
}
// Check for collisions with fish
for (var i = fishes.length - 1; i >= 0; i--) {
var fish = fishes[i];
if (player.intersects(fish)) {
// Determine if player can eat the fish
if (player.level >= fish.fishLevel) {
// Player eats fish
LK.getSound('eat').play();
// Add score based on fish level
var points = fish.fishLevel * 10;
score += points;
scoreTxt.setText('Score: ' + score);
// Remove fish
fish.destroy();
fishes.splice(i, 1);
// 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 {
// 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();