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.
User prompt
If the cursor is in coin position rotate the coin asset
User prompt
add collision to coin and cursor if touched play rotation animation
User prompt
rotate the coin image 360° x 2 times if mouse button was clicked then cursor touched the coin object asset.
User prompt
Make the rotation x 2 to the left side for the coin
User prompt
If cursor touched coin make it rotated by 360° x 2 times.
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (16 edits merged)
Please save this source code
/****
* 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
});
// Add rotation to the coin continuously when the game start
LK.effects.rotate(self, 360, 2000, true);
});
/****
* 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)) {
// Rotate the coin by 360° x 2 times slowly when the cursor touches it
LK.effects.rotate(child, 360 * 2, 2000);
// Remove the coin asset from the game after rotation
LK.setTimeout(function () {
game.removeChild(child);
}, 2000);
}
});
};
// 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;
};
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)) {
// Rotate the coin by 360° x 2 times slowly when the cursor touches it
LK.effects.rotate(child, 360 * 2, 2000);
// Remove the coin asset from the game after rotation
LK.setTimeout(function () {
game.removeChild(child);
}, 2000);
}
});
}
}; ===================================================================
--- original.js
+++ change.js
@@ -8,8 +8,10 @@
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
+ // Add rotation to the coin continuously when the game start
+ LK.effects.rotate(self, 360, 2000, true);
});
/****
* Initialize Game
Playable maze with orange lines. at black background.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d coin. Ninja face in the coin. red coin. 2 circles inside it. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Fullscreen, high definition, light, blur, small time watch, colors, wood, for a game titled "Maze" and with the description "Navigate ever-changing mazes! Each level with different background, coins, time speed. Can you finish collecting coins before time is up? Challenge your skills in Maze!". with text on banner "MAZE"!