User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'attachAsset')' in or related to this line: 'var fishGraphics = self.attachAsset('zebraDanio', {' Line Number: 116
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'attachAsset')' in or related to this line: 'var fishGraphics = self.attachAsset('zebraDanio', {' Line Number: 111
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'attachAsset')' in or related to this line: 'var fishGraphics = self.attachAsset('zebraDanio', {' Line Number: 106
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'attachAsset')' in or related to this line: 'var fishGraphics = self.attachAsset('zebraDanio', {' Line Number: 109
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'attachAsset')' in or related to this line: 'self.fishGraphics = self.attachAsset('zebraDanio', {' Line Number: 106
User prompt
Migrate to the latest version of LK
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'attachAsset')' in or related to this line: 'var fishGraphics = self.attachAsset('zebraDanio', {' Line Number: 106
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'attachAsset')' in or related to this line: 'self.fishGraphics = self.attachAsset('zebraDanio', {' Line Number: 106
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'attachAsset')' in or related to this line: 'var fishGraphics = self.attachAsset('zebraDanio', {' Line Number: 106
User prompt
Migrate to the latest version of LK
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var fishGraphics = self.createAsset('zebraDanio', 'Zebra Danio Graphics', .5, .5);' Line Number: 25
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'self.fishGraphics = self.createAsset('zebraDanio', 'Zebra Danio Graphics', .5, .5);' Line Number: 25
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'self.fishGraphics = self.createAsset('zebraDanio', 'Zebra Danio Graphics', .5, .5);' Line Number: 25
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'self.fishGraphics = self.createAsset('zebraDanio', 'Zebra Danio Graphics', .5, .5);' Line Number: 52
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var fishGraphics = self.createAsset('zebraDanio', 'Zebra Danio Graphics', .5, .5);' Line Number: 169
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'self.fishGraphics = self.createAsset('zebraDanio', 'Zebra Danio Graphics', .5, .5);' Line Number: 169
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var fishGraphics = self.createAsset('zebraDanio', 'Zebra Danio Graphics', .5, .5);' Line Number: 169
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var fishGraphics = self.createAsset('zebraDanio', 'Zebra Danio Graphics', .5, .5);' Line Number: 168
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var fishGraphics = self.createAsset('zebraDanio', 'Zebra Danio Graphics', .5, .5);' Line Number: 168
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'createAsset')' in this line: 'var fishGraphics = self.createAsset('zebraDanio', 'Zebra Danio Graphics', .5, .5);' Line Number: 168
User prompt
Improve the fluidity
User prompt
Make décoration 600 pixel up
User prompt
Move the décoration in the aquarium
User prompt
Fix Bug: 'Uncaught ReferenceError: aquarium is not defined' in this line: 'var waterBounds = aquarium.getWaterBounds();' Line Number: 1351
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'getWaterBounds')' in this line: 'var waterBounds = self.aquarium.getWaterBounds();' Line Number: 1255
===================================================================
--- original.js
+++ change.js
@@ -1,4 +1,7 @@
+/****
+* Classes
+****/
var DecorativePlant = Container.expand(function () {
var self = Container.call(this);
var plantGraphics = self.createAsset('decorativePlant', 'Decorative Plant Graphics', .5, 1);
var swayDirection = 1;
@@ -9,9 +12,11 @@
}
};
self.move = function () {
self.x += 1;
- if (self.x > 2048) self.x = 0;
+ if (self.x > 2048) {
+ self.x = 0;
+ }
};
});
var TreasureChest = Container.expand(function () {
var self = Container.call(this);
@@ -158,10 +163,11 @@
};
};
});
var ZebraDanio = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('zebraDanio', 'Zebra Danio Graphics', .5, .5);
+ var fishGraphics = self.createAsset('zebraDanio', 'Zebra Danio Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.4;
self.move = function () {
if (!self.directionChangeTime || LK.ticks - self.directionChangeTime > self.directionChangeInterval) {
@@ -219,9 +225,9 @@
fishGraphics.rotation = self.rotation;
};
});
var CelestialPearlDanio = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('celestialPearlDanio', 'Celestial Pearl Danio Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = (Math.random() * 0.2 + 0.35) * 2;
self.move = function () {
@@ -266,9 +272,9 @@
fishGraphics.rotation = self.rotation;
};
});
var Wrasses = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('wrasses', 'Wrasses Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.42;
self.move = function () {
@@ -293,67 +299,67 @@
fishGraphics.rotation = self.rotation;
};
});
var Parrotfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('parrotfish', 'Parrotfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.50;
self.move = function () {};
});
var Dartfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('dartfish', 'Dartfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.45;
self.move = function () {};
});
var MoorishIdol = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('moorishidol', 'Moorish Idol Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.43;
self.move = function () {};
});
var Tangfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('tangfish', 'Tangfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.47;
self.move = function () {};
});
var Bannerfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('bannerfish', 'Bannerfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.46;
self.move = function () {};
});
var Butterflyfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('butterflyfish', 'Butterflyfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.45;
self.move = function () {};
});
var Mandarinfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('mandarinfish', 'Mandarinfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = (Math.random() * 0.2 + 0.4) * 2;
self.move = function () {};
});
var Lionfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('lionfish', 'Lionfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.5;
self.move = function () {
fishGraphics.rotation = self.rotation;
};
});
var Surgeonfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('surgeonfish', 'Surgeonfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = (Math.random() * 0.2 + 0.5) * 2 * 2 * 2;
self.move = function () {
@@ -388,9 +394,9 @@
fishGraphics.rotation = self.rotation;
};
});
var Pufferfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('pufferfish', 'Pufferfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = (Math.random() * 0.2 + 0.4) * 2 * 2;
self.move = function () {
@@ -424,9 +430,9 @@
fishGraphics.rotation = self.rotation;
};
});
var Clownfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('clownfish', 'Clownfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = (Math.random() * 0.2 + 0.4) * 2;
self.move = function () {
@@ -459,9 +465,9 @@
fishGraphics.rotation = self.rotation;
};
});
var Angelfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('angelfish', 'Angelfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.45;
self.move = function () {
@@ -514,9 +520,9 @@
waterGraphics.alpha = 0.3;
self.addChild(waterGraphics);
});
var KoiFish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('koiFish', 'Koi Fish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = (Math.random() * 0.2 + 0.48) * 2;
self.move = function () {
@@ -550,16 +556,16 @@
fishGraphics.rotation = self.rotation;
};
});
var EmperorFish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('emperorFish', 'Emperor Fish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.5;
self.move = function () {};
});
var Goldfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('goldfish', 'Goldfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = (Math.random() * 0.2 + 0.4) * 2 * 2;
self.move = function () {
@@ -593,9 +599,9 @@
fishGraphics.rotation = self.rotation;
};
});
var Sunfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('sunfish', 'Sunfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.6;
self.move = function () {
@@ -624,9 +630,9 @@
fishGraphics.rotation = self.rotation;
};
});
var GuppyFish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('guppyFish', 'Guppy Fish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = (Math.random() * 0.2 + 0.35) * 2 * 2;
self.move = function () {
@@ -660,9 +666,9 @@
fishGraphics.rotation = self.rotation;
};
});
var BettaFish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('bettaFish', 'Betta Fish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.5;
self.move = function () {
@@ -696,9 +702,9 @@
fishGraphics.rotation = self.rotation;
};
});
var DiscusFish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('discusFish', 'Discus Fish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = (Math.random() * 0.2 + 0.45) * 2;
self.move = function () {
@@ -732,9 +738,9 @@
fishGraphics.rotation = self.rotation;
};
});
var NeonTetra = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('neonTetra', 'Neon Tetra Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.3;
self.move = function () {
@@ -768,9 +774,9 @@
fishGraphics.rotation = self.rotation;
};
});
var OscarFish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('oscarFish', 'Oscar Fish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.5;
self.move = function () {
@@ -804,9 +810,9 @@
fishGraphics.rotation = self.rotation;
};
});
var ElectricCatfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('electricCatfish', 'Electric Catfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.58;
self.move = function () {
@@ -835,9 +841,9 @@
fishGraphics.rotation = self.rotation;
};
});
var RainbowTrout = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('rainbowTrout', 'Rainbow Trout Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.53;
self.move = function () {
@@ -866,65 +872,65 @@
fishGraphics.rotation = self.rotation;
};
});
var PsychedelicFrogfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('psychedelicFrogfish', 'Psychedelic Frogfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = (Math.random() * 0.2 + 0.4) * 2 * 2;
self.move = function () {};
});
var FlameScallop = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('flameScallop', 'Flame Scallop Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.3;
self.move = function () {};
});
var RibbonEel = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('ribbonEel', 'Ribbon Eel Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = (Math.random() * 0.2 + 0.6) * 2;
self.move = function () {};
});
var LeafySeaDragon = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('leafySeaDragon', 'Leafy Sea Dragon Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = (Math.random() * 0.2 + 0.4) * 2;
self.move = function () {};
});
var ClownTriggerfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('clownTriggerfish', 'Clown Triggerfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.5;
self.move = function () {};
});
var ElectricBlueDamsel = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('electricBlueDamsel', 'Electric Blue Damsel Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = (Math.random() * 0.2 + 0.45) * 2;
self.move = function () {};
});
var YellowTang = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('yellowTang', 'Yellow Tang Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.5;
self.move = function () {};
});
var FlameHawkfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('flameHawkfish', 'Flame Hawkfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = (Math.random() * 0.2 + 0.48) * 2;
self.move = function () {};
});
var RoyalGramma = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('royalGramma', 'Royal Gramma Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.5;
self.move = function () {
@@ -953,9 +959,9 @@
fishGraphics.rotation = self.rotation;
};
});
var FlameAngel = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('flameAngel', 'Flame Angel Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.55;
self.move = function () {
@@ -984,9 +990,9 @@
fishGraphics.rotation = self.rotation;
};
});
var BlueTang = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('blueTang', 'Blue Tang Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.52;
self.move = function () {
@@ -1015,9 +1021,9 @@
fishGraphics.rotation = self.rotation;
};
});
var Moonfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('moonfish', 'Moonfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.55;
self.move = function () {
@@ -1031,9 +1037,9 @@
fishGraphics.rotation = Math.atan2(Math.sin(LK.ticks / 60), Math.cos(LK.ticks / 60));
};
});
var Starfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('starfish', 'Starfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.5;
self.move = function () {
@@ -1047,9 +1053,9 @@
fishGraphics.rotation = LK.ticks / 30;
};
});
var GlassCatfish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('glassCatfish', 'Glass Catfish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.45;
self.move = function () {
@@ -1063,9 +1069,9 @@
fishGraphics.rotation = Math.atan2(Math.sin(LK.ticks / 100), Math.cos(LK.ticks / 100));
};
});
var DiamondTetra = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('diamondTetra', 'Diamond Tetra Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.4;
self.move = function () {
@@ -1094,9 +1100,9 @@
fishGraphics.rotation = self.rotation;
};
});
var PeacockBass = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('peacockBass', 'Peacock Bass Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.65;
self.move = function () {
@@ -1125,9 +1131,9 @@
fishGraphics.rotation = self.rotation;
};
});
var CrimsonSnapper = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('crimsonSnapper', 'Crimson Snapper Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.57;
self.move = function () {
@@ -1156,9 +1162,9 @@
fishGraphics.rotation = self.rotation;
};
});
var CardinalTetra = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('cardinalTetra', 'Cardinal Tetra Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.3;
self.move = function () {
@@ -1187,9 +1193,9 @@
fishGraphics.rotation = self.rotation;
};
});
var CometFish = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('cometFish', 'Comet Fish Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = (Math.random() * 0.2 + 0.6) * 2;
self.move = function () {
@@ -1203,9 +1209,9 @@
fishGraphics.rotation = Math.atan2(Math.sin(LK.ticks / 70), Math.cos(LK.ticks / 70));
};
});
var EmeraldGoby = Fish.expand(function () {
- var self = Fish.call(this) || this;
+ var self = Fish.call(this);
var fishGraphics = self.createAsset('emeraldGoby', 'Emerald Goby Graphics', .5, .5);
fishGraphics.scale.set(1, 1);
self.speed = Math.random() * 0.2 + 0.42;
self.move = function () {
@@ -1233,136 +1239,144 @@
fishGraphics.scale.x = Math.cos(self.rotation) < 0 ? -1 : 1;
fishGraphics.rotation = self.rotation;
};
});
-var Game = Container.expand(function () {
- var self = Container.call(this);
- self.updateElements = function () {
- self.fishes = [];
- 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();
- children[i].move();
- }
+
+/****
+* Initialize Game
+****/
+var game = new LK.Game({
+ backgroundColor: 0x000000
+});
+
+/****
+* Game Code
+****/
+game.updateElements = function () {
+ game.fishes = [];
+ var children = game.children.slice();
+ for (var i = 0; i < children.length; i++) {
+ if (children[i] instanceof Bubble || children[i] instanceof FishFood) {
+ children[i].move();
}
- };
- LK.on('tick', self.updateElements);
- for (var i = 0; i < 5; i++) {
- var plant = new DecorativePlant();
- self.aquarium = self.addChild(new Aquarium());
- var waterBounds = self.aquarium.getWaterBounds();
- plant.x = waterBounds.left + i * ((waterBounds.right - waterBounds.left) / 5);
- plant.y = waterBounds.bottom - plant.height / 2 - 600;
- self.addChild(plant);
+ if (children[i] instanceof DecorativePlant) {
+ children[i].sway();
+ children[i].move();
+ }
}
- 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);
- };
- self.spawnBubble = function () {
- var bubble = new Bubble();
- bubble.x = Math.random() * 2048;
- bubble.y = 2732;
- self.addChild(bubble);
- };
- 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);
- };
- self.aquarium = self.addChild(new Aquarium());
- LK.stageContainer.setBackgroundColor(0x008080);
- self.fishes = [];
- LK.on('tick', function () {
- for (var i = 0; i < self.fishes.length; i++) {
- self.fishes[i].move();
+};
+LK.on('tick', game.updateElements);
+for (var i = 0; i < 5; i++) {
+ var plant = new DecorativePlant();
+ game.aquarium = game.addChild(new Aquarium());
+ var waterBounds = game.aquarium.getWaterBounds();
+ plant.x = waterBounds.left + i * ((waterBounds.right - waterBounds.left) / 5);
+ plant.y = waterBounds.bottom - plant.height / 2 - 600;
+ game.addChild(plant);
+}
+var treasureChest = new TreasureChest();
+treasureChest.x = 2048 / 2;
+treasureChest.y = 2732 - 100;
+game.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', game.feedFish);
+game.feedFish = function () {
+ var food = new FishFood();
+ food.x = 2048 / 2;
+ food.y = 0;
+ game.addChild(food);
+};
+game.spawnBubble = function () {
+ var bubble = new Bubble();
+ bubble.x = Math.random() * 2048;
+ bubble.y = 2732;
+ game.addChild(bubble);
+};
+var bubbleSpawnTimer = LK.setInterval(game.spawnBubble, 2000);
+game.spawnBubble = function () {
+ var bubble = new Bubble();
+ bubble.x = Math.random() * 2048;
+ bubble.y = 2732;
+ game.addChild(bubble);
+};
+game.aquarium = game.addChild(new Aquarium());
+game.setBackgroundColor(0x008080);
+game.fishes = [];
+LK.on('tick', function () {
+ for (var i = 0; i < game.fishes.length; i++) {
+ game.fishes[i].move();
+ }
+});
+LK.on('tick', function () {
+ if (game.fishes) {
+ for (var i = 0; i < game.fishes.length; i++) {
+ game.fishes[i].move();
}
- });
- LK.on('tick', function () {
- if (self.fishes) {
- for (var i = 0; i < self.fishes.length; i++) {
- self.fishes[i].move();
- }
- }
- });
- LK.on('tick', function () {
- for (var i = 0; i < self.fishes.length; i++) {
- self.fishes[i].move();
- }
- });
- for (var i = 0; i < 5; i++) {
- var plant = new DecorativePlant();
- plant.x = i * (2048 / 5);
- plant.y = 2732 - 50;
- self.addChild(plant);
}
- LK.on('tick', function () {
- if (self.fishes && self.fishes.length) {
- for (var i = 0; i < self.fishes.length; i++) {
- self.fishes[i].move();
- }
+});
+LK.on('tick', function () {
+ for (var i = 0; i < game.fishes.length; i++) {
+ game.fishes[i].move();
+ }
+});
+for (var i = 0; i < 5; i++) {
+ var plant = new DecorativePlant();
+ plant.x = i * (2048 / 5);
+ plant.y = 2732 - 50;
+ game.addChild(plant);
+}
+LK.on('tick', function () {
+ if (game.fishes && game.fishes.length) {
+ for (var i = 0; i < game.fishes.length; i++) {
+ game.fishes[i].move();
}
- });
- LK.on('tick', function () {
- for (var i = 0; i < self.fishes.length; i++) {
- self.fishes[i].move();
- }
- });
- LK.on('tick', function () {
- for (var i = 0; i < self.fishes.length; i++) {
- self.fishes[i].move();
- }
- });
- LK.on('tick', function () {
- for (var i = 0; i < self.fishes.length; i++) {
- self.fishes[i].move();
- }
- });
- LK.on('tick', function () {
- for (var i = 0; i < self.fishes.length; i++) {
- self.fishes[i].move();
- }
- });
- var fishTypes = [ZebraDanio, CelestialPearlDanio, Wrasses, Parrotfish, Dartfish, MoorishIdol, Tangfish, Bannerfish, Butterflyfish, Mandarinfish, Lionfish, Surgeonfish, Pufferfish, Clownfish, Angelfish, KoiFish, EmperorFish, Goldfish, Sunfish, GuppyFish, BettaFish, DiscusFish, NeonTetra, OscarFish, ElectricCatfish, RainbowTrout, PsychedelicFrogfish, FlameScallop, RibbonEel, LeafySeaDragon, ClownTriggerfish, ElectricBlueDamsel, YellowTang, FlameHawkfish, RoyalGramma, FlameAngel, BlueTang, Moonfish, Starfish, GlassCatfish, DiamondTetra, PeacockBass, CrimsonSnapper, CardinalTetra, CometFish, EmeraldGoby];
- var that = this;
- fishTypes.forEach(function (fishType) {
- var fish = new fishType();
- if (typeof fish.move === 'function') {
- var waterBounds = self.aquarium.getWaterBounds();
- var centerX = waterBounds.left + (waterBounds.right - waterBounds.left) / 2;
- var centerY = waterBounds.top + (waterBounds.bottom - waterBounds.top) / 2;
- var maxDistance = 500;
- var angle = Math.random() * Math.PI * 2;
- var distance = Math.random() * maxDistance;
- fish.x = centerX + Math.cos(angle) * distance;
- fish.y = centerY + Math.sin(angle) * distance;
- that.fishes.push(fish);
- self.addChild(fish);
- }
- });
- LK.on('tick', function () {
- for (var i = 0; i < self.fishes.length; i++) {
- self.fishes[i].move();
- }
- });
+ }
});
+LK.on('tick', function () {
+ for (var i = 0; i < game.fishes.length; i++) {
+ game.fishes[i].move();
+ }
+});
+LK.on('tick', function () {
+ for (var i = 0; i < game.fishes.length; i++) {
+ game.fishes[i].move();
+ }
+});
+LK.on('tick', function () {
+ for (var i = 0; i < game.fishes.length; i++) {
+ game.fishes[i].move();
+ }
+});
+LK.on('tick', function () {
+ for (var i = 0; i < game.fishes.length; i++) {
+ game.fishes[i].move();
+ }
+});
+var fishTypes = [ZebraDanio, CelestialPearlDanio, Wrasses, Parrotfish, Dartfish, MoorishIdol, Tangfish, Bannerfish, Butterflyfish, Mandarinfish, Lionfish, Surgeonfish, Pufferfish, Clownfish, Angelfish, KoiFish, EmperorFish, Goldfish, Sunfish, GuppyFish, BettaFish, DiscusFish, NeonTetra, OscarFish, ElectricCatfish, RainbowTrout, PsychedelicFrogfish, FlameScallop, RibbonEel, LeafySeaDragon, ClownTriggerfish, ElectricBlueDamsel, YellowTang, FlameHawkfish, RoyalGramma, FlameAngel, BlueTang, Moonfish, Starfish, GlassCatfish, DiamondTetra, PeacockBass, CrimsonSnapper, CardinalTetra, CometFish, EmeraldGoby];
+var that = void 0;
+fishTypes.forEach(function (fishType) {
+ var fish = new fishType();
+ if (typeof fish.move === 'function') {
+ var waterBounds = game.aquarium.getWaterBounds();
+ var centerX = waterBounds.left + (waterBounds.right - waterBounds.left) / 2;
+ var centerY = waterBounds.top + (waterBounds.bottom - waterBounds.top) / 2;
+ var maxDistance = 500;
+ var angle = Math.random() * Math.PI * 2;
+ var distance = Math.random() * maxDistance;
+ fish.x = centerX + Math.cos(angle) * distance;
+ fish.y = centerY + Math.sin(angle) * distance;
+ that.fishes.push(fish);
+ game.addChild(fish);
+ }
+});
+LK.on('tick', function () {
+ for (var i = 0; i < game.fishes.length; i++) {
+ game.fishes[i].move();
+ }
+});
\ No newline at end of file
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.