Code edit (2 edits merged)
Please save this source code
User prompt
move the dynamix labels to the center of the screen
User prompt
I see no labels yet :(
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'set')' in or related to this line: 'label.anchor.set(1, 0.5);' Line Number: 85
User prompt
place the dynamic labels on the right
User prompt
fiw labels aren't visible
Code edit (2 edits merged)
Please save this source code
User prompt
add dynamic labels on the left of the graph
Code edit (1 edits merged)
Please save this source code
User prompt
Fix : logs "17652VM215:149 Zoom oout from 1 to 0.1"but scaleX never changes
User prompt
Fix : Zoom oout from undefined to 0.1
Code edit (9 edits merged)
Please save this source code
User prompt
before gameover, make a zoom out in order to view the whole graph, with all its segments
Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
make markerAxis transparent
Code edit (2 edits merged)
Please save this source code
User prompt
update the line distance = distance; to Adjust distance to ensure segment's end doesn't exeed lowerLimit
Code edit (9 edits merged)
Please save this source code
User prompt
Fix Bug: 'Timeout.tick error: lowerLimit is not defined' in or related to this line: 'pointA.y = Math.max(lowerLimit, lastSegmentEndY);' Line Number: 288
User prompt
Fix Bug: 'Timeout.tick error: lowerLimiy is not defined' in or related to this line: 'pointA.y = Math.max(lowerLimiy, lastSegmentEndY);' Line Number: 288
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
in console log "new segment index=..." convert rotation to degrees
===================================================================
--- original.js
+++ change.js
@@ -11,9 +11,9 @@
self.x2 = 0;
self.y2 = 0;
self.isFinished = false;
var verticalSlideRatio = 1;
- var interpolationSpeed = 0.04; // Adjust this value for speed
+ var interpolationSpeed = 0.5; // Adjust this value for speed
self.updateSlide = function () {
if (moveSegments) {
self.x -= slideAmount * 1;
}
@@ -102,12 +102,27 @@
/****
* Game Code
****/
+function triggerZoomOut() {
+ var zoomOutInterval = LK.setInterval(function () {
+ var currentScale = game.scaleX;
+ var minScale = 0.1; // Determine the minimum scale factor based on the total graph width
+ var scaleStep = 0.01; // Define the step by which to decrease the scale
+ if (currentScale > minScale) {
+ game.scaleX -= scaleStep;
+ game.scaleY -= scaleStep;
+ } else {
+ LK.clearInterval(zoomOutInterval);
+ LK.showGameOver();
+ }
+ }, 16);
+}
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.35;
var lowerLimit = game.height * 0.75; // Define lowerLimit for use in segment positioning
// Create and add background asset
var running = false;
var moveSegments = false;
@@ -179,9 +194,11 @@
});
stockValueText.anchor.set(1, 0);
LK.gui.topRight.addChild(stockValueText);
function updateStockValueText() {
- stockValueText.setText('Stock Value: $' + stockValuesHistory[graphIndex].toFixed(0));
+ if (graphIndex < stockValuesHistory.length) {
+ stockValueText.setText('Stock Value: $' + stockValuesHistory[graphIndex + 1].toFixed(0));
+ }
}
balanceText.anchor.set(0.5, 0);
LK.gui.top.addChild(balanceText);
/****
@@ -205,9 +222,9 @@
//console.log("drawNextSegment " + graphIndex + ' isDrawing = ' + drawingInProgress);
var hasFinished = graphIndex >= graphPoints.length - 1;
if (hasFinished) {
running = false;
- LK.showGameOver();
+ triggerZoomOut();
return;
}
if (!drawingInProgress) {
updateStockValueText();
@@ -221,14 +238,14 @@
var pointAXMovement = lastSegmentEndX - pointA.x;
var pointAYMovement = lastSegmentEndY - pointA.y;
pointA.x = lastSegmentEndX;
pointA.y = lastSegmentEndY > lowerLimit ? lowerLimit : lastSegmentEndY;
+ var nextSegmentEndY = pointA.y + Math.sin(nextSegmentRotation) * distance;
// Adjust distance to ensure segment's end doesn't exceed lowerLimit
- if (pointA.y + Math.sin(nextSegmentRotation) * distance > lowerLimit) {
+ if (nextSegmentEndY > lowerLimit) {
distance = (lowerLimit - pointA.y) / Math.sin(nextSegmentRotation);
}
- var upperLimit = game.height * 0.25;
- if (pointA.y < upperLimit || pointA.y > upperLimit && stockValuesHistory[graphIndex + 1] >= 100) {
+ if (nextSegmentEndY < upperLimit || nextSegmentEndY > upperLimit && stockValuesHistory[graphIndex + 1] >= 100) {
moveSegmentsVertically = true;
}
var delay = 0.5; // Reduce delay to speed up the drawing of segments
drawingInProgress = true;
@@ -291,9 +308,9 @@
var newValue = Math.max(0, previousValue + (previousValue == 0 ? Math.abs(delta) : delta));
stockValuesHistory.push(newValue);
previousValue = newValue;
}
- //setDebugValues(); // DEBUG MODE
+ setDebugValues(); // DEBUG MODE
var x, y;
// Compute the coordinates for the graph based on stockValuesHistory
for (var i = 0; i < stockValuesHistory.length; i++) {
x = segmentWidth * i;
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.