User prompt
Make player move toward the cursor smoothly
User prompt
Add movement by click in any direction right or down or left or up to follow cursor smoothly
User prompt
Please fix the bug: 'TypeError: lineGraphics.lineTo is not a function' in or related to this line: 'lineGraphics.lineTo(player.lastX, player.lastY);' Line Number: 35
User prompt
Please fix the bug: 'TypeError: lineGraphics.moveTo is not a function' in or related to this line: 'lineGraphics.moveTo(player.x, player.y);' Line Number: 33
User prompt
Please fix the bug: 'TypeError: lineGraphics.lineStyle is not a function' in or related to this line: 'lineGraphics.lineStyle(2, 0xffffff, 1);' Line Number: 33
User prompt
Make line the line of player when he moves
User prompt
Scale it more
User prompt
Scale player a bit
User prompt
Remove draw from game
User prompt
Reposition the player front of draw asset and make the asset draw smaller
User prompt
Make the player move smooth by hold on it
User prompt
Make the player front of draw asset
User prompt
Please fix the bug: 'TypeError: self.graphics.lineTo is not a function' in or related to this line: 'self.graphics.lineTo(self.parent.targetX - self.parent.x, self.parent.targetY - self.parent.y);' Line Number: 22
User prompt
Please fix the bug: 'TypeError: self.graphics.moveTo is not a function' in or related to this line: 'self.graphics.moveTo(0, 0);' Line Number: 21
User prompt
Please fix the bug: 'TypeError: self.graphics.lineStyle is not a function' in or related to this line: 'self.graphics.lineStyle(2, 0xFFFFFF, 1);' Line Number: 20
User prompt
Please fix the bug: 'Graphics is not a constructor' in or related to this line: 'self.graphics = new Graphics();' Line Number: 13
User prompt
Make the player paint a line when move toward the cursor
User prompt
Make player small
User prompt
Make draw asset small
User prompt
Make player bigger and front of draw asset
User prompt
Please fix the bug: 'TypeError: lineGraphics.lineStyle is not a function' in or related to this line: 'lineGraphics.lineStyle(2, 0xffffff, 1);' Line Number: 19
User prompt
When player moves draw a line by white color
User prompt
make movement of player smoothly forward to the cursor
User prompt
move player horizontal or vertical to the cursor with large distance and stop.
User prompt
Make the player move only 4 direction when click left go left if right go right so on
/**** * Classes ****/ var Draw = Container.expand(function () { var self = Container.call(this); var drawGraphics = self.attachAsset('draw', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { drawGraphics.clear(); // There is no lineStyle method in LK engine. We can set the color of the shape directly when initializing it. self.x = player.x; self.y = player.y; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ var background = game.addChild(LK.getAsset('maze1', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 })); background.scale.x = game.width / background.width; background.scale.y = game.height / background.height; var player = game.addChild(LK.getAsset('player', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 - 100, scaleX: 1.2, scaleY: 1.2 })); player.interactive = true; player.on('mousedown', onDragStart).on('touchstart', onDragStart).on('mouseup', onDragEnd).on('mouseupoutside', onDragEnd).on('touchend', onDragEnd).on('touchendoutside', onDragEnd).on('mousemove', onDragMove).on('touchmove', onDragMove); function onDragStart(event) { this.data = event.data; this.alpha = 0.5; this.dragging = true; } function onDragEnd() { this.alpha = 1; this.dragging = false; this.data = null; } function onDragMove() { if (this.dragging) { var newPosition = this.data.getLocalPosition(this.parent); this.x = newPosition.x; this.y = newPosition.y; } }
===================================================================
--- original.js
+++ change.js
@@ -36,9 +36,11 @@
var player = game.addChild(LK.getAsset('player', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
- y: 2732 / 2 - 100
+ y: 2732 / 2 - 100,
+ scaleX: 1.2,
+ scaleY: 1.2
}));
player.interactive = true;
player.on('mousedown', onDragStart).on('touchstart', onDragStart).on('mouseup', onDragEnd).on('mouseupoutside', onDragEnd).on('touchend', onDragEnd).on('touchendoutside', onDragEnd).on('mousemove', onDragMove).on('touchmove', onDragMove);
function onDragStart(event) {