Code edit (1 edits merged)
Please save this source code
User prompt
In game update, don’t forget width/2 for backgrounds
Code edit (1 edits merged)
Please save this source code
User prompt
ScaleX property doesn’t work, use .scale.x
User prompt
Background 2 initial position should be next to background 1
User prompt
Fix background scrolling
User prompt
Repeat the background indefinitely. Use scale.x=-1
User prompt
Add an asset for the background
User prompt
Fishes should always be fully in the screen, not partially
User prompt
All fishes should have the same speed
User prompt
Reduce jump amplitude
User prompt
Player should not pass the top of the screen
User prompt
Make fall slower
User prompt
Fall should slower as we are in water
User prompt
Each tap must go upper and in a smooth way
User prompt
Each tap should go much upper
User prompt
Player should never pass under the bottom of the screen
User prompt
Change the contrôle system to something like flappy bird (tap to go up)
User prompt
Rename bigfish to fish2
User prompt
Please fix the bug: 'ReferenceError: Can't find variable: smallFishes' in or related to this line: 'smallFishes.push(smallFish);' Line Number: 85
User prompt
Rename small fish to fish1
User prompt
Le joueur doit être placé à gauche de l'écran.
User prompt
Transforme le jeu en défilement horizontal
Initial prompt
Baby Shark
/**** * Classes ****/ //<Assets used in the game will automatically appear here> // Baby Shark class var BabyShark = Container.expand(function () { var self = Container.call(this); var sharkGraphics = self.attachAsset('babyShark', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { if (self.y > 2732 - self.height / 2) { self.y = 2732 - self.height / 2; } // Update logic for Baby Shark }; self.grow = function () { self.scaleX += 0.1; self.scaleY += 0.1; }; }); // Fish1 class var Fish1 = Container.expand(function () { var self = Container.call(this); var fishGraphics = self.attachAsset('fish1', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 3; self.update = function () { self.x -= self.speed; if (self.x < -self.width) { self.destroy(); } }; }); // Fish2 class var Fish2 = Container.expand(function () { var self = Container.call(this); var fishGraphics = self.attachAsset('fish2', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 2; self.update = function () { self.x -= self.speed; if (self.x < -self.width) { self.destroy(); } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x0000ff // Init game with blue background }); /**** * Game Code ****/ var babyShark = game.addChild(new BabyShark()); babyShark.x = 100; babyShark.y = 2732 - 200; var fish1s = []; var fish2s = []; var score = 0; var scoreTxt = new Text2('Score: 0', { size: 100, fill: "#ffffff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); function spawnSmallFish() { var smallFish = new Fish1(); smallFish.x = 2048 + 50; smallFish.y = Math.random() * 2732; fish1s.push(smallFish); game.addChild(smallFish); } function spawnFish2() { var fish2 = new Fish2(); fish2.x = 2048 + 50; fish2.y = Math.random() * 2732; fish2s.push(fish2); game.addChild(fish2); } game.down = function (x, y, obj) { // babyShark.x = x; babyShark.y -= 50; }; game.move = function (x, y, obj) { // babyShark.x = x; // babyShark.y = y; }; game.update = function () { babyShark.y += 5; // Gravity effect babyShark.update(); for (var i = fish1s.length - 1; i >= 0; i--) { if (babyShark.intersects(fish1s[i])) { babyShark.grow(); score += 10; scoreTxt.setText('Score: ' + score); fish1s[i].destroy(); fish1s.splice(i, 1); } } for (var j = fish2s.length - 1; j >= 0; j--) { if (babyShark.intersects(fish2s[j])) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } } if (LK.ticks % 60 == 0) { spawnSmallFish(); } if (LK.ticks % 180 == 0) { spawnFish2(); } };
===================================================================
--- original.js
+++ change.js
@@ -10,8 +10,11 @@
anchorY: 0.5
});
self.speed = 5;
self.update = function () {
+ if (self.y > 2732 - self.height / 2) {
+ self.y = 2732 - self.height / 2;
+ }
// Update logic for Baby Shark
};
self.grow = function () {
self.scaleX += 0.1;
@@ -94,8 +97,9 @@
// babyShark.y = y;
};
game.update = function () {
babyShark.y += 5; // Gravity effect
+ babyShark.update();
for (var i = fish1s.length - 1; i >= 0; i--) {
if (babyShark.intersects(fish1s[i])) {
babyShark.grow();
score += 10;
Orange Baby fish lateral view. 2024 game style
Pink Baby fish lateral view. 2024 game style
Empty Under water. water only. 2024 game style
Cute Baby shark.. . 2024 game style. Side view. Photorealistic
Classic fish lateral view.. 2024 game style
Classic fish with fangs lateral view.. 2024 game style. Photorealistic
Classic fish with fangs mouth closed lateral view.. 2024 game style. Photorealistic. Full side view.
Cachalot. Horizontal closed lateral view.... 2024 game style. Photorealistic. Full side view.
Straight horizontal Orca. Mouth open. 2024 game style. Photorealistic. Full side view
Start button in the shape of a shark mouth.
beluga swimming mouth open. 2024 game style. Photorealistic. Entire lateral profile view, perfectly horizontal.
North Pacific right whale. Horizontal complete lateral view..... 2024 game style. Photorealistic. Full side view.
Decomposition of Horizontal Swimming movement of a woman with a snorkel.. 2024 game style. 2 frames sprite sheet. Photorealistic
Very minimalist skeleton of a fish with a fin and cute shark head... 2d. Black background. High contrast. No shadows.