User prompt
play victory sound at the end if profit > 0 and play failed sound if < 0
User prompt
play corresponding sounds when buying or selling
User prompt
increase and decrease should be played during the game not only on game preparation
User prompt
play increase and decrease sounds when value change
User prompt
play countdown sound during the initial countdown
User prompt
Migrate to the latest version of LK
Code edit (9 edits merged)
Please save this source code
User prompt
buyButton should be enabled only when mar = true (game running)
Code edit (2 edits merged)
Please save this source code
User prompt
Add a big 3 second countdown before starting game
User prompt
set the score to be the profit using LK.setScore()
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'Uncaught LK.Game can only be initialized once' in or related to this line: 'var j = new LK.Game({});' Line Number: 301
Code edit (9 edits merged)
Please save this source code
User prompt
Fix Bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'destroy')' in or related to this line: 'confetti.destroy();' Line Number: 353
Code edit (1 edits merged)
Please save this source code
User prompt
make confetti rotation random
Code edit (1 edits merged)
Please save this source code
User prompt
fix the conffetti colors not applying
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'Timeout.tick error: game.getChildByName is not a function' in or related to this line: 'if (profit > 0 && !game.getChildByName('confetti')) {' Line Number: 333
User prompt
Confettiis called to much times
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'Timeout.tick error: confettiColors is not defined' in or related to this line: 'var particle = self.addChild(LK.getAsset('segment', {' Line Number: 265
User prompt
in Confetti Change the ' Math.random() * 0xFFFFFF,' , use an array of colors instead
===================================================================
--- original.js
+++ change.js
@@ -288,8 +288,9 @@
}
function gr() {
p.liquidate();
var profit = p.getBalance() - md;
+ LK.setScore(profit);
var popup = j.addChild(LK.getAsset('popup', {
anchorX: 0.5,
anchorY: 0.5
}));
@@ -493,64 +494,62 @@
}
if (!dip) {
updateStockValueText();
buyButton.updateButtonState();
- var pointA = gp[gi];
- var pointB = gp[gi + 1];
- var deltaY = pointB.y - pointA.y;
- var deltaX = pointB.x - pointA.x;
- var nextSegmentRotation = Math.atan2(deltaY, deltaX);
- if (deltaX < 0 || deltaY > 0) {}
- var distance = Math.sqrt(Math.pow(pointB.x - pointA.x, 2) + Math.pow(pointB.y - pointA.y, 2));
- var lastSegment = gss.length > 0 ? gss[gss.length - 1] : null;
- var lastSegmentEndX = lastSegment ? lastSegment.x + Math.cos(lastSegment.rotation) * lastSegment.width : gp[gi].x;
- var lastSegmentEndY = lastSegment ? lastSegment.y + Math.sin(lastSegment.rotation) * lastSegment.width : gp[gi].y;
- pointA.x = lastSegmentEndX;
- pointA.y = lastSegmentEndY > ll ? ll : lastSegmentEndY;
- var nextSegmentEndY = pointA.y + Math.sin(nextSegmentRotation) * distance;
- if (nextSegmentEndY > ll) {
- distance = (ll - pointA.y) / Math.sin(nextSegmentRotation);
+ var prp = gp[gi];
+ var sep = gp[gi + 1];
+ var ec1 = sep.y - prp.y;
+ var ec2 = sep.x - prp.x;
+ var aes = Math.atan2(ec1, ec2);
+ var lon = Math.sqrt(Math.pow(sep.x - prp.x, 2) + Math.pow(sep.y - prp.y, 2));
+ var pres = gss.length > 0 ? gss[gss.length - 1] : null;
+ var pr1 = pres ? pres.x + Math.cos(pres.rotation) * pres.width : gp[gi].x;
+ var pr2 = pres ? pres.y + Math.sin(pres.rotation) * pres.width : gp[gi].y;
+ prp.x = pr1;
+ prp.y = pr2 > ll ? ll : pr2;
+ var fie = prp.y + Math.sin(aes) * lon;
+ if (fie > ll) {
+ lon = (ll - prp.y) / Math.sin(aes);
}
- if (nextSegmentEndY < ul || nextSegmentEndY >= j.height * 0.5 && svh[gi + 1] >= 100 && deltaY != 0) {
- msv = -1 * Math.sign(deltaY);
+ if (fie < ul || fie >= j.height * 0.5 && svh[gi + 1] >= 100 && ec1 != 0) {
+ msv = -1 * Math.sign(ec1);
} else {
msv = 0;
}
- var delay = 0.5;
dip = true;
- dar(j, gi, pointA.x, pointA.y, nextSegmentRotation, distance, delay);
+ dar(j, gi, prp.x, prp.y, aes, lon, 0.5);
}
}
-function dar(gameRef, index, x1, y1, rotation, width, delay) {
- var segment = gameRef.addChild(new gs());
- segment.index1 = index;
- segment.pad = svh[index];
- segment.paf = svh[index + 1];
- segment.x1 = x1;
- segment.y1 = y1;
- segment.rotation = rotation;
- segment.width = 1;
- segment.height = 20;
- gss.push(segment);
- segment.x = x1;
- segment.y = y1;
+function dar(jr, nu, p1, p2, an, lon, du) {
+ var arre = jr.addChild(new gs());
+ arre.index1 = nu;
+ arre.pad = svh[nu];
+ arre.paf = svh[nu + 1];
+ arre.x1 = p1;
+ arre.y1 = p2;
+ arre.rotation = an;
+ arre.width = 1;
+ arre.height = 20;
+ gss.push(arre);
+ arre.x = p1;
+ arre.y = p2;
var startTime = Date.now();
- var endTime = startTime + delay * 1000 * sps;
+ var endTime = startTime + du * 1000 * sps;
var mlg = function mlg() {
if (!mar) {
return;
}
var currentTime = Date.now();
var timeElapsed = currentTime - startTime;
- var newWidth = Math.min(timeElapsed / (delay * 1000 * sps) * width, width);
- segment.width = newWidth;
+ var nlo = Math.min(timeElapsed / (du * 1000 * sps) * lon, lon);
+ arre.width = nlo;
if (currentTime < endTime) {
LK.setTimeout(mlg, 16);
} else {
- if (!ms && segment.x + segment.width / 2 >= j.width * 0.5) {
+ if (!ms && arre.x + arre.width / 2 >= j.width * 0.5) {
ms = true;
}
- segment.ater = true;
+ arre.ater = true;
gi++;
dip = false;
}
};
A Technical dark background. Nothing just a gradiant of colors from black to dark blue. Theme : stock market. background
A modern clean empty rectangular button without borders. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
without shadow
a basic empty ui popup with a black background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.