User prompt
add the "gift" object to be collected. Tie it to the point counter
User prompt
Change the background color light blue
User prompt
Make a gradual change in the background color from light blue to white and back to light blue
User prompt
Make the background color a gradient from light blue to white with a snow field
User prompt
remove the background from the code
User prompt
released the function of duplicating the background
User prompt
the error remained. object '6745be163cd1d98b71d91480' should not interact with background
User prompt
check background for error, overlapping object '6745be163cd1d98b71d91480' it shouldn't be
User prompt
issued shake for object '6745be163cd1d98b71d91480'
User prompt
reduce collision size for object '6745be653cd1d98b71d9148a' by half
User prompt
Make the background color as snow field
User prompt
the background should be duplicated when scrolling, filling the playing field
User prompt
add a scrolling function to the background
User prompt
add the background as an object
Remix started
Copy Safari Bugs
===================================================================
--- original.js
+++ change.js
@@ -66,8 +66,24 @@
animatedBug.y = self.y;
self.destroy();
};
});
+var Gift = Container.expand(function () {
+ var self = Container.call(this);
+ var giftGraphics = self.attachAsset('gift', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 5;
+ self.update = function () {
+ self.y += self.speed;
+ };
+ self.down = function (x, y, obj) {
+ LK.setScore(LK.getScore() + 1);
+ scoreTxt.setText('Score: ' + LK.getScore());
+ self.destroy();
+ };
+});
// Jeep class to represent the player's vehicle
var Jeep = Container.expand(function () {
var self = Container.call(this);
var jeepGraphics = self.attachAsset('jeep', {
@@ -178,8 +194,14 @@
newTree.y = 0;
trees.push(newTree);
game.addChild(newTree);
}
+ if (LK.ticks % 240 == 0) {
+ var newGift = new Gift();
+ newGift.x = Math.random() * 2048;
+ newGift.y = 0;
+ game.addChild(newGift);
+ }
// Bug and tree movement and collision detection logic
for (var i = bugs.length - 1; i >= 0; i--) {
bugs[i].update();
if (bugs[i].intersects(jeep)) {
@@ -209,7 +231,21 @@
trees[i].destroy();
trees.splice(i, 1);
}
}
+ for (var i = game.children.length - 1; i >= 0; i--) {
+ if (game.children[i] instanceof Gift) {
+ var gift = game.children[i];
+ gift.update();
+ if (gift.intersects(jeep)) {
+ LK.setScore(LK.getScore() + 1);
+ scoreTxt.setText('Score: ' + LK.getScore());
+ gift.destroy();
+ }
+ if (gift.y > 2732) {
+ gift.destroy();
+ }
+ }
+ }
};
// Initialize the game
initGame();
\ No newline at end of file
Santa on a sleigh top view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
christmas tree. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
big snowball. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
snow tornado. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
christmas gift. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
кнопка "Старт" в різдвяному стилі. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
sparkle. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
сніжинка. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.