User prompt
Add a text field inside PopUpNumber with a text "Income"
User prompt
add a text inside popupnumber
User prompt
make pop up move ease in
User prompt
make pop up number as a text same as score
User prompt
Fix Bug: 'TypeError: numberGraphics.setText is not a function' in this line: 'numberGraphics.setText(text);' Line Number: 16
User prompt
Fix Bug: 'TypeError: popUpNumber.setText is not a function' in this line: 'popUpNumber.setText('🍬' + clickPower);' Line Number: 58
User prompt
make a pop up number format same as score. It have to appear, then fly away, then disappear -like particles fountain
User prompt
Make a pop-up number after each click, but fly a bit a different direction each time
User prompt
Please make candy being an UI button and handle onlcik by bouncing image a bit
User prompt
Please remove auto incremental on time
User prompt
Please add🍬emoji on a score text
Initial prompt
🍬Candy🍬 Clicker
var PopUpNumber = Container.expand(function () { var self = Container.call(this); var numberGraphics = self.createAsset('number', 'Number Graphics', .5, .5); var incomeText = self.createAsset('incomeText', 'Income Text', .5, .5); incomeText.text = 'Income'; self.fly = function (direction) { var speed = 10; var deceleration = 0.95; var flyInterval = LK.setInterval(function () { speed *= deceleration; self.x += Math.cos(direction) * speed; self.y += Math.sin(direction) * speed; self.alpha -= 0.01; numberGraphics.alpha -= 0.01; if (self.alpha <= 0 || speed < 0.1) { LK.clearInterval(flyInterval); self.destroy(); } }, 16); }; self.setText = function (text) { numberGraphics.text = '🍬' + text; }; }); var Candy = Container.expand(function () { var self = Container.call(this); var candyGraphics = self.createAsset('candy', 'Candy Graphics', .5, .5); self.click = function () { self.scale.x = 1.1; self.scale.y = 1.1; LK.setTimeout(function () { self.scale.x = 1; self.scale.y = 1; }, 100); }; }); var Upgrade = Container.expand(function () { var self = Container.call(this); var upgradeGraphics = self.createAsset('upgrade', 'Upgrade Graphics', .5, .5); self.click = function () {}; }); var Game = Container.expand(function () { var self = Container.call(this); var score = 0; var clickPower = 1; var candy = self.addChild(new Candy()); var upgrade = self.addChild(new Upgrade()); candy.x = 2048 / 2; candy.y = 2732 / 2; upgrade.x = 2048 / 2; upgrade.y = 2732 / 2 + 200; var scoreTxt = new Text2('🍬0', { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(.5, 0); LK.gui.topCenter.addChild(scoreTxt); candy.on('down', function (obj) { candy.click(); score += clickPower; scoreTxt.setText('🍬' + score); var popUpNumber = self.addChild(new PopUpNumber()); popUpNumber.x = candy.x; popUpNumber.y = candy.y; var direction = Math.random() * Math.PI * 2; popUpNumber.fly(direction); popUpNumber.setText('🍬' + clickPower); }); upgrade.on('down', function (obj) { if (score >= 10) { score -= 10; clickPower += 1; scoreTxt.setText('🍬' + score); } }); });
===================================================================
--- original.js
+++ change.js
@@ -1,7 +1,9 @@
var PopUpNumber = Container.expand(function () {
var self = Container.call(this);
var numberGraphics = self.createAsset('number', 'Number Graphics', .5, .5);
+ var incomeText = self.createAsset('incomeText', 'Income Text', .5, .5);
+ incomeText.text = 'Income';
self.fly = function (direction) {
var speed = 10;
var deceleration = 0.95;
var flyInterval = LK.setInterval(function () {