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
@@ -396,11 +396,12 @@
});
var HealingPlant = Container.expand(function () {
var self = Container.call(this);
var plantGraphics = self.createAsset('healingPlant', 'Healing Plant Graphics', 0.5, 1);
- self.healingRate = 0.05;
+ self.healingRate = 0.1;
+ self.healingRange = 100;
self.on('tick', function () {
- var nearbyFish = self.getNearbyFishWithinRange(50);
+ var nearbyFish = self.getNearbyFishWithinRange(self.healingRange);
nearbyFish.forEach(function (fish) {
if (fish.health < 100) {
fish.health = Math.min(fish.health + self.healingRate, 100);
}
@@ -411,20 +412,42 @@
var TreasureChest = InteractiveElement.expand(function () {
var self = InteractiveElement.call(this) || this;
var chestGraphics = self.createAsset('treasureChest', 'Treasure Chest Graphics', 0.5, 0.5);
self.isOpen = false;
+ self.coinReleaseRate = 3;
+ self.releaseCoins = function () {
+ if (self.isOpen) {
+ for (var i = 0; i < self.coinReleaseRate; i++) {
+ var coin = new Coin();
+ coin.x = self.x;
+ coin.y = self.y;
+ LK.stageContainer.addChild(coin);
+ }
+ }
+ };
self.interact = function () {
self.isOpen = !self.isOpen;
chestGraphics.texture = LK.getAsset(self.isOpen ? 'chestOpen' : 'chestClosed', 'Chest Graphics', 0.5, 0.5).texture;
- if (self.isOpen) {
- var bubble = new Bubble();
- bubble.x = self.x;
- bubble.y = self.y;
- LK.stageContainer.addChild(bubble);
- }
+ self.releaseCoins();
};
LK.setInterval(self.performInteraction, 10000);
+ return self;
});
+var Coin = Container.expand(function () {
+ var self = Container.call(this);
+ var coinGraphics = self.createAsset('coin', 'Coin Graphics', 0.5, 0.5);
+ self.value = 1;
+ self.collect = function (fish) {
+ if (self.intersects(fish)) {
+ LK.setScore(LK.getScore() + self.value);
+ self.destroy();
+ }
+ };
+ self.on('tick', function () {
+ self.collect(fish);
+ });
+ return self;
+});
var Algae = Container.expand(function () {
var self = Container.call(this);
var algaeGraphics = self.createAsset('algae', 'Algae Graphics', 0.5, 1);
self.growthRate = 0.01;
@@ -581,25 +604,31 @@
});
var PredatorFish = Fish.expand(function () {
var self = Fish.call(this);
self.predatorGraphics = self.createAsset('predatorFish', 'Predator Fish Graphics', 0.5, 0.5);
- self.speed = 2;
- self.huntRange = 200;
- self.on('tick', function () {
+ self.speed = 3;
+ self.huntRange = 300;
+ self.hunt = function () {
var nearbyPrey = self.getNearbyFish().filter(function (fish) {
return fish.size < self.size && fish.health > 0;
});
if (nearbyPrey.length > 0) {
var prey = nearbyPrey[0];
+ for (var i = 1; i < nearbyPrey.length; i++) {
+ if (self.distanceTo(nearbyPrey[i]) < self.distanceTo(prey)) {
+ prey = nearbyPrey[i];
+ }
+ }
if (self.distanceTo(prey) < self.huntRange) {
self.targetRotation = Math.atan2(prey.y - self.y, prey.x - self.x);
- prey.health -= 1;
+ prey.health -= 2;
if (prey.health <= 0) {
prey.destroy();
}
}
}
- });
+ };
+ self.on('tick', self.hunt);
return self;
});
var RestingBehavior = Container.expand(function () {
var self = Container.call(this);
@@ -1542,14 +1571,14 @@
}
return fishes;
};
});
-var IntelligentFish = Fish.expand(function () {
+var SmartFish = Fish.expand(function () {
var self = Fish.call(this) || this;
- self.intelligenceLevel = 5;
+ self.intelligenceLevel = 10;
self.avoidPredators = function () {
var predators = self.getNearbyFish().filter(function (otherFish) {
- return otherFish.size > self.size && self.distanceTo(otherFish) < 200;
+ return otherFish.size > self.size && self.distanceTo(otherFish) < 300;
});
if (predators.length > 0) {
var escapeVector = {
x: 0,
@@ -1567,11 +1596,14 @@
var foodSources = self.getNearbyObjects().filter(function (obj) {
return obj instanceof Food;
});
if (foodSources.length > 0) {
- var closestFood = foodSources.reduce(function (closest, food) {
- return self.distanceTo(food) < self.distanceTo(closest) ? food : closest;
- }, foodSources[0]);
+ var closestFood = foodSources[0];
+ for (var i = 1; i < foodSources.length; i++) {
+ if (self.distanceTo(foodSources[i]) < self.distanceTo(closestFood)) {
+ closestFood = foodSources[i];
+ }
+ }
self.targetRotation = Math.atan2(closestFood.y - self.y, closestFood.x - self.x);
}
};
return self;
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.