User prompt
Remove the fish from the game
User prompt
Do not let the fish to go above the penguin
User prompt
Allow the player to catch fish and add five points
User prompt
Let the game happen underwater
User prompt
Let the game end when penguin hits an obstacle or the player reaches 500
User prompt
Add the fish to the game and allow the penguins to catch them
User prompt
Animate the ocean
User prompt
Let the fish appear from the ocean
User prompt
Add the ocean
User prompt
Let the ocean be the background
User prompt
Add pingos to the game and allow the penguin to rest there
User prompt
Add pingos to be another obstacle that moves slowly
Code edit (2 edits merged)
Please save this source code
User prompt
Put water on the background
User prompt
Instead of blue background make it an ocean
User prompt
Play cool sounds once a penguin captures a fish
User prompt
Let the game elements move from left to right
User prompt
Make the coins to jump
User prompt
Make the fish jump up and down at random heights
User prompt
Add more coins moving from left to right
Code edit (1 edits merged)
Please save this source code
User prompt
Make the background 💙
User prompt
Let it end when it reaches 200 points
User prompt
Change the color of the background once the player hits 50 points
===================================================================
--- original.js
+++ change.js
@@ -82,16 +82,16 @@
self.isJumping = true;
}
};
});
-// Pingo class representing pingos as obstacles on the path
+// Pingo class representing pingos for the penguin to rest
var Pingo = Container.expand(function () {
var self = Container.call(this);
var pingoGraphics = self.attachAsset('pingo', {
anchorX: 0.5,
anchorY: 0.5
});
- self.speed = -2; // Pingos move slower than other obstacles
+ self.speed = -5;
self.update = function () {
self.x += self.speed;
if (self.x < -100) {
self.destroy();
@@ -148,24 +148,23 @@
newLevel2Obstacle.y = alternate ? 2732 / 2 : 2732 / 3;
obstacles.push(newLevel2Obstacle);
game.addChild(newLevel2Obstacle);
}
- // Add pingos every 120 ticks
- if (LK.ticks % 120 == 0) {
- var newPingo = new Pingo();
- newPingo.x = 2048;
- newPingo.y = 2732 / 2;
- obstacles.push(newPingo);
- game.addChild(newPingo);
- }
// Add coins every 90 ticks
if (LK.ticks % 90 == 0) {
var newCoin = alternate ? new HighCoin() : new Coin();
newCoin.x = 2048;
newCoin.y = alternate ? 2732 / 3 : 2732 / 2; // Position coins near the pingos
coins.push(newCoin);
game.addChild(newCoin);
}
+ // Add pingos every 180 ticks
+ if (LK.ticks % 180 == 0) {
+ var newPingo = new Pingo();
+ newPingo.x = 2048;
+ newPingo.y = 2732 / 2; // Position pingos in the middle
+ game.addChild(newPingo);
+ }
// Update the score when the penguin picks a coin
for (var i = coins.length - 1; i >= 0; i--) {
if (penguin.intersects(coins[i])) {
score += coins[i].value;
@@ -180,8 +179,14 @@
// Event listener for touch down to make the penguin jump
game.down = function (x, y, obj) {
penguin.jump();
};
+// Check if the penguin is on a pingo
+for (var i = 0; i < game.children.length; i++) {
+ if (game.children[i] instanceof Pingo && penguin.intersects(game.children[i])) {
+ penguin.isJumping = false; // Allow the penguin to rest on the pingo
+ }
+}
// Change the color of the background once the player hits 50 points
if (score >= 50) {
game.setBackgroundColor(0x00FFFF); // Change the background color to blue
}