Code edit (3 edits merged)
Please save this source code
User prompt
Make gate4 move with background1
User prompt
Add gate4 to level1
Code edit (14 edits merged)
Please save this source code
User prompt
Make gate3 move with background1 when dragging its image.
User prompt
Add gate3 to level1
Code edit (1 edits merged)
Please save this source code
Code edit (11 edits merged)
Please save this source code
User prompt
Make the gate2 move with the background1
User prompt
Add gate2 to level1
Code edit (1 edits merged)
Please save this source code
User prompt
Make gate1 moved with background1 when drage background1 image from this position.
User prompt
Add gate1 to the level1
User prompt
Add assets gate1 2 3 4 5 6
User prompt
make the image can be dragged by any point in it not just from center of it.
User prompt
Make the Image follow the cursor by click in exact same time
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'getLocalPosition')' in or related to this line: 'var newPosition = self.data.getLocalPosition(self.parent);' Line Number: 77
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'getLocalPosition')' in or related to this line: 'var newPosition = self.data.getLocalPosition(self.parent);' Line Number: 77
User prompt
Move the image in exact same time with the cursor to avoid the vibrating of the image when dragge it.
User prompt
Increase the speed movement of the background1 image
User prompt
don't center the image let it move freely from the clicked point and don't teleport the image to the cursor
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'getLocalPosition')' in or related to this line: 'var newPosition = self.data.getLocalPosition(self.parent);' Line Number: 73
User prompt
let the dragge be smooth for no vibration from the background1 image
User prompt
make the background1 bigger
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'getLocalPosition')' in or related to this line: 'var newPosition = self.data.getLocalPosition(self.parent);' Line Number: 71
/**** * Classes ****/ var Level1 = Container.expand(function () { var self = Container.call(this); // Get and automatically addChild to self asset with id 'background1' with the anchor point set to 0, 0 var background1 = self.attachAsset('background1', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, scaleX: 1.5, scaleY: 1.5 }); // Add drag functionality to the background1 image self.down = function (x, y, obj) { self.dragging = true; self.data = obj.data; self.initialClick = { x: x, y: y }; }; self.up = function () { self.dragging = false; self.data = null; }; self.move = function (x, y, obj) { if (self.dragging) { var dx = x - self.initialClick.x; var dy = y - self.initialClick.y; self.x += dx; self.y += dy; self.initialClick = { x: x, y: y }; } }; }); // Create a Level2 class by using the LK expand method to extend Container. var Level2 = Container.expand(function () { var self = Container.call(this); // Get and automatically addChild to self asset with id 'background2' with the anchor point set to 0, 0 var background2 = self.attachAsset('background2', { anchorX: 0.0, anchorY: 0.0, x: 0, y: 0 }); }); var Level3 = Container.expand(function () { var self = Container.call(this); // Get and automatically addChild to self asset with id 'background3' with the anchor point set to 0, 0 var background3 = self.attachAsset('background3', { anchorX: 0.0, anchorY: 0.0, x: 0, y: 0 }); }); var Level4 = Container.expand(function () { var self = Container.call(this); // Get and automatically addChild to self asset with id 'background4' with the anchor point set to 0, 0 var background4 = self.attachAsset('background4', { anchorX: 0.0, anchorY: 0.0, x: 0, y: 0 }); }); var Level5 = Container.expand(function () { var self = Container.call(this); // Get and automatically addChild to self asset with id 'background5' with the anchor point set to 0, 0 var background5 = self.attachAsset('background5', { anchorX: 0.0, anchorY: 0.0, x: 0, y: 0 }); }); // Create a Level6 class by using the LK expand method to extend Container. var Level6 = Container.expand(function () { var self = Container.call(this); // Get and automatically addChild to self asset with id 'background6' with the anchor point set to 0, 0 var background6 = self.attachAsset('background6', { anchorX: 0.0, anchorY: 0.0, x: 0, y: 0 }); }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ var level = game.addChild(new Level1());
===================================================================
--- original.js
+++ change.js
@@ -26,10 +26,16 @@
self.data = null;
};
self.move = function (x, y, obj) {
if (self.dragging) {
- self.x = x;
- self.y = y;
+ var dx = x - self.initialClick.x;
+ var dy = y - self.initialClick.y;
+ self.x += dx;
+ self.y += dy;
+ self.initialClick = {
+ x: x,
+ y: y
+ };
}
};
});
// Create a Level2 class by using the LK expand method to extend Container.
2D wreckage of wood, square, HD colors. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
House from the front facing the screen with big sign above it have description "SHOP", Hd colors
coin, have "AD" not "$", hd colors. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows