User prompt
add a gui button on the top right hireElf
User prompt
bug: I don't see the elf button
User prompt
add a yellow button : hireElf
User prompt
move the elf button to the top right
User prompt
add some margin on the top right of the elf
Code edit (1 edits merged)
Please save this source code
User prompt
double the elf size
Code edit (1 edits merged)
Please save this source code
User prompt
disable the elf button when score is under 5
User prompt
when elf button is clicked. remove 5 to the score and increase the new variable elfs by 1.
User prompt
Fix Bug: 'ReferenceError: score is not defined' in this line: 'if (score >= 5) {' Line Number: 15
User prompt
Fix Bug: 'ReferenceError: elves is not defined' in this line: 'elves += 1;' Line Number: 18
User prompt
write the number of elves
User prompt
Update giftPerSecond to take into account the number of elves : 1 elf => 1 click per second
User prompt
the number of elves also adds 1 point to the score per second
User prompt
bug: elves is added to the score every click instead of every second
User prompt
now the price of elves should double each time you buy one (1st elf cost 5; 2nd elf cost 10; 3rd elf cost 20; etc...)
User prompt
the elf icon should be enabled only when the score reaches the current elf price.
User prompt
show the current cost of elves in small font under the elf icon
Code edit (6 edits merged)
Please save this source code
Code edit (22 edits merged)
Please save this source code
User prompt
remove gifts when they are completly out of the screen
User prompt
add a global variable availableGiftsCounter
User prompt
Add a global variable availableGiftsCounter. When the big button is clicked, availableGiftsCounter is increased; update giftSpawnTimer to only spawn gifts if availableGifts is positive
User prompt
now every second add elves to availableGiftsCounter
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 Game = Container.expand(function () {
var self = Container.call(this);
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++;
giftWrapper.scale.set(4.5);
LK.setTimeout(function () {
giftWrapper.scale.set(5);
}, 300);
});
var gifts = [];
var score = 0;
var giftsPerSecond = 0;
var clickCount = 0;
var startTime = Date.now();
var scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
});
var giftsPerSecondTxt = new Text2('0', {
size: 100,
fill: "#ffffff"
});
scoreTxt.anchor.set(.5, 0);
giftsPerSecondTxt.anchor.set(.5, 1);
LK.gui.topCenter.addChild(scoreTxt);
LK.gui.bottom.addChild(giftsPerSecondTxt);
var hireElfButton = new Text2('Hire Elf', {
size: 100,
fill: "#ffffff"
});
hireElfButton.anchor.set(1, 0);
hireElfButton.x = 2048;
hireElfButton.y = 0;
LK.gui.topRight.addChild(hireElfButton);
hireElfButton.on('down', function () {});
var giftSpawnTimer = LK.setInterval(function () {
giftWrapper.destroy();
var newGift = new Gift();
newGift.x = Math.random() * 2048;
newGift.y = 0;
gifts.push(newGift);
self.addChild(newGift);
self.addChild(giftWrapper);
}, 1000);
LK.on('tick', function () {
var currentTime = Date.now();
var elapsedTime = (currentTime - startTime) / 1000;
giftsPerSecond = clickCount / elapsedTime;
for (var a = gifts.length - 1; a >= 0; a--) {
gifts[a].move();
if (gifts[a].y > 2732) {
gifts[a].destroy();
gifts.splice(a, 1);
}
}
scoreTxt.setText(score);
giftsPerSecondTxt.setText('Gifts/sec: ' + giftsPerSecond.toFixed(2));
});
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.