User prompt
make the hearts text smaller
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var highscore = Math.max(currentScore, parseInt(window.localStorage && localStorage.getItem('highscore') || '0'));' Line Number: 59
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'getItem')' in this line: 'var highscore = Math.max(currentScore, parseInt(localStorage.getItem('highscore') || '0'));' Line Number: 59
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var highscore = Math.max(currentScore, parseInt((typeof localStorage !== 'undefined' ? localStorage.getItem('highscore') : '0') || '0', 10));' Line Number: 59
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var highscore = Math.max(currentScore, parseInt((typeof localStorage !== 'undefined' ? localStorage.getItem('highscore') : '0') || '0', 10));' Line Number: 59
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var highscore = Math.max(currentScore, parseInt((typeof localStorage !== 'undefined' ? localStorage.getItem('highscore') : '0') || '0', 10));' Line Number: 59
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var highscore = Math.max(currentScore, parseInt((typeof localStorage !== 'undefined' ? localStorage.getItem('highscore') : '0') || '0', 10));' Line Number: 59
User prompt
Fix Bug: 'TypeError: window.parseInt is not a function' in this line: 'var highscore = Math.max(currentScore, window.parseInt((typeof localStorage !== 'undefined' ? localStorage.getItem('highscore') : '0') || '0', 10));' Line Number: 59
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var highscore = Math.max(currentScore, parseInt((typeof localStorage !== 'undefined' ? localStorage.getItem('highscore') : '0') || '0', 10));' Line Number: 59
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var highscore = Math.max(currentScore, parseInt((typeof localStorage !== 'undefined' ? localStorage.getItem('highscore') : '0') || '0', 10));' Line Number: 59
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var highscore = Math.max(currentScore, parseInt((typeof localStorage !== 'undefined' ? localStorage.getItem('highscore') : '0') || '0', 10));' Line Number: 59
User prompt
Fix Bug: 'TypeError: parseInt is not a function' in this line: 'var highscore = Math.max(currentScore, parseInt((typeof localStorage !== 'undefined' ? localStorage.getItem('highscore') : '0') || '0'));' Line Number: 59
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'getItem')' in this line: 'var highscore = Math.max(currentScore, parseInt(localStorage.getItem('highscore') || '0'));' Line Number: 59
User prompt
Add a highscore meter to the game and make the hearts text smaller
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'height')' in this line: 'highScoreTxt.y = scoreTxt.height + 20;' Line Number: 42
User prompt
Fix Bug: 'Uncaught TypeError: LK.getHighScore is not a function' in this line: 'var highScore = Math.max(LK.getHighScore(), LK.getScore());' Line Number: 36
User prompt
add a high score meter
User prompt
remove the hearts sprite and instead add a hearts counter next to the score
User prompt
to the score, not to the player
User prompt
move the hearts right next to the score
User prompt
move the hearts sprite up in the right corner
User prompt
add a hearts asset
User prompt
add a hearts asset
var Gift = Container.expand(function () {
var self = Container.call(this);
var giftGraphics = self.createAsset('gift', 'Gift Graphics', .5, .5);
self.speed = 5;
self.move = function () {
self.y += self.speed;
};
});
var Asteroid = Container.expand(function () {
var self = Container.call(this);
var asteroidGraphics = self.createAsset('asteroid', 'Asteroid Graphics', .5, .5);
self.speed = 7;
self.move = function () {
self.y += self.speed;
};
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.createAsset('player', 'Player Graphics', .5, .5);
self.speed = 10;
self.hearts = 3;
self.heartsAsset = self.createAsset('hearts', 'Hearts Graphics', 0.5, 0.5);
self.heartsAsset.x = playerGraphics.width * 0.6;
self.heartsAsset.y = -playerGraphics.height * 0.6;
self.addChild(self.heartsAsset);
self.move = function (x, y) {
self.x = x;
self.y = y;
};
});
var Game = Container.expand(function () {
var self = Container.call(this);
var background = self.createAsset('festiveBackground', 'Festive Background', 0, 0);
self.addChildAt(background, 0);
var gifts = [];
var asteroids = [];
var player = self.addChild(new Player());
player.x = 2048 / 2;
player.y = 2732 / 2;
var scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
});
LK.setScore(0);
scoreTxt.setText(0);
scoreTxt.anchor.set(.5, 0);
LK.gui.topCenter.addChild(scoreTxt);
var dragNode = null;
player.on('down', function (obj) {
dragNode = player;
});
function handleMove(obj) {
var event = obj.event;
var pos = event.getLocalPosition(self);
if (dragNode) {
dragNode.move(pos.x, pos.y);
}
}
stage.on('move', handleMove);
stage.on('up', function (obj) {
dragNode = null;
});
LK.on('tick', function () {
for (var a = gifts.length - 1; a >= 0; a--) {
gifts[a].move();
if (gifts[a].y > 2732) {
gifts[a].destroy();
gifts.splice(a, 1);
} else if (player.intersects(gifts[a])) {
LK.setScore(LK.getScore() + 10);
scoreTxt.setText(LK.getScore());
gifts[a].destroy();
gifts.splice(a, 1);
}
}
for (var a = asteroids.length - 1; a >= 0; a--) {
var asteroid = asteroids[a];
if (asteroid) {
asteroid.move();
if (asteroid.y > 2732) {
asteroid.destroy();
asteroids.splice(a, 1);
} else if (player.intersects(asteroid)) {
player.hearts = Math.max(player.hearts - 1, 0);
if (player.hearts <= 0) {
LK.showGameOver();
}
asteroid.destroy();
asteroids.splice(a, 1);
}
}
}
if (LK.ticks % 60 == 0) {
var newGift = new Gift();
newGift.x = Math.random() * 2048;
newGift.y = 0;
gifts.push(newGift);
self.addChild(newGift);
}
if (LK.ticks % 30 == 0) {
var newAsteroid = new Asteroid();
newAsteroid.x = Math.random() * 2048;
newAsteroid.y = 0;
asteroids.push(newAsteroid);
self.addChild(newAsteroid);
}
});
});
Asteroid, falling Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Red gift Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Santas sled, with santa in it Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. Top down view
festive background Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.