User prompt
This rotation should continue until they're pointing at 90 degrees downward, and then should go back to normal the moment they flap.
User prompt
The player's character and the flap image should have their right side dip towards the ground when they're falling slowly.
User prompt
The flap image should always be 100% transparent while it's visible. Sorry, 100% opaque while it's visible.
User prompt
Actually, that's too long. Make it about a quarter second.
User prompt
The flap image should display for about a half a second.
User prompt
The flap image should also be doubled in size.
User prompt
Let's double the size of the player's character.
User prompt
Add instructions when the game begins that tells the player how to play.
User prompt
Copy the game over state but not the pop-up when the game begins where everything is frozen and nothing is playing.
User prompt
Freeze all assets on screen until the player presses the Start button.
User prompt
The game is starting before the player clicks the start button. It needs to not start, and the pelican should not be flying. It should be motionless until the start button is pressed.
User prompt
Create a pop-up that includes instructions for the player and a start button. The game will not begin until the player has pressed the start button from this pop-up menu.
User prompt
When the game starts, gameplay should be frozen.
User prompt
The game should be in the Game Over state before the game begins and the player clicks the Start button.
User prompt
Let's prevent the game from starting until the user clicks the screen button that says OK, start.
User prompt
Let's change the color from orange to black for the plus 10 and increase the size of the stroke.
User prompt
Let's make the stroke thicker for the player score at the top of the screen.
User prompt
Let's add a 4-pixel stroke to the player's score at the top of the screen.
User prompt
Let's give the plus 10 text a white outline
User prompt
Let's double the size of the yum graphic and raise the plus 10 higher so it doesn't overlap.
User prompt
The Yum! graphic will have its own unique art.
User prompt
Let's create a new graphic that will appear when the fish is eaten to replace the yum text.
User prompt
The boat should actually appear randomly as the game goes on, and shouldn't appear more than twice every 60 seconds, and only ever one at a time.
User prompt
The boat's opacity should be 80%.
User prompt
Slow the boat by half its speed.
===================================================================
--- original.js
+++ change.js
@@ -203,10 +203,191 @@
game.addChild(splash);
}
game.pipesPassed = 0;
game.jetsAppear = false;
-// Forest green color
-// No start screen, game begins immediately
+// Create a start button
+var startButton = LK.getAsset('startButton', {
+ anchorX: 0.5,
+ anchorY: 0.5
+});
+startButton.x = 2048 / 2;
+startButton.y = 2732 / 2;
+game.addChild(startButton);
+// Create and display the "OK, Start" text on the button
+var startText = new Text2('OK, Start', {
+ size: 100,
+ fill: "#ffffff"
+});
+startText.anchor.set(0.5, 0.5);
+startText.x = startButton.x;
+startText.y = startButton.y;
+game.addChild(startText);
+// Disable game update initially
+game.update = function () {};
+// Add event listener to start the game when the button is clicked
+startButton.down = function (x, y, obj) {
+ // Remove the start button and text
+ startButton.destroy();
+ startText.destroy();
+ // Enable game update
+ game.update = function () {
+ // Add a gentle sway to the ocean layer
+ bottomLayer1.x -= oceanSwaySpeed * 0.2;
+ bottomLayer2.x -= oceanSwaySpeed * 0.2;
+ if (bottomLayer1.x < -2048 / 2) {
+ bottomLayer1.x = bottomLayer2.x + 2048;
+ }
+ if (bottomLayer2.x < -2048 / 2) {
+ bottomLayer2.x = bottomLayer1.x + 2048;
+ }
+ bottomLayer1.y += oceanSwaySpeed * oceanSwayDirection * 0.5;
+ bottomLayer2.y += oceanSwaySpeed * oceanSwayDirection * 0.5;
+ if (bottomLayer1.y > 2732 * 0.8 + 0.5 || bottomLayer1.y < 2732 * 0.8 - 0.5) {
+ oceanSwayDirection *= -1;
+ }
+ if (LK.ticks % 400 == 0 && !game.jetsAppear) {
+ var newObstacle = new Obstacle();
+ newObstacle.x = 2048;
+ var gapY = Math.random() * (2000 - 600); // Random gap position
+ var pelicanHeight = LK.getAsset('pelican', {}).height;
+ var maxGapHeight = pelicanHeight * 10;
+ var initialGapHeight = 2000 * 0.2;
+ var minGapHeight = initialGapHeight / 2;
+ var gapHeight = Math.max(minGapHeight, Math.min(initialGapHeight, maxGapHeight) - LK.getScore() * 0.1); // Decrease gapHeight over time but not less than half its initial size
+ newObstacle.createPipe(gapY, gapHeight);
+ obstacles.push(newObstacle);
+ game.addChild(newObstacle);
+ game.pipesPassed++;
+ if (game.pipesPassed % 8 == 0) {
+ game.jetsAppear = true;
+ game.jetsTimer = 0;
+ LK.getSound('alert').play();
+ }
+ }
+ for (var i = obstacles.length - 1; i >= 0; i--) {
+ if (obstacles[i].x < -50) {
+ obstacles[i].destroy();
+ obstacles.splice(i, 1);
+ LK.setScore(LK.getScore() + 1); // Add 1 point to the score
+ scoreTxt.setText(LK.getScore()); // Update the score text
+ }
+ if (obstacles[i] instanceof Obstacle && pelican.intersects(obstacles[i])) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.stopMusic();
+ LK.getSound('arcadefail').play();
+ LK.showGameOver();
+ }
+ }
+ fish.update();
+ cloud1.update();
+ cloud2.update();
+ city1.update();
+ city2.update();
+ if (pelican.intersects(fish)) {
+ fish.destroy();
+ fish = game.addChild(new Fish());
+ fish.x = 1024; // Reset fish position
+ fish.y = 2732 * 0.9;
+ LK.setScore(LK.getScore() + 10); // Add 10 points to the score
+ scoreTxt.setText(LK.getScore()); // Update the score text
+ LK.getSound('specialscore1').play(); // Play the sound Special Score 1
+ // Create and display a new unique graphic when the fish is eaten
+ var yumGraphic = LK.getAsset('yumGraphic', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 2,
+ scaleY: 2
+ });
+ yumGraphic.x = pelican.x;
+ yumGraphic.y = pelican.y;
+ yumGraphic.alpha = 1;
+ yumGraphic.update = function () {
+ this.y -= 2; // Move the graphic upwards
+ this.alpha -= 0.02; // Fade out the graphic
+ if (this.alpha <= 0) {
+ this.destroy();
+ }
+ };
+ game.addChild(yumGraphic);
+ // Create and display the "+10" text
+ var plusTenText = new Text2('+10', {
+ size: 150,
+ fill: "#000000",
+ stroke: "#ffffff",
+ strokeThickness: 8
+ });
+ plusTenText.anchor.set(0.5, 0);
+ plusTenText.x = pelican.x;
+ plusTenText.y = pelican.y - 300; // Position it higher above the "YUM" graphic
+ plusTenText.alpha = 1;
+ plusTenText.update = function () {
+ this.y -= 2; // Move the text upwards
+ this.alpha -= 0.02; // Fade out the text
+ if (this.alpha <= 0) {
+ this.destroy();
+ }
+ };
+ game.addChild(plusTenText);
+ }
+ // Add a boat every 30 seconds
+ if (LK.ticks % 1800 == 0) {
+ // 1800 ticks = 30 seconds at 60 FPS
+ var newBoat = new Boat();
+ newBoat.x = 2048 + newBoat.width; // Start from the right side of the screen
+ newBoat.y = 2732 * 0.8 - 30; // Move the boat up by another 10 pixels
+ game.addChild(newBoat);
+ }
+ // Add the jet to the game
+ if (game.jetsAppear) {
+ game.jetsTimer++;
+ if (game.jetsTimer >= 300) {
+ // 5 seconds have passed
+ game.jetsAppear = false;
+ } else if (LK.ticks % 60 == 0) {
+ // Every second
+ if (game.jetsTimer == 0) {
+ // When the first jet appears
+ // Play the alert sound
+ LK.getSound('alert').play();
+ var crowsText = new Text2('CROWS!', {
+ size: 200,
+ fill: "#ffffff"
+ });
+ crowsText.anchor.set(0.5, 0.5);
+ crowsText.x = 2048 / 2;
+ crowsText.y = 2732 / 2;
+ game.addChild(crowsText);
+ // Remove the "CROWS!" text after 2 seconds
+ LK.setTimeout(function () {
+ crowsText.destroy();
+ }, 2000);
+ }
+ for (var i = 0; i < 3; i++) {
+ var newJet = new Jet();
+ newJet.x = 2048 + i * 500; // Start from the right side of the screen and spread out the jets
+ newJet.y = Math.random() * 2732; // Random y position
+ game.addChild(newJet);
+ }
+ }
+ }
+ // Check for collision with the jet
+ for (var i = game.children.length - 1; i >= 0; i--) {
+ if (game.children[i] instanceof Jet && pelican.intersects(game.children[i])) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
+ }
+ }
+ // Increment score for every two seconds the pelican stays alive
+ if (LK.ticks % 120 == 0) {
+ LK.setScore(LK.getScore() + 1);
+ scoreTxt.setText(LK.getScore());
+ }
+ };
+ // Start the music when the game begins
+ LK.playMusic('soundtrack', {
+ volume: 0.3
+ });
+};
// Forest green color for pipes
// Forest green color for pipes
// Add a light blue layer at the bottom 20% of the screen
var bottomLayer1 = LK.getAsset('ocean', {
8-bit profile of pelican flying straight. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8-bit profile of fish for arcade game. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8-bit profile of pelican flapping it's wings downward. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8-bit silhouette of tugboat. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8-bit "YUM" dialog bubble. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.