User prompt
Fix Bug: 'Timeout.tick error: Can't find variable: startTime' in or related to this line: 'var currentTime = Math.floor((Date.now() - startTime) / 1000);' Line Number: 554
User prompt
Add a timerText at the top left
Code edit (4 edits merged)
Please save this source code
User prompt
Donβt do it, Just tell me how can I make the stocknumber text position fixed ? Independent from Texts lenghts
User prompt
Just tell me how can I make the stocknumber text position fixed ? Independent from Texts lenghts
User prompt
So how can I make the stocknumber text position fixed ? Independent from Texts lenghts
Code edit (5 edits merged)
Please save this source code
User prompt
Fix Bug: 'Script error.' in or related to this line: 'LK.gui.roght.addChild(stockValueText);' Line Number: 400
Code edit (1 edits merged)
Please save this source code
User prompt
Add a timerIcon at the left of the balance icon
Code edit (3 edits merged)
Please save this source code
User prompt
Disable sell button when player has no stocks
Code edit (1 edits merged)
Please save this source code
Code edit (11 edits merged)
Please save this source code
User prompt
make stockValueText follow the current segment y
Code edit (6 edits merged)
Please save this source code
User prompt
move the stock price to the left center
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Add a new text2 named socksNumber, in the same way as balanceText
Code edit (1 edits merged)
Please save this source code
Code edit (18 edits merged)
Please save this source code
User prompt
Fix Bug: 'Uncaught ReferenceError: BalanceIcon is not defined' in or related to this line: 'var balanceIcon = game.addChild(new BalanceIcon());' Line Number: 307
User prompt
Add a new stockIcon asset similar to balanceIcon, place it at the right of balanceIcon
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -63,9 +63,10 @@
}
}
if (moveSegmentsVertically) {
var currentDelta = horizontalAxis.y - lowerLimit;
- var targetY = lowerLimit - dollarToYPixelRatio * self.stockValue1 + currentDelta;
+ var targetY = lowerLimit - self.stockValue1 * dollarToYPixelRatio + currentDelta;
+ //targetY = dollarToYPixelRatio * self.stockValue1 + currentDelta; // TEMP DEBUG TEST
var deltaY = (targetY - self.y) * interpolationSpeed;
self.y += deltaY;
if (Math.abs(deltaY) <= 1) {
self.y = targetY;
@@ -229,14 +230,14 @@
/****
* Game Code
****/
-var debug = true;
+var debug = false;
var slideAmount = 6.5;
var slideAmountVertical = 0.10; // Reduced speed for smoother vertical movement
var moveSegmentsVertically = false;
var verticalSlideThreshold = 500; // Define a global threshold for vertical sliding
-var upperLimit = game.height * 0.5;
+var upperLimit = game.height * 0.25;
var lowerLimit = game.height * 0.75; // Define lowerLimit for use in segment positioning
var axisLabelFontSize = 50;
var running = false;
var moveSegments = false;
@@ -256,9 +257,9 @@
var graphWidth = game.width;
var segmentWidth = graphWidth / 5; //; / stockValuesHistory.length;
var dollarToYPixelRatio = game.height * 0.5 / 100;
var segmentDrawInterval = null;
-var secondsPerSegment = 3.0;
+var secondsPerSegment = 2.0;
var stockDisplay = []; // Array to hold stock display elements
/****
* UI Elements
****/
@@ -355,10 +356,12 @@
var stockValueText = new Text2('Price\n$' + stockValuesHistory[stockValuesHistory.length - 1].toFixed(0), {
size: 50,
fill: "#ffffff"
});
-stockValueText.anchor.set(1, 0);
-LK.gui.topRight.addChild(stockValueText);
+stockValueText.anchor.set(0.5, 0);
+stockValueText.x = game.width * 0.5;
+stockValueText.y = game.height * 0.5 - stockValueText.height / 2;
+LK.gui.left.addChild(stockValueText);
function updateStockValueText() {
if (graphIndex < stockValuesHistory.length) {
stockValueText.setText('Price\n\t$' + stockValuesHistory[graphIndex + 1].toFixed(0));
}
@@ -410,9 +413,9 @@
if (nextSegmentEndY < upperLimit || nextSegmentEndY > upperLimit && stockValuesHistory[graphIndex + 1] >= 100) {
moveSegmentsVertically = true;
console.log('Start moveSegmentsVertically');
}
- var delay = 0.95; // Reduce delay to speed up the drawing of segments
+ var delay = 0.5; // Reduce delay to speed up the drawing of segments
drawingInProgress = true;
drawSegment(game, graphIndex, pointA.x, pointA.y, nextSegmentRotation, distance, delay);
}
}
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.