Code edit (2 edits merged)
Please save this source code
User prompt
the playerDuck instance is not showb
Code edit (3 edits merged)
Please save this source code
User prompt
create a "finishLine" graphic and place it at the right side
Code edit (8 edits merged)
Please save this source code
User prompt
the opponent ducks are moving at the same speed. Make it that they slow down / speed up randomly
User prompt
after start, play the duck sound in random intervals
User prompt
make a graphic waves
User prompt
spawn multiple waves at the bottom
User prompt
make the waves move up and down in a wave movement
===================================================================
--- original.js
+++ change.js
@@ -13,9 +13,9 @@
var duckGraphics = self.attachAsset('duck', {
anchorX: 0.5,
anchorY: 0.5
});
- self.speed = 5; // Initial speed of the duck
+ self.speed = 1; // Initial speed of the duck
self.speedVariation = 0; // Variable to keep track of the speed variation
self.update = function () {
if (countdown == 0) {
// Update the duck's speed using the tween plugin
@@ -74,9 +74,9 @@
ducks.push(duck);
}
var playerDuck = game.addChild(new PlayerDuck());
var lastDuck = ducks[ducks.length - 1];
-playerDuck.y = lastDuck.y + lastDuck.height + 200;
+playerDuck.y = lastDuck.y + lastDuck.height + 100;
playerDuck.x = startX;
var score = 0;
// Update function called every frame
game.update = function () {
@@ -91,18 +91,17 @@
duck.speedVariation = 0;
}
}
}
+ if (playerDuck.x > 2048) {
+ LK.showYouWin();
+ return;
+ }
for (var j = 0; j < ducks.length; j++) {
var duck = ducks[j];
duck.update();
// Check if duck has reached the end of the track
if (duck.x > 2048) {
- // Duck wins the race
- if (duck === playerDuck) {
- LK.showYouWin();
- } else {
- LK.showGameOver();
- }
+ LK.showGameOver();
}
}
};
\ No newline at end of file