User prompt
Make normal clouds a little transparent
User prompt
Now normal clouds appear moving from right to left in the background
User prompt
Make it so that birds cannot appear underwater
User prompt
So Victory's message says something like play again for a new difficulty
User prompt
Well done
User prompt
So every time you win the bird appears in a different place and one or two birds may appear
User prompt
I wasn't referring to the corners but a little more in the middle.
User prompt
Let's make objects called birds come out from the corners that will move from one side to the other and if the dolphin touches them, he loses.
User prompt
So the whale jumps shorter than the dolphin
User prompt
Now the whale just goes up the whale should fall after jumping
User prompt
Hey, it's not jumping, it's sinking, so jump, don't sink.
User prompt
So the whale makes a little jump when the dolphin jumps on it
User prompt
That the mar are smaller
User prompt
Las isiste más grandes maldito que las aguas más pequeñas
User prompt
As the smallest sea is much smaller than you made it bigger in the first place
User prompt
So the sea returns to its size
User prompt
So when the dolphin leaves the camera it reappears in the center at the same time as the whale and the sea are erased to give the effect that the camera is following it.
User prompt
So there is sea all over the ground
User prompt
So the dolphin can jump where there is no whale
User prompt
So when the dolphin jumps in a place where the whale is not, it creates a transparent cloud that will disappear moments later.
User prompt
Silly, they are touching the whale and they are very far apart, put it as you like
User prompt
Stop that, I'll go back to the way it was. I don't want them to be separated. I want them to be higher up because that way they touch the ground and the dolphin can jump in the clouds.
User prompt
Let that go, I don't want you to separate them, but to put them higher so they don't touch the ground and the dolphin can jump on them.
User prompt
So the clouds are higher and the dolphin can jump in them
User prompt
Raise them and separate them.
/****
* Classes
****/
// Camera class to follow the dolphin
var Camera = Container.expand(function () {
var self = Container.call(this);
self.update = function () {
// Make the camera follow the dolphin vertically
self.y = dolphin.y;
};
});
// Cloud class to be created when the dolphin jumps
var Cloud = Container.expand(function () {
var self = Container.call(this);
var cloudGraphics = self.attachAsset('cloud', {
anchorX: 0.5,
anchorY: 0.5
});
self.alpha = 0.5; // Make the cloud transparent
self.update = function () {
// Make the cloud disappear after a while
self.alpha -= 0.01;
if (self.alpha <= 0) {
self.destroy();
}
};
});
// Dolphin class to be thrown
var Dolphin = Container.expand(function () {
var self = Container.call(this);
var dolphinGraphics = self.attachAsset('dolphin', {
anchorX: 0.5,
anchorY: 0.5
});
self.vy = 0; // Vertical velocity
self.update = function () {
self.y += self.vy;
self.vy += 1; // Gravity effect
if (self.y > 2732) {
// Reset position if it falls below the screen
self.y = 2732;
self.vy = 0;
}
// Make the dolphin spin as it jumps
self.rotation += 0.1;
};
});
// Mar class to be placed on the ground
var Mar = Container.expand(function () {
var self = Container.call(this);
var marGraphics = self.attachAsset('Mar', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// The mar stays still on the ground
};
});
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Whale class to support the dolphin
var Whale = Container.expand(function () {
var self = Container.call(this);
var whaleGraphics = self.attachAsset('whale', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Make the whale follow the dolphin horizontally
self.x = dolphin.x;
};
self.flatten = function () {
// Play a toy sound
LK.getSound('toy').play();
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB // Sky blue background
});
/****
* Game Code
****/
// Initialize whale, dolphin, mar and camera
var whale = game.addChild(new Whale());
whale.x = 1024; // Center horizontally
whale.y = 2500; // Near the bottom
var dolphin = game.addChild(new Dolphin());
dolphin.x = whale.x;
dolphin.y = whale.y - 100; // Position above the whale
var camera = game.addChild(new Camera());
camera.x = 1024; // Center horizontally
camera.y = 1366; // Center vertically
// Create 10 Mar instances and distribute them across the ground
var mars = [];
for (var i = 0; i < 10; i++) {
var mar = game.addChild(new Mar());
mar.x = i * 204.8; // Distribute horizontally
mar.y = 2732; // At the bottom
mar.scaleX = 20; // Make them bigger to cover the whole ground
mar.scaleY = 20; // Make them bigger to cover the whole ground
mars.push(mar);
}
// Event listener for throwing the dolphin
game.down = function (x, y, obj) {
if (dolphin.y >= whale.y - 100 && Math.abs(dolphin.x - whale.x) < whale.width / 2) {
dolphin.vy = -50; // Increase upward velocity if jumping on the whale
LK.getSound('toy').play(); // Play a toy sound
} else {
dolphin.vy = -20; // Initial upward velocity
// Create a cloud at the dolphin's position
var cloud = game.addChild(new Cloud());
cloud.x = dolphin.x;
cloud.y = dolphin.y;
}
};
// Play background music
LK.playMusic('Jumping_song');
// Update game state
game.update = function () {
dolphin.update();
whale.update();
camera.update();
if (dolphin.y <= camera.y - 1366) {
// Dolphin left the camera
dolphin.y = camera.y; // Reset dolphin to the center
whale.destroy(); // Erase the whale
whale = game.addChild(new Whale()); // Create a new whale
whale.x = 1024; // Center horizontally
whale.y = 2500; // Near the bottom
for (var i = 0; i < 10; i++) {
mars[i].destroy(); // Erase the sea
var mar = game.addChild(new Mar()); // Create a new sea
mar.x = i * 204.8; // Distribute horizontally
mar.y = 2732; // At the bottom
mar.scaleX = 1; // Reset the sea to its original size
mar.scaleY = 1; // Reset the sea to its original size
mars[i] = mar;
}
}
if (dolphin.y <= 0) {
// Dolphin reached the top
LK.showYouWin();
}
}; ===================================================================
--- original.js
+++ change.js
@@ -136,10 +136,10 @@
mars[i].destroy(); // Erase the sea
var mar = game.addChild(new Mar()); // Create a new sea
mar.x = i * 204.8; // Distribute horizontally
mar.y = 2732; // At the bottom
- mar.scaleX = 20; // Make them bigger to cover the whole ground
- mar.scaleY = 20; // Make them bigger to cover the whole ground
+ mar.scaleX = 1; // Reset the sea to its original size
+ mar.scaleY = 1; // Reset the sea to its original size
mars[i] = mar;
}
}
if (dolphin.y <= 0) {