User prompt
make the player movement only 4 dirctions and horizontal or vertical only.
User prompt
Make it go to the clicked direction.
User prompt
change the movement to horizontal and vertical.
User prompt
Make player moves by right or left or up or down by click the direction. Move player by small distance to the cursor clicked point.
Code edit (2 edits merged)
Please save this source code
User prompt
Make it small
Code edit (1 edits merged)
Please save this source code
User prompt
Take player to the bottom right
User prompt
make it front of the background image
User prompt
center the player
User prompt
Add player to the game. set player position at the bottom right
User prompt
Fit the background1 image to screen
User prompt
Fit the background image to the screen
User prompt
Make it 1000x1000
User prompt
Add background1 to game
User prompt
Remove the game and all assets
User prompt
Remove speed
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'speed')' in or related to this line: 'self.speed += 1;' Line Number: 129
Code edit (1 edits merged)
Please save this source code
User prompt
Fix the speed
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'speed')' in or related to this line: 'self.speed += 0.01;' Line Number: 128
User prompt
Set player movement in any direction left right up and down by small distance. Add speed to player Increase player speed
User prompt
Make line in the middle of the player and move with it and draw by movement.
User prompt
make the player front of line
User prompt
Constraint line to player
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Retrieve a non-attached LK asset named 'player'. // Set its anchor and pivot point to top left (x: 0.0, y: 0.0). // Position it at the bottom right of the screen (x: 2048, y: 2732). var playerNode = LK.getAsset('player', { anchorX: 0.0, anchorY: 0.0, x: 2048, y: 2732 }); // Manually attach asset to element, rather than using self.attachAsset game.addChild(playerNode); ; ; // Set its anchor and pivot point to top left (x: 0.0, y: 0.0). // Retrieve a non-attached LK asset named 'Background1'. var backgroundNode = LK.getAsset('Background1', { anchorX: 0.0, anchorY: 0.0, scaleX: 2048 / 1000, scaleY: 2732 / 1000, x: 0, y: 0 }); //Manually attach asset to element, rather than using self.attachAsset game.addChild(backgroundNode); ;
===================================================================
--- original.js
+++ change.js
@@ -12,10 +12,22 @@
/****
* Game Code
****/
-// Apply a scale of 2x on both axes, and position it at (x: 0, y: 0).
+// Retrieve a non-attached LK asset named 'player'.
// Set its anchor and pivot point to top left (x: 0.0, y: 0.0).
+// Position it at the bottom right of the screen (x: 2048, y: 2732).
+var playerNode = LK.getAsset('player', {
+ anchorX: 0.0,
+ anchorY: 0.0,
+ x: 2048,
+ y: 2732
+});
+// Manually attach asset to element, rather than using self.attachAsset
+game.addChild(playerNode);
+;
+;
+// Set its anchor and pivot point to top left (x: 0.0, y: 0.0).
// Retrieve a non-attached LK asset named 'Background1'.
var backgroundNode = LK.getAsset('Background1', {
anchorX: 0.0,
anchorY: 0.0,