User prompt
Fix Bug: 'Timeout.tick error: Gift is not defined' in this line: 'var newGift = elves > 0 ? new ElfGift() : new Gift();' Line Number: 83
User prompt
add a new asset named elfGift
User prompt
add a new asset named elfGift in addition to the existing gift. keep the current gifts and add another asset for elfGift
User prompt
now, when elves > 0 spawn elfGift along with gift
Code edit (2 edits merged)
Please save this source code
User prompt
Add a couple of assets workingElf1 and workingElf2, that passes from the left side of the screen to the right one when elves > 0
Code edit (1 edits merged)
Please save this source code
User prompt
make the workingElf move
User prompt
Fix Bug: 'TypeError: self is undefined' in this line: 'for (var i = self.children.length - 1; i >= 0; i--) {' Line Number: 45
Code edit (5 edits merged)
Please save this source code
User prompt
keep workingElf1 and remove workingElf2
User prompt
make workingElf randomely appear from the left and move to the right or appear on the right side of the screen and move to the left
User prompt
when workingElf doesn't start from left, flip them horizontally
Code edit (3 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: workingElf is not defined' in this line: 'if (workingElf.startFromLeft && workingElves[e].x > 2048 + workingElves[e].width || workingElves[e].x < -workingElves[e].width) {' Line Number: 148
Code edit (3 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
Add a new variable secondsBeforeChrismas and display its value at the bottom right of the screen
Code edit (5 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: LK.gui.bottomCenter is undefined' in this line: 'LK.gui.bottomCenter.addChild(secondsBeforeChristmasTxt);' Line Number: 88
Code edit (5 edits merged)
Please save this source code
User prompt
add a label above the score : "Gifts needed"
Code edit (7 edits merged)
Please save this source code
User prompt
create a variable humans = 8000000; update the score display to write the value : humans-score
Code edit (1 edits merged)
Please save this source code
var score = 0;
var elves = 0;
var availableGiftsCounter = 0;
var ElfGift = Container.expand(function () {
var self = Container.call(this);
var elfGiftGraphics = self.createAsset('elfGift', 'Elf Prepared Gift Graphics', .5, .5);
self.speed = 5;
self.move = function () {
self.y += self.speed;
};
});
var HireElfButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.createAsset('hireElf', 'Hire Elf Button', 0.5, 0.5);
buttonGraphics.scale.set(2);
buttonGraphics.tint = 0xffff00;
self.on('down', function () {
var elfCost = Math.pow(2, elves) * 5;
if (score >= elfCost) {
score -= elfCost;
elves += 1;
}
});
});
var Game = Container.expand(function () {
var self = Container.call(this);
var background = self.createAsset('background', 'Background Image', 0, 0);
background.scale.set(2, 3);
self.addChildAt(background, 0);
var giftWrapper = self.createAsset('giftWrapper', 'Big central button', 0.5, 0.5);
giftWrapper.scale.set(5);
giftWrapper.x = 2048 / 2;
giftWrapper.y = 2732 / 2;
giftWrapper.on('down', function () {
clickCount++;
score++;
availableGiftsCounter++;
giftWrapper.scale.set(4.5);
LK.setTimeout(function () {
giftWrapper.scale.set(5);
}, 300);
});
var gifts = [];
var giftsPerSecond = 0;
var clickCount = 0;
var startTime = Date.now();
var scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
});
var elvesTxt = new Text2('0', {
size: 100,
fill: "#ffffff"
});
var giftsPerSecondTxt = new Text2('0', {
size: 50,
fill: "#ffffff"
});
var hireElfButton = self.addChild(new HireElfButton());
var elfCostTxt = new Text2('5G', {
size: 50,
fill: "#ffffff"
});
elfCostTxt.anchor.set(0.5, 0);
hireElfButton.x = 2048 - hireElfButton.width / 2 - 40;
hireElfButton.y = hireElfButton.height / 2 + 40;
elfCostTxt.x = 1340;
elfCostTxt.y = 175;
LK.gui.addChild(elfCostTxt);
scoreTxt.anchor.set(.5, 0);
LK.gui.topCenter.addChild(scoreTxt);
LK.gui.topCenter.addChild(elvesTxt);
elvesTxt.x = scoreTxt.x + 460;
elvesTxt.y = scoreTxt.y + 40;
LK.gui.topLeft.addChild(giftsPerSecondTxt);
giftsPerSecondTxt.anchor.set(0, -1);
var giftSpawnTimer = LK.setInterval(function () {
availableGiftsCounter += elves;
if (availableGiftsCounter > 0) {
availableGiftsCounter--;
giftWrapper.destroy();
hireElfButton.destroy();
var newGift = new ElfGift();
newGift.x = Math.random() * 2048;
newGift.y = 0;
gifts.push(newGift);
self.addChild(newGift);
self.addChild(giftWrapper);
self.addChild(hireElfButton);
score += elves;
}
}, 1000);
LK.on('tick', function () {
var currentTime = Date.now();
var elapsedTime = (currentTime - startTime) / 1000;
giftsPerSecond = (clickCount + elves * elapsedTime) / elapsedTime;
for (var a = gifts.length - 1; a >= 0; a--) {
gifts[a].move();
if (gifts[a].y > 2732 + gifts[a].height) {
gifts[a].destroy();
gifts.splice(a, 1);
}
}
scoreTxt.setText(score + 'G');
elvesTxt.setText(elves);
var elfCost = Math.pow(2, elves) * 5;
elfCostTxt.setText(elfCost + 'G');
hireElfButton.alpha = score < elfCost ? 0.5 : 1;
hireElfButton.interactive = score >= elfCost;
giftsPerSecondTxt.setText('Gifts/sec: ' + Math.round(giftsPerSecond));
});
stage.on('down', function (obj) {
var event = obj.event;
var pos = event.getLocalPosition(self);
for (var a = gifts.length - 1; a >= 0; a--) {
if (gifts[a].intersects({
x: pos.x,
y: pos.y,
width: 1,
height: 1
})) {
clickCount++;
gifts[a].destroy();
gifts.splice(a, 1);
score++;
}
}
});
});
A big red christmas gift, isometric view Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Top view of a round gift box with a ribbon Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a cute elf Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A big green christmas gift, isometric view Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Profil view of a cute little elf with a green hat, standing with his hands in front of him.no background . no floor. In-Game asset. 2d. Blank background. High contrast. No shadows.
A feerical landscape with santa's house, pines, snow, glowing lights, at night. In the front, cute elves with gree hats, gingerbread boys, teddy bears, celebrating, but no Santa Clauss in the image. Background image. High contrast. No shadows.
Provile view of Santa clauss in his sleigh with reindeer, smiling and making a sign with his hand game Asset. High contrast. No shadows.
A sad landscape with santa's house, pines, snow, mountains in the back, at night. A cute sad santa crying with big tears in the front. clean feeric style. Background image. 2d. Blank background. Color. High contrast. No shadows.
a cute gingerbread boy Single Game Texture. 2d. Transparent background. High contrast. No shadows.
A big gingerbread christmas gift, isometric view Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A right profile drawing of one single cute little gingerbread boy, standing with his hands in front of him. In-Game asset. 2d. No background. High contrast. No shadows. Color. digital art
a cute smiling teddy bear standing Single Game Texture. 2d. Transparent background. High contrast. No shadows. No border.
A cute brown teddy bear from his right profile, standing, looking to the right direction and smiling with his hands in front of him. Feeric style. No background. No shadows. No back light. High contrast. Single Game Texture. In-Game asset. 2d.
a little green soldier toy standing Single Game Texture. 2d. Transparent background. High contrast. No shadows.
Profil view of a little green soldier toy, walking. no background . no floor. In-Game asset. 2d. Blank background. High contrast. No shadows.
a cute little santa's reindeer with a red nose sitting Single Game Texture. 2d. Transparent background. High contrast. No shadows.
A big white and red dotted christmas gift, isometric view Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Profil view of a cute little santa's reindeer with a red nose, walking in the right direction. no background . no floor. In-Game asset. 2d. Blank background. High contrast. No shadows.
a cute little grinch standing with a santa's hat Single Game Texture. 2d. Transparent background. High contrast. No shadows.
A big purple and green dotted christmas gift, isometric view Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Profile view of a mischievous little green grinch with a red scarf, big ears but no tail. Walking in the right direction. no background . no floor. In-Game asset. 2d. Blank background. High contrast. No shadows.
a cute little fairy standing with a santa hat and a magic wand Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A big light blue decorated christmas gift, isometric view Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Profile view of a cute little fairy with a santa hat and a magic wand. Flying in the right direction. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a landscape with santa's house on the left, pines with chistmas lights, snow, at night Background image. 2d. High contrast.
a big light brown and yellow christmas gift decorated with holly leaf. isometric view. no floor. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a big green and white christmas gift ornated. isometric view. nothing under. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.