Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'game.addChildAt(background, 1);' Line Number: 1989
Code edit (4 edits merged)
Please save this source code
User prompt
Fade in the new background when changing background
Code edit (1 edits merged)
Please save this source code
User prompt
Make sure the background image is centered on the screen
User prompt
Please fix the bug: 'Timeout.tick error: game.contains is not a function. (In 'game.contains(background)', 'game.contains' is undefined)' in or related to this line: 'if (game.background && game.contains(background)) {' Line Number: 1965
Code edit (1 edits merged)
Please save this source code
User prompt
Upon mission complete change the background image
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'if (!isDragoning && board && board.gems && board.gems.length > 0) {' Line Number: 1701
Code edit (1 edits merged)
Please save this source code
User prompt
When starting the game Show the sagamap for 5 second, then close the sagamap and begin the game as it does now
User prompt
Create visualization for the sagamap
User prompt
Keeping what exists.Create a new sagamap
User prompt
As the timer checks approaches zero, starting from 10, 9, 8 and so on, have a large text label overlaid on the screen counting down.
Code edit (1 edits merged)
Please save this source code
User prompt
The confetti from the mission complete, make it fly out of the middle of the screen on the y-axis.
User prompt
Please fix the bug: 'Timeout.tick error: requestAnimationFrame is not a function' in or related to this line: 'requestAnimationFrame(animateScale);' Line Number: 613
User prompt
When the Mission Complete modal appears, animate the scale of that container, the modal and the elements, to be more exciting.
Code edit (1 edits merged)
Please save this source code
User prompt
When the dragon grabs a gem, animate the scale of the gem upon grabbing.
User prompt
Implement a special row blaster gem that appears after matching more than three gems.
User prompt
Please fix the bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'x')' in or related to this line: 'var goalGemSpriteScale = currentGoalGemSprite.scale.x;' Line Number: 832
Code edit (2 edits merged)
Please save this source code
User prompt
in fillemptyspaces when checking to create a new gem - ensure Only proceed if theres no gems in any position in the gems array which is above the empty space array position
===================================================================
--- original.js
+++ change.js
@@ -1470,37 +1470,159 @@
/****
* Game Code
****/
-// Start a new countdown from 10 seconds before the game begins
+// SagaMap class
// Dragon spawn timer
// Goal gem type and count
// Initialize large countdown at the beginning of the game
// Initialize score
// Initialize 2-minute timer
// Initialize a timer for showing hints
-var countdownFrom = 10;
-var countdownText = new Text2(countdownFrom.toString(), {
- size: 300,
- fill: "#ffffff",
- x: 1024,
- // Center of the screen
- y: 1366,
- // Middle of the screen
- anchorX: 0.5,
- anchorY: 0.5
-});
-LK.gui.center.addChild(countdownText);
-var countdownInterval = LK.setInterval(function () {
- countdownFrom--;
- if (countdownFrom >= 0) {
- countdownText.setText(countdownFrom.toString());
- } else {
- LK.clearInterval(countdownInterval);
- countdownText.destroy();
- // Start the game logic here
+function _typeof2(o) {
+ "@babel/helpers - typeof";
+ return _typeof2 = "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;
+ }, _typeof2(o);
+}
+function _classCallCheck(instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
}
-}, 1000);
+}
+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, _toPropertyKey2(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 _toPropertyKey2(t) {
+ var i = _toPrimitive2(t, "string");
+ return "symbol" == _typeof2(i) ? i : String(i);
+}
+function _toPrimitive2(t, r) {
+ if ("object" != _typeof2(t) || !t) {
+ return t;
+ }
+ var e = t[Symbol.toPrimitive];
+ if (void 0 !== e) {
+ var i = e.call(t, r || "default");
+ if ("object" != _typeof2(i)) {
+ return i;
+ }
+ throw new TypeError("@@toPrimitive must return a primitive value.");
+ }
+ return ("string" === r ? String : Number)(t);
+}
+function _callSuper(t, o, e) {
+ return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
+}
+function _possibleConstructorReturn(self, call) {
+ if (call && (_typeof2(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() {
+ try {
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
+ } catch (t) {}
+ return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
+ return !!t;
+ })();
+}
+function _getPrototypeOf(o) {
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
+ return o.__proto__ || Object.getPrototypeOf(o);
+ };
+ return _getPrototypeOf(o);
+}
+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);
+}
+var SagaMap = /*#__PURE__*/function (_Container) {
+ _inherits(SagaMap, _Container);
+ function SagaMap() {
+ var _this;
+ _classCallCheck(this, SagaMap);
+ _this = _callSuper(this, SagaMap);
+ _this.levels = [];
+ _this.currentLevel = 0;
+ return _this;
+ }
+ _createClass(SagaMap, [{
+ key: "addLevel",
+ value: function addLevel(level) {
+ this.levels.push(level);
+ }
+ }, {
+ key: "goToLevel",
+ value: function goToLevel(index) {
+ this.currentLevel = index;
+ // Logic to switch to the specified level
+ console.log('Switching to level:', index);
+ }
+ }, {
+ key: "nextLevel",
+ value: function nextLevel() {
+ if (this.currentLevel < this.levels.length - 1) {
+ this.goToLevel(this.currentLevel + 1);
+ } else {
+ console.log('No more levels!');
+ }
+ }
+ }]);
+ return SagaMap;
+}(Container);
var dragonSpawnTimer;
var isDragoning = false;
function triggerDragon() {
if (dragonSpawnTimer) {
@@ -1724,8 +1846,11 @@
}
}, 1000); // Update countdown every second
game.timer = 120; // 2 minutes in seconds
// Implement a three second delay before starting the timer text interval
+LK.setTimeout(function () {
+ // Timer control is now handled inside the modal display logic to pause during the modal display.
+}, 3000);
var score = 0; // Starting score
var scoreBg;
var scoreBgNode = LK.getAsset('scoreBg', {
x: 1024 - 150,
a magical landscape of wonder and joy. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Magic, purple gem. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
glow. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Hourglass icon white. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Glow glare star. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Shiny red envelope bao, chinese new years. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Magic greem gem in odd shape. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Flying unicorn fullbody sideview. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Magic Orange Gem. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Magic Blue Drop Shaped Gem. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
remove
Brilliant Gold Checkmark. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Magic diamond. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Enchanted forest. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Celestial reAlm. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Mystic cavern. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.