User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var fishGraphics = self.createAsset('clownFish', 'Clown Fish Graphics', .5, .5);' Line Number: 72
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var fishGraphics = self.createAsset('clownFish', 'Clown Fish Graphics', .5, .5);' Line Number: 72
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var fishGraphics = self.createAsset('clownFish', 'Clown Fish Graphics', .5, .5);' Line Number: 72
User prompt
Fix Bug: 'TypeError: fishes[i].move is not a function' in this line: 'fishes[i].move();' Line Number: 146
User prompt
Fix Bug: 'TypeError: fishes[i].move is not a function' in this line: 'fishes[i].move();' Line Number: 146
User prompt
Fix Bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'speed')' in this line: 'self.speed = 0.75;' Line Number: 83
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var fishGraphics = self.createAsset('angelFish', 'Angel Fish Graphics', .5, .5);' Line Number: 82
User prompt
Fix Bug: 'TypeError: fishes[i].move is not a function' in this line: 'fishes[i].move();' Line Number: 146
User prompt
Fix Bug: 'Uncaught TypeError: fish.setType is not a function' in this line: 'fish.setType(fishTypes[i]);' Line Number: 109
User prompt
Fix Bug: 'Uncaught TypeError: fish.setType is not a function' in this line: 'self.speed = 0.75;' Line Number: 92
User prompt
Fix Bug: 'Uncaught TypeError: fish.setType is not a function' in this line: 'fish.setType(fishTypes[i]);' Line Number: 109
User prompt
Fix Bug: 'ReferenceError: fishGraphics is not defined' in this line: 'fishGraphics.scale.x = 1;' Line Number: 67
User prompt
Fix Bug: 'TypeError: fishes[i].move is not a function' in this line: 'fishes[i].move();' Line Number: 113
User prompt
Fix Bug: 'TypeError: fishes[i].move is not a function' in this line: 'fishes[i].move();' Line Number: 113
User prompt
Fix Bug: 'TypeError: fishes[i].move is not a function' in this line: 'fishes[i].move();' Line Number: 113
User prompt
Fix Bug: 'TypeError: fishes[i].move is not a function' in this line: 'fishes[i].move();' Line Number: 113
User prompt
Fix Bug: 'TypeError: fishes[i].move is not a function' in this line: 'fishes[i].move();' Line Number: 113
User prompt
Fix Bug: 'TypeError: fishes[i].move is not a function' in this line: 'fishes[i].move();' Line Number: 113
User prompt
Fix Bug: 'TypeError: fishes[i].move is not a function' in this line: 'fishes[i].move();' Line Number: 113
User prompt
Fix Bug: 'TypeError: fishes[i].move is not a function' in this line: 'fishes[i].move();' Line Number: 146
User prompt
Fix Bug: 'TypeError: fishes[i].move is not a function' in this line: 'fishes[i].move();' Line Number: 146
User prompt
add 2 new fish race and spawn 2 of each race of fish at begining
User prompt
add one new race of fish
User prompt
improve fish AI
User prompt
make water totaly transparent
===================================================================
--- original.js
+++ change.js
@@ -66,22 +66,61 @@
}
fishGraphics.rotation = self.rotation;
};
});
-var ClownFish = Fish.expand(function () {
- var self = Fish.call(this);
+var ClownFish = Container.expand(function () {
+ var self = Container.call(this);
var fishGraphics = self.createAsset('clownFish', 'Clown Fish Graphics', .5, .5);
self.speed = 0.5;
});
-var TangFish = Fish.expand(function () {
- var self = Fish.call(this);
+var TangFish = Container.expand(function () {
+ var self = Container.call(this);
var fishGraphics = self.createAsset('tangFish', 'Tang Fish Graphics', .5, .5);
self.speed = 0.65;
});
-var AngelFish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+var AngelFish = Container.expand(function () {
+ var self = Container.call(this);
+ self.getWaterBounds = function () {
+ var waterGraphics = LK.getAsset('water', 'Water Graphics', 0, 0);
+ return {
+ left: (2048 - waterGraphics.width) / 2,
+ right: (2048 + waterGraphics.width) / 2,
+ top: (2732 - waterGraphics.height) / 2 - 150,
+ bottom: (2732 + waterGraphics.height) / 2 - 150
+ };
+ };
var fishGraphics = self.createAsset('angelFish', 'Angel Fish Graphics', .5, .5);
self.speed = 0.75;
+ self.move = function () {
+ if (self.targetRotation === undefined || LK.ticks - self.rotationStartTime >= self.rotationDuration) {
+ self.targetRotation = Math.random() * Math.PI * 2;
+ self.rotationStartTime = LK.ticks;
+ self.rotationDuration = Math.random() * 180 + 90;
+ }
+ var progress = (LK.ticks - self.rotationStartTime) / self.rotationDuration;
+ if (progress < 1) {
+ var deltaRotation = (self.targetRotation - self.rotation) * progress;
+ self.rotation += deltaRotation;
+ } else {
+ self.rotation = self.targetRotation;
+ }
+ self.x += Math.cos(self.rotation) * self.speed;
+ self.y += Math.sin(self.rotation) * self.speed;
+ var waterBounds = self.getWaterBounds();
+ if (self.x < waterBounds.left || self.x > waterBounds.right) {
+ self.rotation = Math.PI - self.rotation;
+ }
+ if (self.y < waterBounds.top || self.y > waterBounds.bottom) {
+ self.rotation = -self.rotation;
+ }
+ self.rotation = self.rotation % (Math.PI * 2);
+ if (Math.cos(self.rotation) < 0) {
+ fishGraphics.scale.x = -1;
+ } else {
+ fishGraphics.scale.x = 1;
+ }
+ fishGraphics.rotation = self.rotation;
+ };
});
var Game = Container.expand(function () {
var self = Container.call(this);
var aquarium = self.addChild(new Aquarium());
@@ -90,17 +129,19 @@
var fishTypes = [Fish, AngelFish, ClownFish, TangFish];
for (var i = 0; i < fishTypes.length; i++) {
for (var j = 0; j < 2; j++) {
var fish = new fishTypes[i]();
- var centerX = 2048 / 2;
- var centerY = 2732 / 2;
- var maxDistance = 600;
- var angle = Math.random() * Math.PI * 2;
- var distance = Math.random() * maxDistance;
- fish.x = centerX + distance * Math.cos(angle);
- fish.y = centerY + distance * Math.sin(angle);
- fishes.push(fish);
- self.addChild(fish);
+ if (typeof fish.move === 'function') {
+ var centerX = 2048 / 2;
+ var centerY = 2732 / 2;
+ var maxDistance = 600;
+ var angle = Math.random() * Math.PI * 2;
+ var distance = Math.random() * maxDistance;
+ fish.x = centerX + distance * Math.cos(angle);
+ fish.y = centerY + distance * Math.sin(angle);
+ fishes.push(fish);
+ self.addChild(fish);
+ }
}
}
LK.on('tick', function () {
for (var i = 0; i < fishes.length; i++) {
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.