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
User prompt
add a new icon for balance
Code edit (1 edits merged)
Please save this source code
Code edit (7 edits merged)
Please save this source code
User prompt
'reuse' the axis labels and ensure that values are always visible without creating too many Text label instances, you can implement a recycling mechanism for the labels.
User prompt
make axis labels values dynamic so that visible values are always centered on stockValuesHistory[graphIndex + 1]
Code edit (2 edits merged)
Please save this source code
User prompt
call labels updatePosition with the y position of horizontal axis
Code edit (1 edits merged)
Please save this source code
User prompt
instiate axis labels (but not as children of vertical axis)
Code edit (4 edits merged)
Please save this source code
User prompt
detach the labels from the vertical axis : the should not be children of vertivalAxis
Code edit (1 edits merged)
Please save this source code
User prompt
Rotate labels by -90°
User prompt
AxisLabels should not be rotated like the axis
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
===================================================================
--- original.js
+++ change.js
@@ -182,8 +182,138 @@
/****
* Game Code
****/
+function _typeof(o) {
+ "@babel/helpers - typeof";
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
+ return typeof o;
+ } : function (o) {
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
+ }, _typeof(o);
+}
+function _classCallCheck(instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
+}
+function _defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) {
+ descriptor.writable = true;
+ }
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
+ }
+}
+function _createClass(Constructor, protoProps, staticProps) {
+ if (protoProps) {
+ _defineProperties(Constructor.prototype, protoProps);
+ }
+ if (staticProps) {
+ _defineProperties(Constructor, staticProps);
+ }
+ Object.defineProperty(Constructor, "prototype", {
+ writable: false
+ });
+ return Constructor;
+}
+function _toPropertyKey(t) {
+ var i = _toPrimitive(t, "string");
+ return "symbol" == _typeof(i) ? i : String(i);
+}
+function _toPrimitive(t, r) {
+ if ("object" != _typeof(t) || !t) {
+ return t;
+ }
+ var e = t[Symbol.toPrimitive];
+ if (void 0 !== e) {
+ var i = e.call(t, r || "default");
+ if ("object" != _typeof(i)) {
+ return i;
+ }
+ throw new TypeError("@@toPrimitive must return a primitive value.");
+ }
+ return ("string" === r ? String : Number)(t);
+}
+function _inherits(subClass, superClass) {
+ if (typeof superClass !== "function" && superClass !== null) {
+ throw new TypeError("Super expression must either be null or a function");
+ }
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
+ constructor: {
+ value: subClass,
+ writable: true,
+ configurable: true
+ }
+ });
+ Object.defineProperty(subClass, "prototype", {
+ writable: false
+ });
+ if (superClass) {
+ _setPrototypeOf(subClass, superClass);
+ }
+}
+function _setPrototypeOf(o, p) {
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
+ o.__proto__ = p;
+ return o;
+ };
+ return _setPrototypeOf(o, p);
+}
+function _createSuper(Derived) {
+ var hasNativeReflectConstruct = _isNativeReflectConstruct();
+ return function _createSuperInternal() {
+ var Super = _getPrototypeOf(Derived),
+ result;
+ if (hasNativeReflectConstruct) {
+ var NewTarget = _getPrototypeOf(this).constructor;
+ result = Reflect.construct(Super, arguments, NewTarget);
+ } else {
+ result = Super.apply(this, arguments);
+ }
+ return _possibleConstructorReturn(this, result);
+ };
+}
+function _possibleConstructorReturn(self, call) {
+ if (call && (_typeof(call) === "object" || typeof call === "function")) {
+ return call;
+ } else if (call !== void 0) {
+ throw new TypeError("Derived constructors may only return object or undefined");
+ }
+ return _assertThisInitialized(self);
+}
+function _assertThisInitialized(self) {
+ if (self === void 0) {
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
+ }
+ return self;
+}
+function _isNativeReflectConstruct() {
+ if (typeof Reflect === "undefined" || !Reflect.construct) {
+ return false;
+ }
+ if (Reflect.construct.sham) {
+ return false;
+ }
+ if (typeof Proxy === "function") {
+ return true;
+ }
+ try {
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
+ return true;
+ } catch (e) {
+ return false;
+ }
+}
+function _getPrototypeOf(o) {
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
+ return o.__proto__ || Object.getPrototypeOf(o);
+ };
+ return _getPrototypeOf(o);
+}
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
@@ -246,11 +376,44 @@
horizontalAxis.width = game.width;
horizontalAxis.height = 10;
horizontalAxis.x = 0; // Move axis to the left side of the screen
// Create and draw fixed horizontal Marker axis
-// Create and draw vertical axis
-var verticalAxis = game.addChild(new Axis(true)); // true indicates this is a vertical axis
-verticalAxis.drawAxis();
+// Create and draw vertical axis with dynamic values
+var DynamicVerticalAxis = /*#__PURE__*/function (_Axis) {
+ _inherits(DynamicVerticalAxis, _Axis);
+ var _super = _createSuper(DynamicVerticalAxis);
+ function DynamicVerticalAxis() {
+ var _this;
+ _classCallCheck(this, DynamicVerticalAxis);
+ _this = _super.call(this, true);
+ _this.drawAxisWithValues();
+ return _this;
+ }
+ _createClass(DynamicVerticalAxis, [{
+ key: "drawAxisWithValues",
+ value: function drawAxisWithValues() {
+ this.drawAxis();
+ var step = 50;
+ var currentValue = 0;
+ var axisHeight = game.height * 0.5;
+ var numSteps = axisHeight / (dollarToYPixelRatio * step);
+ for (var i = 0; i <= numSteps; i++) {
+ var valueText = new Text2('$' + currentValue, {
+ size: 30,
+ fill: "#ffffff"
+ });
+ valueText.anchor.set(0.5, 0);
+ valueText.rotation = -Math.PI / 2;
+ valueText.x = -10;
+ valueText.y = game.height * 0.75 - i * dollarToYPixelRatio * step;
+ this.addChild(valueText);
+ currentValue += step;
+ }
+ }
+ }]);
+ return DynamicVerticalAxis;
+}(Axis);
+var verticalAxis = game.addChild(new DynamicVerticalAxis());
verticalAxis.rotation = Math.PI / 2; // Rotate to make it vertical
verticalAxis.x = 20; // Move axis to the left side of the screen
verticalAxis.width = game.height;
verticalAxis.height = 10;
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.