User prompt
Fix Bug: 'Timeout.tick error: Gift is not defined' in this line: 'gift = new Gift();' Line Number: 51
User prompt
only one third of the presents should be allowed to move outside of the left and right border.
User prompt
it's not working
User prompt
change the Game Over text to LATE FOR CHRISTMAS on the game over window
User prompt
the greayHeart image should not disappear but show there.
User prompt
before game over replace also the last remaining heart with a grayheart image and then show the game over window.
User prompt
Fix Bug: 'ReferenceError: GrayHeart is not defined' in this line: 'var grayHeart = new GrayHeart();' Line Number: 71
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'y')' in this line: 'if (gifts[i].y > 2732) {' Line Number: 66
User prompt
fix bugs
User prompt
when the third gift is missed replace the remaining heart image with the greayHeart image and then game over
User prompt
Ensure the third missed gift does replaces the last heart asset with the gray heart
User prompt
when the third gift is missed the heart asset is not replace with the grayheart
User prompt
one missed present corresponds to one heart being replace with a greayHeart asset
User prompt
replace every heart with greayHeart for each of the three missed presents.
User prompt
once the third present is not picked remove the third heart and replace it with the grayHeart image.
User prompt
Fix Bug: 'ReferenceError: GrayHeart is not defined' in this line: 'var grayHeart = new GrayHeart();' Line Number: 71
User prompt
for each gift missed delete a heart and replace the image with another named gray_heart
User prompt
When the third gift is missed the last heart is lost.
User prompt
If three presents are lost not picked it's game over.
User prompt
Add borders so that the gifts and Santa don't fall outside the screen.
User prompt
When the last heart is lost game over and play again
User prompt
ad a wall under santa when the gift touces that wall you get a game over screen. Santa stays inside the screne add borders on santa he can go outside of the scree only a few inches no more
User prompt
add borders to santa to stay insite the screen
User prompt
change the direction of the santa imag eto look right
User prompt
add borders on the gifts to stay inside the screen
var GrayHeart = Container.expand(function () { var self = Container.call(this); var grayHeartGraphics = self.createAsset('grayHeart', 'Gray Heart icon', 0, 0); }); var Heart = Container.expand(function () { var self = Container.call(this); var heartGraphics = self.createAsset('heart', 'Heart icon', 0, 0); }); var Santa = Container.expand(function () { var self = Container.call(this); var santaGraphics = self.createAsset('santa', 'Santa character', .5, .5); self.move = function () {}; self.collect = function () {}; }); var Gift = Container.expand(function () { var self = Container.call(this); var giftGraphics = self.createAsset('gift', 'Gift item', .5, .5); self.drop = function () { self.y += 5; }; }); var Game = Container.expand(function () { var self = Container.call(this); var score = 0; var scoreTxt = new Text2(score.toString(), { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(.5, 0); LK.gui.topCenter.addChild(scoreTxt); var lives = 3; var hearts = []; for (var i = 0; i < lives; i++) { var heart = new Heart(); heart.x = i * (heart.width + 10); heart.y = 10; hearts.push(heart); LK.gui.topLeft.addChild(heart); } var santa = self.addChild(new Santa()); var gifts = []; santa.x = 2048 / 2; santa.y = 2732 - santa.height; var giftCreationInterval = LK.setInterval(function () { var gift = new Gift(); gift.x = Math.random() * 2048; gift.y = 0; gifts.push(gift); self.addChild(gift); }, 2000); LK.on('tick', function () { santa.move(); for (var i = 0; i < gifts.length; i++) { gifts[i].drop(); if (santa.intersects(gifts[i])) { santa.collect(gifts[i]); score++; scoreTxt.setText(score.toString()); gifts[i].destroy(); gifts.splice(i, 1); i--; if (hearts.length > 0) { var lostHeart = hearts.pop(); lostHeart.destroy(); } } else if (gifts[i].y > 2732) { gifts[i].destroy(); gifts.splice(i, 1); i--; if (--lives <= 0) { LK.showGameOver(); } else if (hearts.length > 0) { var lostHeart = hearts.pop(); lostHeart.destroy(); var grayHeart = new GrayHeart(); grayHeart.x = lostHeart.x; grayHeart.y = lostHeart.y; LK.gui.topLeft.addChild(grayHeart); } } } }); stage.on('down', function (obj) { var pos = obj.event.getLocalPosition(self); santa.x = pos.x; }); stage.on('move', function (obj) { var pos = obj.event.getLocalPosition(self); santa.x = pos.x; }); });
===================================================================
--- original.js
+++ change.js
@@ -1,7 +1,7 @@
var GrayHeart = Container.expand(function () {
var self = Container.call(this);
- var grayHeartGraphics = self.createAsset('grayHeart', 'Gray heart icon', 0, 0);
+ var grayHeartGraphics = self.createAsset('grayHeart', 'Gray Heart icon', 0, 0);
});
var Heart = Container.expand(function () {
var self = Container.call(this);
var heartGraphics = self.createAsset('heart', 'Heart icon', 0, 0);
@@ -58,26 +58,25 @@
scoreTxt.setText(score.toString());
gifts[i].destroy();
gifts.splice(i, 1);
i--;
- } else if (gifts[i] && gifts[i].y > 2732) {
+ if (hearts.length > 0) {
+ var lostHeart = hearts.pop();
+ lostHeart.destroy();
+ }
+ } else if (gifts[i].y > 2732) {
gifts[i].destroy();
gifts.splice(i, 1);
i--;
- if (gifts[i] && gifts[i].y > 2732) {
- gifts[i].destroy();
- gifts.splice(i, 1);
- i--;
- if (--lives <= 0) {
- LK.showGameOver();
- } else {
- var grayHeart = new GrayHeart();
- grayHeart.x = hearts[hearts.length - 1].x;
- grayHeart.y = hearts[hearts.length - 1].y;
- LK.gui.topLeft.addChild(grayHeart);
- var lostHeart = hearts.pop();
- lostHeart.destroy();
- }
+ if (--lives <= 0) {
+ LK.showGameOver();
+ } else if (hearts.length > 0) {
+ var lostHeart = hearts.pop();
+ lostHeart.destroy();
+ var grayHeart = new GrayHeart();
+ grayHeart.x = lostHeart.x;
+ grayHeart.y = lostHeart.y;
+ LK.gui.topLeft.addChild(grayHeart);
}
}
}
});
Pixelated Santa Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixeled Christmas present Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixalated heart empty Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixalated heart grey Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixelated snow flake Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
snowy ground image pixalated Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
snowy ground image pixalated 2D Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art a small image 2048 to serve as ground that has snow for a simple 2D game no trees not nothing only snow and ground to cover the ground width of the screen Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
gif pixel art for game background, snow on the ground, houses in the far background and moonligh, trees on the left and right, cozy Christmas atmosphere Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.