User prompt
если сытость рыбы меньше 30 и в аквариуме есть корм то она перестает плавать как обычно и плывет напрямую к корму. Если корма нет то она плавает как обычно
User prompt
после остановки корм лежит 3 секунды потом мигает 2 секунды и удаляется
User prompt
сделай сытость 60
Code edit (1 edits merged)
Please save this source code
User prompt
каждую секунду рыба теряет 2 сытости
User prompt
каждую секунду рыба теряет 5 сытости
User prompt
подними еще на 25
User prompt
покрась сытость в синий цвет и подними выше на 50
User prompt
добавь каждой рыбе переменную сытость 100 единиц и сделай так чтобы она отображалась над головой каждой рыбы
User prompt
каждая рыба теряет 5 единиц голода. и это отображается над ее головой
User prompt
добавь каждой рыбе переменную голод 100 единиц
User prompt
для иконки корма звук должен быть clickkorm
User prompt
ии вторая иконка тоже. и все что я добавлю после тоже должны буду проигрывать такой звук\
User prompt
если иконка нажата и проигрывается анимауция то должен прозвучать звук click
User prompt
О да молодец. Только сократи паузу между ними в два раза
User prompt
нет ты не понял. Когда они появляются по 3 то делают это каскадом друг за другом из одной точки
User prompt
пузыри должны появляться не каждые 5 секунд а случайным образом в интервале от 10 до 20 секунд. И они должны появляться иногда один а иногда 3 подряд в одной позиции с интервалом в 1 секунду
User prompt
появление пузырей не должно быть привязано к рыбам. Пузыри появляются просто каждые 5 секунд не чаще
Code edit (1 edits merged)
Please save this source code
User prompt
удали из код все что связано с временем появления пузыря и сделай так чтобы пузырь появлялся каждые 3 секунду
User prompt
Они постоянно появляются а так быть не должно. Если появился пузырь то должно прочти как минимум 5 секунд
User prompt
Нет пузыри должны появляться раз в 5-10 секунда
User prompt
пузыри должны просто появляться с интервалом от 5 до 10 секунд
User prompt
появление пузырей никак не должно зависеть от количества рыб в аквариуме
User prompt
при исчезании пузыря проигрывается звук lop
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Aquarium class representing the aquarium
var Aquarium = Container.expand(function () {
var self = Container.call(this);
var aquariumGraphics = self.attachAsset('Aquarium', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = 2048 / 2;
self.y = 2732 / 2;
var scale = Math.min(2048 / aquariumGraphics.width, 2732 / aquariumGraphics.height);
self.scaleX = scale;
self.scaleY = scale;
});
// Bubble class representing a bubble created by fish
var Bubble = Container.expand(function () {
var self = Container.call(this);
var randomScale = Math.random() * 0.5 + 0.75; // Random scale between 0.75 and 1.25
var bubbleGraphics = self.attachAsset('bubble', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.7,
// Set transparency to 50%
scaleX: randomScale,
scaleY: randomScale
});
// Initialize bubble position and speed
self.speed = Math.random() * 0.5 + 0.5; // Random speed for each bubble
// Update function to move the bubble upwards
self.update = function () {
self.y -= self.speed * 2;
self.x += Math.sin(LK.ticks / 20) * 0.5; // Oscillate horizontally
if (self.y < 0) {
self.pop();
}
};
// Set a timeout to pop the bubble after a random lifespan between 3 to 5 seconds
LK.setTimeout(function () {
self.pop();
}, Math.random() * 2000 + 3000);
// Function to pop the bubble
self.pop = function () {
// Add pop animation or effect here if needed
LK.getSound('Lop').play();
self.destroy();
bubbles.splice(bubbles.indexOf(self), 1);
};
});
// Coin class representing a coin dropped by a fish
var Coin = Container.expand(function () {
var self = Container.call(this);
var coinGraphics = self.attachAsset('coin', {
anchorX: 0.5,
anchorY: 0.5
});
// Update function to move the coin downwards
self.update = function () {
self.y += 2;
if (self.y > 2732) {
self.destroy();
coins.splice(coins.indexOf(self), 1);
}
};
});
// Corm class representing a falling corm
var Corm = Container.expand(function () {
var self = Container.call(this);
self.rotationDirection = Math.random() < 0.5 ? 1 : -1; // Randomly set rotation direction
var cormGraphics = self.attachAsset('corm', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 2
});
// Update function to move the corm downwards
self.update = function () {
if (self.y > 700) {
self.y += 1; // Adjust speed to 1 after reaching y-position of 800
cormGraphics.rotation += self.rotationDirection * 0.005; // Slow down rotation when speed is 1
} else {
self.y += 2; // Initial speed of falling corm
cormGraphics.rotation += 0.01; // Rotate the corm slowly around its axis
}
if (self.y > aquarium.y + aquarium.height / 2 - 50) {
// Stop at the bottom of the aquarium
self.y = aquarium.y + aquarium.height / 2 - 50; // Set position to the bottom
self.update = null; // Stop updating position
}
};
});
// Fish class representing a fish in the aquarium
var Fish = Container.expand(function () {
var self = Container.call(this);
var fishGraphics = self.attachAsset('fish', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 3
});
self.speed = Math.random() * 2 + 1; // Random speed for each fish
self.direction = 1; // Fish always swim to the right when they appear
// Update function to move the fish
self.update = function () {
if (!self.horizontalPaused) {
self.x += self.speed * self.direction;
if (self.x < aquarium.x - aquarium.width / 2 || self.x > aquarium.x + aquarium.width / 2) {
self.direction *= -1; // Change direction if fish hits the aquarium edge
if (self.direction < 0) {
fishGraphics.scaleX = -1; // Flip the fish to the left
} else {
fishGraphics.scaleX = 1; // Flip the fish to the right
}
}
}
// Add vertical movement
if (!self.tweening) {
self.tweening = true;
var newY = Math.random() * (aquarium.y + 700 - 200) + aquarium.y - 700 + 200;
if (newY < aquarium.y - 900) {
newY = aquarium.y - 900;
}
if (newY > aquarium.y + 900) {
newY = aquarium.y + 900;
}
var duration = Math.abs(newY - self.y) * 10;
// If horizontal movement is paused, reduce vertical speed by three times
if (self.horizontalPaused) {
duration *= 3;
}
tween(self, {
y: newY
}, {
duration: duration,
onFinish: function onFinish() {
self.tweening = false;
}
});
}
// Handle horizontal pause, resume and direction change
if (!self.horizontalPauseTimer) {
self.horizontalPauseTimer = LK.setTimeout(function () {
self.horizontalPaused = true;
LK.setTimeout(function () {
self.horizontalPaused = false;
self.direction *= -1; // Change direction when resuming
if (self.direction < 0) {
fishGraphics.scaleX = -1; // Flip the fish to the left
} else {
fishGraphics.scaleX = 1; // Flip the fish to the right
}
self.horizontalPauseTimer = null;
}, Math.random() * 2000 + 2000); // Resume and change direction after 2-4 seconds
}, Math.random() * 7000 + 3000); // Pause every 3-10 seconds
}
// Occasionally create a bubble
if (bubbles.length < 6 && Math.random() < 0.0004) {
var bubble = new Bubble();
bubble.x = Math.random() * (aquarium.width - 50) + aquarium.x - aquarium.width / 2 + 25; // Random x position within the aquarium
bubble.y = aquarium.y + aquarium.height / 2 - 50; // Start from the bottom of the aquarium
game.addChild(bubble);
bubbles.push(bubble);
LK.getSound('spawnpuzir').play(); // Play sound when a bubble is created
}
};
// Function to grow the fish
self.grow = function () {
// fishGraphics.scaleX += 0.1;
// fishGraphics.scaleY += 0.1;
};
// Function to drop a coin
self.dropCoin = function () {
var coin = new Coin();
coin.x = self.x;
coin.y = self.y;
game.addChild(coin);
coins.push(coin);
};
});
// InterfacePanel class representing the interface panel
var InterfacePanel = Container.expand(function () {
var self = Container.call(this);
self.width = 2048;
self.height = 200;
self.y = 0;
self.x = 0;
self.color = 0x000000;
self.alpha = 0.5;
// Function to add a fish to the aquarium
self.addFish = function () {
var fish = new Fish();
var angle = Math.random() * Math.PI * 2;
var radius = Math.random() * 600;
fish.x = aquarium.x + radius * Math.cos(angle);
fish.y = aquarium.y + radius * Math.sin(angle);
fishes.push(fish);
game.addChild(fish);
};
// Event listener for adding fish
// Create a fish icon
var fishIcon = self.attachAsset('iconFish', {
anchorX: 0.5,
anchorY: 0.5,
x: 200,
y: 500,
alpha: 2
});
// Create a corm icon
var cormIcon = self.attachAsset('iconcorm', {
anchorX: 0.5,
anchorY: 0.5,
x: 450,
y: 500,
alpha: 2
});
// Event listener for corm icon
cormIcon.down = function (x, y, obj) {
tween(cormIcon, {
scaleX: 0.8,
scaleY: 0.8
}, {
duration: 100,
onFinish: function onFinish() {
tween(cormIcon, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
}
});
// Create and drop a new corm from the top
var corm = new Corm();
corm.x = Math.random() * (2048 - 500) + 200; // Random x position within 200 units from both edges
corm.y = 550; // Start from a slightly higher position
game.addChild(corm);
corms.push(corm);
};
// Event listener for adding fish
fishIcon.down = function (x, y, obj) {
self.addFish();
tween(fishIcon, {
scaleX: 0.8,
scaleY: 0.8
}, {
duration: 100,
onFinish: function onFinish() {
tween(fishIcon, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
}
});
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
//<Assets used in the game will automatically appear here>
// Initialize arrays and variables
var fishes = [];
var coins = [];
var corms = [];
var bubbles = [];
var lastFeedTime = 0;
// Create the aquarium
var aquarium = new Aquarium();
game.addChild(aquarium);
// Create the interface panel
var interfacePanel = new InterfacePanel();
game.addChild(interfacePanel);
// Game update function
game.update = function () {
// Update all coins
for (var j = 0; j < coins.length; j++) {
coins[j].update();
// Update all bubbles
for (var l = 0; l < bubbles.length; l++) {
bubbles[l].update();
}
}
;
// Update all corms
for (var k = 0; k < corms.length; k++) {
if (typeof corms[k].update === 'function') {
corms[k].update();
}
}
};
прозрачный пузырь воздуха. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Потрепаная рыбе
древняя Монетка, постэльные цвета. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Потрепаная рыба
сундук с сокровищами с видом спереди, постэльные цвета. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
предупреждение о нападении акул без надписей, постэльные цвета.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Морской Монстр, вид с боку, накаченные мышцы, постэльные цвета.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Большой прозрачный радужный пузырь. пастельные цвета Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
осьминог повар, минимализм, пастельные цвета \. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
spawnpuzir
Sound effect
Lop
Sound effect
click
Sound effect
clickkorm
Sound effect
Emy
Sound effect
MonetaSpawn
Sound effect
MonetaUp
Sound effect
Deadfish
Sound effect
rost
Sound effect
akulaspawn
Sound effect
ataka
Sound effect
emyakula
Sound effect
sundukup
Sound effect
Music
Music
music2
Music
udarbonus
Sound effect
udarbonus2
Sound effect
udarbonus3
Sound effect
startbonus
Sound effect
osmincorm
Sound effect