User prompt
Fix Bug: 'TypeError: LK.dispatchEvent is not a function' in this line: 'LK.dispatchEvent('giftTouchedGround', {' Line Number: 52
User prompt
Fix Bug: 'Uncaught ReferenceError: color is not defined' in this line: 'var heartGraphics = self.createAsset(color === 'gray' ? 'grayHeart' : 'heart', 'Heart icon', 0, 0);' Line Number: 23
User prompt
If the present touches the ground you loose one health. The health heart icon is replaced with a new one the gray heart.
User prompt
the game doesn't work !
User prompt
Fix bugs
User prompt
Fix Bug: 'ReferenceError: lives is not defined' in this line: 'if (--lives < hearts.length) {' Line Number: 50
User prompt
if the gifts touch the ground then lose one health a heart image is replace. If three gifts touch the ground you lose the game
User prompt
the gifts have touch sant to get a score
User prompt
presents can not be outside of the screen
User prompt
Fix Bug: 'Timeout.tick error: santa is not defined' in this line: 'self.santa = santa;' Line Number: 44
User prompt
Fix Bug: 'Timeout.tick error: santa is not defined' in this line: 'var self = Container.call(this, santa);' Line Number: 40
User prompt
run current code
User prompt
Fix Bug: 'TypeError: LK.audio.play is not a function' in this line: 'LK.audio.play('collect_sound');' Line Number: 103
User prompt
Add sound when santa pics a present
User prompt
if a present is missed santa loses one heart. The heart is replace by an new image a gray heart. If santa mises three presents is game over.
User prompt
add borders to the presents so that they also don't go outside the screen.
User prompt
extent the background to fill from left to right and down. Add borders to the presents and to santa so that they don't go outside the screen.
User prompt
Fix Bug: 'ReferenceError: santa is not defined' in this line: 'if (self.y < 2732 - santa.height) {' Line Number: 35
User prompt
the three hearts are the health. If one present is missed one heart is lost and the heart image is replaced with a gray heart. the score is at the same height as the hearts. The presents disappear when they reach the level of the santa image line. Add a image under santa that fills the area. Add snow with paralax effect. in the baground falls slower the in the forgraound.
User prompt
Fix Bug: 'TypeError: (intermediate value).setInteractive is not a function' in this line: 'var tryAgainButton = new Text2('Try Again', {' Line Number: 93
User prompt
Fix Bug: 'TypeError: (intermediate value).set is not a function' in this line: 'LK.gui.topCenter.addChild(new Text2('Highscore: ' + highscore, {' Line Number: 85
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'setItem')' in this line: 'localStorage.setItem('highscore', highscore.toString());' Line Number: 82
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var highscore = Math.max(score, parseInt((typeof localStorage !== 'undefined' ? localStorage.getItem(highscoreKey) : '0') || '0', 10));' Line Number: 81
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var highscore = Math.max(score, parseInt((typeof localStorage !== 'undefined' ? localStorage.getItem(highscoreKey) : '0') || '0', 10));' Line Number: 81
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var highscore = Math.max(score, parseInt((typeof localStorage !== 'undefined' ? localStorage.getItem(highscoreKey) : '0') || '0', 10));' Line Number: 81
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--; } else if (gifts[i].y > 2732) { gifts[i].destroy(); gifts.splice(i, 1); i--; if (--lives <= 0) { LK.showGameOver(); var lateForChristmasText = new Text2('LATE FOR CHRISTMAS', { size: 150, fill: '#ffffff' }); lateForChristmasText.x = 2048 / 2; lateForChristmasText.y = 2732 / 2 - 300; lateForChristmasText.anchor.set(0.5, 0.5); LK.gui.topCenter.addChild(lateForChristmasText); var scoreText = new Text2('Score: ' + score, { size: 120, fill: '#ffffff' }); scoreText.x = 2048 / 2; scoreText.y = 2732 / 2 - 150; scoreText.anchor.set(0.5, 0.5); LK.gui.topCenter.addChild(scoreText); var highscoreKey = 'highscore'; var highscore = Math.max(score, Number((typeof localStorage !== 'undefined' ? localStorage.getItem(highscoreKey) : '0') || '0')); localStorage.setItem('highscore', highscore.toString()); LK.gui.topCenter.addChild(new Text2('Highscore: ' + highscore, { size: 120, fill: '#ffffff' }).set({ x: 2048 / 2, y: 2732 / 2 }).anchor.set(0.5, 0.5)); var tryAgainButton = new Text2('Try Again', { size: 100, fill: '#ffffff' }).setInteractive(true).set({ x: 2048 / 2, y: 2732 / 2 + 150 }).anchor.set(0.5, 0.5); tryAgainButton.on('down', function () { LK.resetGame(); }); LK.gui.topCenter.addChild(tryAgainButton); } } } }); 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
@@ -77,9 +77,9 @@
scoreText.y = 2732 / 2 - 150;
scoreText.anchor.set(0.5, 0.5);
LK.gui.topCenter.addChild(scoreText);
var highscoreKey = 'highscore';
- var highscore = Math.max(score, parseInt((typeof localStorage !== 'undefined' ? localStorage.getItem(highscoreKey) : '0') || '0', 10));
+ var highscore = Math.max(score, Number((typeof localStorage !== 'undefined' ? localStorage.getItem(highscoreKey) : '0') || '0'));
localStorage.setItem('highscore', highscore.toString());
LK.gui.topCenter.addChild(new Text2('Highscore: ' + highscore, {
size: 120,
fill: '#ffffff'
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.