User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'expand')' in this line: 'var DistractingFish = Fish.expand(function () {' Line Number: 23
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'expand')' in this line: 'var InflatableFish = Fish.expand(function () {' Line Number: 1
User prompt
Improve the entire code with 10 new functionality
User prompt
Improve the entire code with 4 new functionality
User prompt
Improve the entire code with 4 new functionality
User prompt
Make fish move
User prompt
Fix Bug: 'Uncaught TypeError: aquarium.getWaterBounds is not a function' in this line: 'var waterBounds = aquarium.getWaterBounds();' Line Number: 1630
User prompt
Improve the entire code with 6new functionality
User prompt
Fix Bug: 'Uncaught ReferenceError: Food is not defined' in this line: 'var SpeedyFood = Food.expand(function () {' Line Number: 535
User prompt
Fix Bug: 'Uncaught ReferenceError: DecorativePlant is not defined' in this line: 'var GrowingPlant = DecorativePlant.expand(function () {' Line Number: 444
User prompt
Fix Bug: 'Uncaught ReferenceError: Bubble is not defined' in this line: 'var CapturingBubble = Bubble.expand(function () {' Line Number: 83
User prompt
Improve the entire code with 4 new functionality
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'expand')' in this line: 'var BubbleProducingFish = Fish.expand(function () {' Line Number: 107
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'expand')' in this line: 'var FoodSpawningFish = Fish.expand(function () {' Line Number: 67
User prompt
Improve the entire code with 6 new functionality
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'expand')' in this line: 'var IntelligentFish = Fish.expand(function () {' Line Number: 31
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'expand')' in this line: 'var TreasureChest = InteractiveElement.expand(function () {' Line Number: 1
User prompt
Improve the entire code with 4 new functionality
User prompt
Improve the entire code with 8 new functionality
User prompt
Improve the entire code with 4 new functionality
User prompt
Improve the entire code with 4 new functionality
User prompt
Make fish move 3 time slower
User prompt
Improve the entire code with 4 new functionality
User prompt
Improve the entire code with two new functionality
User prompt
Improve the entire code with two new functionality
===================================================================
--- original.js
+++ change.js
@@ -1,4 +1,127 @@
+var InflatableFish = Fish.expand(function () {
+ var self = Fish.call(this) || this;
+ self.inflationSize = 2;
+ self.inflationDuration = 3000;
+ self.isInflated = false;
+ self.inflate = function () {
+ if (!self.isInflated) {
+ self.isInflated = true;
+ self.scale.x *= self.inflationSize;
+ self.scale.y *= self.inflationSize;
+ LK.setTimeout(function () {
+ self.scale.x /= self.inflationSize;
+ self.scale.y /= self.inflationSize;
+ self.isInflated = false;
+ }, self.inflationDuration);
+ }
+ };
+ self.on('tick', function () {
+ self.inflate();
+ });
+ return self;
+});
+var DistractingFish = Fish.expand(function () {
+ var self = Fish.call(this) || this;
+ self.distractRange = 200;
+ self.distractPredators = function () {
+ var predators = self.getNearbyFish().filter(function (fish) {
+ return fish.size > self.size;
+ });
+ predators.forEach(function (predator) {
+ if (self.distanceTo(predator) < self.distractRange) {
+ predator.targetRotation = Math.atan2(self.y - predator.y, self.x - predator.x);
+ }
+ });
+ };
+ self.on('tick', function () {
+ self.distractPredators();
+ });
+ return self;
+});
+var CleanerFish = Fish.expand(function () {
+ var self = Fish.call(this) || this;
+ self.cleaningRate = 0.2;
+ self.eatAlgae = function () {
+ var algae = self.getNearbyObjects().filter(function (obj) {
+ return obj instanceof Algae;
+ });
+ algae.forEach(function (algae) {
+ if (self.distanceTo(algae) < 50) {
+ algae.consume(self);
+ }
+ });
+ };
+ self.on('tick', function () {
+ self.eatAlgae();
+ });
+ return self;
+});
+var SchoolLeaderFish = Fish.expand(function () {
+ var self = Fish.call(this) || this;
+ self.schoolingRange = 300;
+ self.attractFishToSchool = function () {
+ var nearbyFish = self.getNearbyFishWithinRange(self.schoolingRange);
+ nearbyFish.forEach(function (fish) {
+ if (fish.constructor !== SchoolLeaderFish) {
+ fish.targetRotation = Math.atan2(self.y - fish.y, self.x - fish.x);
+ }
+ });
+ };
+ self.on('tick', function () {
+ self.attractFishToSchool();
+ });
+ return self;
+});
+var StealthFish = Fish.expand(function () {
+ var self = Fish.call(this) || this;
+ self.stealthMode = false;
+ self.stealthDuration = 5000;
+ self.toggleStealthMode = function () {
+ self.stealthMode = !self.stealthMode;
+ self.alpha = self.stealthMode ? 0.1 : 1.0;
+ };
+ LK.setInterval(self.toggleStealthMode, self.stealthDuration);
+ return self;
+});
+var JumpingFish = Fish.expand(function () {
+ var self = Fish.call(this) || this;
+ self.jumpHeight = 150;
+ self.jumpFrequency = 10000;
+ self.isJumping = false;
+ self.jump = function () {
+ if (!self.isJumping) {
+ self.isJumping = true;
+ var initialY = self.y;
+ LK.setTimeout(function () {
+ self.y = initialY - self.jumpHeight;
+ LK.setTimeout(function () {
+ self.y = initialY;
+ self.isJumping = false;
+ }, 1000);
+ }, self.jumpFrequency);
+ }
+ };
+ self.on('tick', function () {
+ self.jump();
+ });
+ return self;
+});
+var BubbleShieldFish = Fish.expand(function () {
+ var self = Fish.call(this) || this;
+ self.shieldBubbleRate = 5000;
+ self.shieldBubbleSize = 100;
+ self.createShieldBubble = function () {
+ var bubble = new Bubble();
+ bubble.x = self.x;
+ bubble.y = self.y;
+ bubble.width = self.shieldBubbleSize;
+ bubble.height = self.shieldBubbleSize;
+ LK.stageContainer.addChild(bubble);
+ };
+ LK.setInterval(self.createShieldBubble, self.shieldBubbleRate);
+ return self;
+});
var DecorativePlant = Container.expand(function () {
var self = Container.call(this);
return self;
});
@@ -498,15 +621,15 @@
return self;
});
var HealingFish = Fish.expand(function () {
var self = Fish.call(this) || this;
- self.healingRate = 0.1;
- self.healingRange = 100;
+ self.healingRate = 0.05;
+ self.healingRange = 150;
self.healNearbyFish = function () {
var nearbyFish = self.getNearbyFishWithinRange(self.healingRange);
nearbyFish.forEach(function (fish) {
if (fish.health < 100) {
- fish.health = Math.min(fish.health + self.healingRate, 100);
+ fish.health += self.healingRate;
}
});
};
self.on('tick', function () {
@@ -1637,23 +1760,30 @@
};
});
var CamouflageFish = Fish.expand(function () {
var self = Fish.call(this) || this;
- self.hide = function () {
- var predators = self.getNearbyPredators();
- if (predators.length > 0) {
- self.alpha = 0.3;
- } else {
- self.alpha = 1.0;
+ self.colorChangeRate = 0.1;
+ self.colorChangeThreshold = 200;
+ self.currentEnvironmentColor = 0xFFFFFF;
+ self.changeColorBasedOnEnvironment = function () {
+ var environmentObjects = self.getNearbyObjects().filter(function (obj) {
+ return obj instanceof DecorativePlant || obj instanceof Algae;
+ });
+ if (environmentObjects.length > 0) {
+ var closestEnvironmentObject = environmentObjects[0];
+ for (var i = 1; i < environmentObjects.length; i++) {
+ if (self.distanceTo(environmentObjects[i]) < self.distanceTo(closestEnvironmentObject)) {
+ closestEnvironmentObject = environmentObjects[i];
+ }
+ }
+ if (self.distanceTo(closestEnvironmentObject) < self.colorChangeThreshold) {
+ self.currentEnvironmentColor = closestEnvironmentObject.color;
+ }
}
+ self.tint = self.currentEnvironmentColor;
};
- self.getNearbyPredators = function () {
- return self.getNearbyFish().filter(function (otherFish) {
- return otherFish.size > self.size && self.distanceTo(otherFish) < 200;
- });
- };
self.on('tick', function () {
- self.hide();
+ self.changeColorBasedOnEnvironment();
});
return self;
});
var FishManager = Container.expand(function () {
@@ -1693,15 +1823,15 @@
return self;
});
var MentorFish = Fish.expand(function () {
var self = Fish.call(this) || this;
- self.intelligenceBoostRate = 1;
- self.boostRange = 200;
+ self.intelligenceBoostRate = 0.5;
+ self.boostRange = 250;
self.boostIntelligence = function () {
var nearbyFish = self.getNearbyFishWithinRange(self.boostRange);
nearbyFish.forEach(function (fish) {
if (!(fish instanceof MentorFish)) {
- fish.intelligenceLevel = Math.min(fish.intelligenceLevel + self.intelligenceBoostRate, 100);
+ fish.intelligenceLevel += self.intelligenceBoostRate;
}
});
};
self.on('tick', function () {
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.