Code edit (1 edits merged)
Please save this source code
User prompt
in Player.update(), add other flashy colors to animate player tint when bonus is active and make them change fast
Code edit (1 edits merged)
Please save this source code
User prompt
in Player.update(), animate player tint using tintPlayer() from white to green and vice versa
Code edit (14 edits merged)
Please save this source code
User prompt
in player class while isBonusActive, animate player tint using tintPlayer() from white to green and vice versa
Code edit (1 edits merged)
Please save this source code
User prompt
when bonus reaches 1st target then it moves toward the player while decreasing width and height to 10
Code edit (1 edits merged)
Please save this source code
User prompt
Animate bonus : move to road x,y while increasing width and height to 1024
Code edit (7 edits merged)
Please save this source code
User prompt
in startBonusAnimation add a green screen flash
User prompt
play startButon audio when start button pressed
User prompt
replace this code ``` for (var i = 0; i < road.segments.length; i++) { var segment = road.segments[i]; for (var j = 0; j < segment.background.children.length; j++) { var child = segment.background.children[j]; log("child[".concat(i, "][").concat(j, "]"), child); if (child.taken) { log("IS TAKEN : ", child); child.children[0].alpha = 0; } } } ```` to search for taken property in game children because when taken objects are deteched from road to game
Code edit (2 edits merged)
Please save this source code
User prompt
fix : ``` for (var i = 0; i < roadContainer.children.length; i++) { var child = roadContainer.children[i]; if (child.taken) { child.alpha = 0; } } ``` becaus detritus are attached to background property of roadsegment that are in road.segments array
Code edit (1 edits merged)
Please save this source code
User prompt
in startBonusAnimation, set alpha of all taken detritus to 0
Code edit (4 edits merged)
Please save this source code
User prompt
in startBonusAnimation, play bonus start sound and create a bonus asset at the recycleBin position
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
in Starfield add a property 'direction' to star, then use it to make star alpha change from 0 to 1 and vice versa
User prompt
update this : self.update = function () { for (var i = 0; i < self.children.length; i++) { var star = self.children[i]; if (Math.random() < 0.01) { // 1% chance to animate each star per frame star.alpha = 0.5 + 0.5 * Math.sin(LK.ticks / 30 + i); // Animate alpha from 0.5 to 1.0 } } }; to use this algotithm: Every 3 sec, select 10 stars randomly, then for this selected stars animate alpha from 0 to 1 and vice versa
Code edit (10 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -901,10 +901,9 @@
nbCollectedBeforeBonus++;
}
if (nbCollectedBeforeBonus > BONUS_COLLECT_THRESHOLD) {
log("Gained Bonus !!!");
- nbCollectedBeforeBonus = 0;
- isBonusActive = true;
+ startBonusAnimation();
}
} else {
self.rotation += 0.05 + (Math.random() - 0.25) * 0.1;
}
@@ -964,8 +963,15 @@
self.parent.removeChild(self);
game.addChildAt(self, game.getChildIndex(recycleBin));
self.position = game.toLocal(globalPosition);
LK.getSound('collectDetritus').play();
+ if (!isBonusActive) {
+ nbCollectedBeforeBonus++;
+ }
+ if (nbCollectedBeforeBonus > BONUS_COLLECT_THRESHOLD) {
+ log("Gained Bonus !!!");
+ startBonusAnimation();
+ }
}
};
return self;
});
@@ -1360,9 +1366,9 @@
gameOver = true;
winningTime = LK.ticks;
LK.setScore(score + kgCollected * 100);
LK.stopMusic();
- winningText.setText(lost ? 'Oh no!' : 'Congratulations!');
+ winningText.setText('The end');
// Check if winningTime is set and show game over screen after 60 ticks
game.update = function () {
if (lost || winningTime && LK.ticks >= winningTime + 120) {
LK.setTimeout(function () {
@@ -1372,8 +1378,24 @@
}
};
}
;
+function startBonusAnimation() {
+ log('startBonusAnimation...');
+ nbCollectedBeforeBonus = 0;
+ isBonusStartAnim = true;
+ isBonusActive = true;
+ // Play bonus start sound
+ LK.getSound('bonusStart').play();
+ // Create a bonus asset at the recycleBin position
+ var bonus = game.addChild(LK.getAsset('bonus', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: recycleBin.x,
+ y: recycleBin.y
+ }));
+}
+;
// Animations & handlers
function animateProperty(animationPose, blendPose, blendAlpha, key, baseValue) {
var animationPoseValue = (animationPose || {})[key] || 0;
var blendPoseValue = (blendPose || {})[key] || 0;
white
circle sliced into many pieces, flat image. 2d, white background, shadowless.
pixel art of a tall, tree. game asset, 2d, white background, shadowless.
pixel art cloud. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
dark space.
flying lava bubble. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a bonus crystal ball with the recycle symbol. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
top view A green round start button empty in the center like a ring.