User prompt
Don't make the coin disappear after 3 touches make the animation of the coin thin vertical then thick again 3 times.
User prompt
Each time i move the cursor to the coin make it thin vertical then restore its size back again do this for 3 times then make it disappear from screen.
User prompt
Move coin text to the top middle
User prompt
Add statu text for the coins 0/7 each time collect coin add 1
User prompt
If the coins not collected before time ends or reach 0 play game over.
User prompt
Add statu time text to the top right side Add statu time to the game by 1 min going down
User prompt
If coin touched while drawing by point asset zoom it to the screen little then make it disappear
User prompt
If touched coins by cursor make it disappear but only the touched one not all.
User prompt
Add speed to the rotation of coins
User prompt
Make the rotation of the coins 360° continuously.
User prompt
Please fix the bug: 'LK.rotate is not a function' in or related to this line: 'LK.rotate(self, 360, 2000, true);' Line Number: 20
User prompt
Please fix the bug: 'LK.effects.rotate is not a function' in or related to this line: 'LK.effects.rotate(self, 360, 2000, true);' Line Number: 20
User prompt
Please fix the bug: 'LK.rotate is not a function' in or related to this line: 'LK.rotate(self, 360, 2000, true);' Line Number: 20
User prompt
Please fix the bug: 'LK.effects.rotate is not a function' in or related to this line: 'LK.effects.rotate(self, 360, 2000, true);' Line Number: 20
User prompt
Add rotation to the coin continuously when the game start
User prompt
If i draw by point asset in the coin position play its animation to rotate and disappear from the screen.
User prompt
Add collision between point asset and coin asset to trigger rotation for the coin then make it disappear
User prompt
Ad coin class and logic to the game
User prompt
If cursor touched any coin in the screen & play rotation by 360° x 2.
User prompt
Add Lk.effects.rotate coin if cursor was held and drawing by point asset and reach the coin position.
User prompt
Remove drag for the coin
User prompt
fix the game
User prompt
when point asset reach coin rotate the coin two times to the left by 360°.
User prompt
the coins are not rotated when i moved by mouse cursor to them!
User prompt
rotate coin image 360° x 2 slowly when cursor rach its position.
/**** * Classes ****/ var Coin = Container.expand(function () { var self = Container.call(this); var coinGraphics = self.attachAsset('coin', { anchorX: 0.5, anchorY: 0.5, scaleX: 3, scaleY: 3 }); self.touchCount = 0; // Add a counter to track the number of times the coin has been touched // Add rotation to the coin continuously when the game start self.update = function () { self.rotation += 0.05; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Create a point asset for the cursor var point = LK.getAsset('point', { anchorX: 0.5, anchorY: 0.5 }); game.addChild(point); // Handle mouse movement // Add background to the game var background = LK.getAsset('Background1', { anchorX: 0.5, anchorY: 0.5, scaleX: 2048 / 1000, scaleY: 2732 / 1075 }); game.addChildAt(background, 0); background.x = 2048 / 2; background.y = 2732 / 2 + 115; // Lower the background a bit from the top game.down = function (x, y, obj) { // Check if the mouse is down game.isMouseDown = true; // Check for intersection with coin assets game.children.forEach(function (child) { if (child.id === 'coin' && point.intersects(child)) { // Remove the coin asset from the game immediately game.removeChild(child); // Increase the coin count var coinCount = parseInt(coinCountText.text.split('/')[0]) + 1; coinCountText.setText(coinCount + '/7'); } }); }; // Create 7 new coin assets at fixed positions for (var i = 0; i < 7; i++) { var newCoin = new Coin(); game.addChild(newCoin); // Set the coins at fixed positions if (i === 0) { newCoin.x = 1035; newCoin.y = 550; } else if (i === 1) { newCoin.x = 775; newCoin.y = 790; } else if (i === 2) { newCoin.x = 640; newCoin.y = 1485; } else if (i === 3) { newCoin.x = 1685; newCoin.y = 670; } else if (i === 4) { newCoin.x = 640; newCoin.y = 1840; } else if (i === 5) { newCoin.x = 365; newCoin.y = 1425; } else if (i === 6) { newCoin.x = 1815; newCoin.y = 1425; } else { newCoin.x = 200 + i * 200; newCoin.y = 200 + i * 200; } console.log("Coin " + (i + 1) + " position: x=" + newCoin.x + ", y=" + newCoin.y); } game.up = function (x, y, obj) { // Set a flag to track if the mouse is up game.isMouseDown = false; }; // Add status time text to the top right side var statusTimeText = new Text2('1:00', { size: 100, fill: 0xFFFFFF }); statusTimeText.anchor.set(1, 0); // Sets anchor to the top right edge of the text. LK.gui.topRight.addChild(statusTimeText); // Add coin count text to the top middle var coinCountText = new Text2('0/7', { size: 100, fill: 0xFFFFFF }); coinCountText.anchor.set(0.5, 0); // Sets anchor to the top middle edge of the text. LK.gui.top.addChild(coinCountText); // Initialize status time var statusTime = 60; // 60 seconds = 1 minute // Create a timer that decreases the status time every second var statusTimeTimer = LK.setInterval(function () { statusTime--; // Update the status time text statusTimeText.setText(statusTime.toString()); // If the status time reaches 0, stop the timer and show game over if (statusTime <= 0) { LK.clearInterval(statusTimeTimer); LK.showGameOver(); } }, 1000); // 1000 milliseconds = 1 second game.move = function (x, y, obj) { // Check if the mouse is down if (game.isMouseDown) { // Create a new point asset at the current mouse position var newPoint = LK.getAsset('point', { anchorX: 0.5, anchorY: 0.5 }); game.addChild(newPoint); newPoint.x = x; newPoint.y = y; // Add speed to the point newPoint.speed = 5; // Check for intersection with coin assets game.children.forEach(function (child) { if (child.id === 'coin' && newPoint.intersects(child)) { child.touchCount += 1; // Increase the touch count // Make the coin thin vertically child.scaleX = 1; child.scaleY = 0.5; // Restore the coin size back after 500ms LK.setTimeout(function () { child.scaleX = 3; child.scaleY = 3; }, 500); // If the coin has been touched 3 times, reset the touch count if (child.touchCount >= 3) { child.touchCount = 0; } } }); } };
===================================================================
--- original.js
+++ change.js
@@ -144,11 +144,11 @@
LK.setTimeout(function () {
child.scaleX = 3;
child.scaleY = 3;
}, 500);
- // If the coin has been touched 3 times, remove it from the game
+ // If the coin has been touched 3 times, reset the touch count
if (child.touchCount >= 3) {
- game.removeChild(child);
+ child.touchCount = 0;
}
}
});
}