Code edit (1 edits merged)
Please save this source code
User prompt
add to the vertical axis dynamic values with a step of 50
Code edit (1 edits merged)
Please save this source code
User prompt
add dynamic values (step of 50) to the vertical axis
Code edit (3 edits merged)
Please save this source code
User prompt
fix text markers position because gui coordinates are not like other assets coordinates
User prompt
fix text markers position because LK.gui don't work with coordinates like game.height * 0.5
Code edit (4 edits merged)
Please save this source code
User prompt
add a series of 3 texts in the horizontal center of the screen to make stock value markers - text = "0$" at y=game.height*0.75 - text = "50$" at y=game.height*0.5 - text = "100$" at y=game.height*0.25
User prompt
flash the screen in the color of the button when pressed
Code edit (1 edits merged)
Please save this source code
User prompt
Set alpha of farbackground to 0.5
User prompt
Initialize the farBackground just before boardBackground
User prompt
Initialize farBackground like boardBackground
User prompt
Add a new background asset named FarBackground
Code edit (2 edits merged)
Please save this source code
User prompt
Add a new background asset named Board that will be placed under the current background
Code edit (4 edits merged)
Please save this source code
User prompt
Set horizontalAxis alpha to 0 when its y > game.height * 0.8 and else set it to 1
Code edit (4 edits merged)
Please save this source code
User prompt
Make buttons text a bit smaller when pressed to simulate press
Code edit (1 edits merged)
Please save this source code
User prompt
text of buttons should always be on top of buttons
User prompt
restore bigButton asset when buttons are released
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -1,7 +1,20 @@
/****
* Classes
****/
+var AxisLabel = Container.expand(function (value) {
+ var self = Container.call(this);
+ self.value = value;
+ var label = new Text2('$' + value, {
+ size: 30,
+ fill: "#ffffff"
+ });
+ label.anchor.set(0.5, 0.5);
+ self.addChild(label);
+ self.updatePosition = function (axisY) {
+ self.y = axisY - value * dollarToYPixelRatio;
+ };
+});
var GraphSegment = Container.expand(function () {
var self = Container.call(this);
self.index1 = null;
self.stockValue1 = 0;
@@ -61,8 +74,16 @@
self.drawAxis = function () {
var axisGraphics = self.addChild(LK.getAsset('axis', {
height: 4 // Thin line for the axis
}));
+ if (self.isVertical) {
+ for (var i = 50; i <= 1000; i += 50) {
+ var label = new AxisLabel(i);
+ label.x = -30; // Position the label to the left of the axis
+ self.addChild(label);
+ label.updatePosition(self.y);
+ }
+ }
};
});
// ValueIndicator class to represent the current value of the stock on the graph
// Player class to represent the player's portfolio
@@ -421,8 +442,16 @@
graphSegments.forEach(function (segment) {
segment.updateSlide();
});
horizontalAxis.updateSlide(); // Slide the horizontal axis vertically
+ // Update the position of the axis labels
+ if (verticalAxis.children) {
+ verticalAxis.children.forEach(function (child) {
+ if (child instanceof AxisLabel) {
+ child.updatePosition(verticalAxis.y);
+ }
+ });
+ }
// Update the vertical slide amount text periodically
vsaText.setText(graphIndex + ' VSA: ' + verticalSlideAmount.toFixed(0) + " " + moveSegmentsVertically);
// Check for game over conditions (e.g., player runs out of money)
if (player.getBalance() <= 0) {
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.