User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < self.fishes.length; i++) {' Line Number: 145
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < self.fishes.length; i++) {' Line Number: 145
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < self.fishes.length; i++) {' Line Number: 145
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < this.fishes.length; i++) {' Line Number: 145
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < this.fishes.length; i++) {' Line Number: 1311
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in this line: 'for (var i = 0; i < this.fishes.length; i++) {' Line Number: 1311
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'push')' in this line: 'this.fishes.push(fish);' Line Number: 1305
User prompt
Fix Bug: 'Uncaught ReferenceError: fishes is not defined' in this line: 'fishes.push(fish);' Line Number: 1305
User prompt
Fix Bug: 'ReferenceError: fishes is not defined' in this line: 'for (var i = 0; i < fishes.length; i++) {' Line Number: 145
User prompt
Fix Bug: 'ReferenceError: fishes is not defined' in this line: 'for (var i = 0; i < fishes.length; i++) {' Line Number: 145
User prompt
Fix Bug: 'ReferenceError: fishes is not defined' in this line: 'for (var i = 0; i < fishes.length; i++) {' Line Number: 145
User prompt
Spawn one of each race
User prompt
Fix Bug: 'Uncaught timeout callback must be a function' in this line: 'var bubbleSpawnTimer = LK.setInterval(self.spawnBubble, 2000);' Line Number: 1277
User prompt
Add 10 new functionality
User prompt
add 10 new functionality
User prompt
spawn only one fish
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'call')' in this line: 'Fish.prototype.move.call(this);' Line Number: 188
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'call')' in this line: 'Fish.prototype.move.call(this);' Line Number: 188
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'call')' in this line: 'Fish.prototype.move.call(this);' Line Number: 188
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'call')' in this line: 'Fish.prototype.move.call(this);' Line Number: 188
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'call')' in this line: 'Fish.prototype.move.call(this);' Line Number: 188
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'call')' in this line: 'Fish.prototype.move.call(this);' Line Number: 188
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'call')' in this line: 'Fish.prototype.move.call(this);' Line Number: 188
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'call')' in this line: 'Fish.prototype.move.call(this);' Line Number: 188
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'call')' in this line: 'Fish.prototype.move.call(this);' Line Number: 188
===================================================================
--- original.js
+++ change.js
@@ -7,13 +7,16 @@
self.targetRotation = Math.random() * Math.PI * 2;
}
var progress = (LK.ticks - self.directionChangeTime) / self.directionChangeInterval;
if (progress < 1) {
- self.rotation += (self.targetRotation - self.rotation) * progress;
+ var rotationDifference = Math.abs(self.targetRotation - self.rotation);
+ var inertiaMultiplier = rotationDifference > Math.PI / 2 ? 0.5 : 1;
+ self.rotation += (self.targetRotation - self.rotation) * progress * inertiaMultiplier;
} else {
self.rotation = self.targetRotation;
}
- var tentativeX = self.x + Math.cos(self.rotation) * self.speed;
+ var speedMultiplier = Math.random() < 0.1 ? 2 : 1;
+ var tentativeX = self.x + Math.cos(self.rotation) * self.speed * speedMultiplier;
var tentativeY = self.y + Math.sin(self.rotation) * self.speed;
var waterBounds = self.getWaterBounds();
tentativeX = Math.max(waterBounds.left + 50, Math.min(tentativeX, waterBounds.right - 50));
tentativeY = Math.max(waterBounds.top + 50, Math.min(tentativeY, waterBounds.bottom - 50));
@@ -22,18 +25,80 @@
self.y = tentativeY;
} else {
self.avoidObstacles(self.getNearbyObstacles());
}
+ var nearbyFish = self.getNearbyObstacles();
+ var alignmentRotation = 0;
+ var alignmentCount = 0;
+ for (var i = 0; i < nearbyFish.length; i++) {
+ var fish = nearbyFish[i];
+ var dx = self.x - fish.x;
+ var dy = self.y - fish.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance < 200) {
+ alignmentRotation += fish.rotation;
+ alignmentCount++;
+ }
+ }
+ if (alignmentCount > 0) {
+ alignmentRotation /= alignmentCount;
+ self.rotation = (self.rotation + alignmentRotation) / 2;
+ }
+ if (Math.random() < 0.02) {
+ self.speed *= 0.5;
+ }
self.rotation = self.rotation % (Math.PI * 2);
+ if (Math.random() < 0.005) {
+ LK.effects.splash(self.x, self.y, 0x1CA3EC, 500);
+ }
+ var isFishClose = self.getNearbyObstacles().some(function (obstacle) {
+ var dx = self.x - obstacle.x;
+ var dy = self.y - obstacle.y;
+ return Math.sqrt(dx * dx + dy * dy) < 150;
+ });
+ if (isFishClose) {
+ fishGraphics.tint = 0x88FFFF;
+ } else {
+ fishGraphics.tint = 0xFFFFFF;
+ }
fishGraphics.scale.x = Math.cos(self.rotation) < 0 ? -1 : 1;
+ if (Math.random() < 0.01) {
+ fishGraphics.blink();
+ }
fishGraphics.rotation = self.rotation;
};
- self.avoidObstacles = function (obstacles) {};
+ self.avoidObstacles = function (obstacles) {
+ for (var i = 0; i < obstacles.length; i++) {
+ var obstacle = obstacles[i];
+ var dx = self.x - obstacle.x;
+ var dy = self.y - obstacle.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance < 100) {
+ self.targetRotation = Math.atan2(dy, dx) + Math.PI;
+ break;
+ }
+ }
+ };
self.isPathBlocked = function (newX, newY, obstacles) {
+ for (var i = 0; i < obstacles.length; i++) {
+ var obstacle = obstacles[i];
+ var dx = newX - obstacle.x;
+ var dy = newY - obstacle.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance < 50) {
+ return true;
+ }
+ }
return false;
};
self.getNearbyObstacles = function () {
- return [];
+ var nearbyObstacles = [];
+ for (var i = 0; i < fishes.length; i++) {
+ if (fishes[i] !== self) {
+ nearbyObstacles.push(fishes[i]);
+ }
+ }
+ return nearbyObstacles;
};
this.getWaterBounds = function () {
var waterGraphics = LK.getAsset('water', 'Water Graphics', 0, 0);
return {
An aquarium with no fish on a sheel in a photorealistic style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A realistic goldfish. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A realistic Angelfish. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A realistic koyfish swiming to the right. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A realistic gupyfish swiming to the right. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A realistic bettafish swiming to the right. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A realistic clownfish swiming to the right. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A realistic pufferfish swiming to the right. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A realistic surgeonfish swiming to the right. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A realistic buble of water. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A realistic fish egg. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A realistic celestial pearl danio. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A realistic Parrotfish. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A realistic dartfish. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A realistic moorishidol. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A realistic tangfish. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A realistic bannerfish. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A realistic butterflyfish. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A realistic mandarinfish. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a realistic lionfish. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a realistic emperorFish. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a realistic sunfish. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a realistic discusFish. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a realistic neonTetra. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a realistic oscarFish. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a cardinal tetra. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a tang fish. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a clown fish. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.