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
@@ -1,4 +1,54 @@
+var DecorativePlant = Container.expand(function () {
+ var self = Container.call(this);
+ var plantGraphics = self.createAsset('decorativePlant', 'Decorative Plant Graphics', .5, 1);
+ var swayDirection = 1;
+ self.sway = function () {
+ plantGraphics.rotation += swayDirection * 0.01;
+ if (Math.abs(plantGraphics.rotation) > 0.2) {
+ swayDirection *= -1;
+ }
+ };
+});
+var TreasureChest = Container.expand(function () {
+ var self = Container.call(this);
+ var chestClosedGraphics = self.createAsset('chestClosed', 'Closed Chest Graphics', .5, .5);
+ var chestOpenGraphics = self.createAsset('chestOpen', 'Open Chest Graphics', .5, .5);
+ chestOpenGraphics.visible = false;
+ var isOpen = false;
+ self.toggleChest = function () {
+ isOpen = !isOpen;
+ chestClosedGraphics.visible = !isOpen;
+ chestOpenGraphics.visible = isOpen;
+ };
+ LK.setInterval(self.toggleChest, 5000);
+});
+var FishFood = Container.expand(function () {
+ var self = Container.call(this);
+ var foodGraphics = self.createAsset('fishFood', 'Fish Food Graphics', .5, .5);
+ self.speed = 1;
+ self.move = function () {
+ self.y += self.speed;
+ if (self.y > 2732) {
+ self.destroy();
+ }
+ };
+});
+var Bubble = Container.expand(function () {
+ var self = Container.call(this);
+ var bubbleGraphics = self.createAsset('bubble', 'Bubble Graphics', .5, .5);
+ self.speed = -0.5;
+ self.move = function () {
+ self.y += self.speed;
+ if (self.y < -50) {
+ self.destroy();
+ }
+ };
+ bubbleGraphics.on('down', function () {
+ LK.effects.flashObject(self, 0xFFFFFF, 300);
+ self.destroy();
+ });
+});
var Fish = Container.expand(function () {
var self = Container.call(this);
self.move = function () {
if (!self.directionChangeTime || LK.ticks - self.directionChangeTime > self.directionChangeInterval) {
@@ -1186,8 +1236,52 @@
};
});
var Game = Container.expand(function () {
var self = Container.call(this);
+ self.updateElements = function () {
+ var children = self.children.slice();
+ for (var i = 0; i < children.length; i++) {
+ if (children[i] instanceof Bubble || children[i] instanceof FishFood) {
+ children[i].move();
+ }
+ if (children[i] instanceof DecorativePlant) {
+ children[i].sway();
+ }
+ }
+ };
+ LK.on('tick', self.updateElements);
+ for (var i = 0; i < 5; i++) {
+ var plant = new DecorativePlant();
+ plant.x = i * (2048 / 5);
+ plant.y = 2732 - 50;
+ self.addChild(plant);
+ }
+ var treasureChest = new TreasureChest();
+ treasureChest.x = 2048 / 2;
+ treasureChest.y = 2732 - 100;
+ self.addChild(treasureChest);
+ var feedButton = new Text2('Feed Fish', {
+ size: 100,
+ fill: '#ffffff'
+ });
+ feedButton.anchor.set(.5, 0);
+ feedButton.x = 2048 / 2;
+ feedButton.y = 50;
+ LK.gui.topCenter.addChild(feedButton);
+ feedButton.on('down', self.feedFish);
+ self.feedFish = function () {
+ var food = new FishFood();
+ food.x = 2048 / 2;
+ food.y = 0;
+ self.addChild(food);
+ };
+ var bubbleSpawnTimer = LK.setInterval(self.spawnBubble, 2000);
+ self.spawnBubble = function () {
+ var bubble = new Bubble();
+ bubble.x = Math.random() * 2048;
+ bubble.y = 2732;
+ self.addChild(bubble);
+ };
var aquarium = self.addChild(new Aquarium());
LK.stageContainer.setBackgroundColor(0x008080);
var fishes = [];
var fishTypes = [Wrasses, Parrotfish, Dartfish, MoorishIdol, Tangfish, Bannerfish, Butterflyfish, Mandarinfish, Lionfish, Surgeonfish, Pufferfish, Clownfish, Angelfish, KoiFish, EmperorFish, Goldfish, Sunfish, GuppyFish, BettaFish, DiscusFish, NeonTetra, OscarFish, PsychedelicFrogfish, FlameScallop, RibbonEel, LeafySeaDragon, ClownTriggerfish, ElectricBlueDamsel, YellowTang, FlameHawkfish, RoyalGramma, FlameAngel, BlueTang, Moonfish, Starfish, CardinalTetra];
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.