User prompt
if i hold on the screen and point point. Track the click to put the point.
User prompt
fit it to screen
User prompt
Add background
User prompt
Don't expand the point just paint a line
User prompt
Make a point asset for cursor when it's moving expand the point to draw a line.
User prompt
Please fix the bug: 'LK.Graphics is not a constructor' in or related to this line: 'var path = new LK.Graphics();' Line Number: 19
User prompt
Make the mouse the player in this game. If i click and move the cursor paint a color following the movement of the cursor.
User prompt
Remove maze
User prompt
Remove player and its movment from game
User prompt
If i click and hold on the player object in the screen and moved it make the player move with it smoothly.
User prompt
Make the player moves only if i hold cursor on it not when i click anywhere on the screen.
User prompt
Make player follow the cursor exact same time.
Code edit (1 edits merged)
Please save this source code
User prompt
Increase speed of player
Code edit (6 edits merged)
Please save this source code
User prompt
reduce distance between player and cursor
User prompt
Let the player follow the mouse arrow after clicking on the player.
User prompt
don't push player from cursor after mouse button clicked on it
User prompt
Regenerate a hexagon maze in exact same position of the image background1.
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Remove all walls from the game
User prompt
Make the middle of each wall1 2 3 4 in the middle of there sides
User prompt
Make the center of each wall in the middle of its side
User prompt
Center the walls each side
/**** * Classes ****/ // Class for the player character var Player = Container.expand(function () { var self = Container.call(this); self.interactive = true; // Make the player interactive var playerGraphics = self.attachAsset('player', { anchorX: 1.9, anchorY: 1.9 }); self.dragging = false; // Add a variable to track if the player is being dragged }); // Class for the wall var Wall = Container.expand(function () { var self = Container.call(this); var wallGraphics = self.attachAsset('wall1', { anchorX: 0.05, anchorY: 0.05 }); }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Add background to the game var background = game.attachAsset('Background1', { anchorX: 0.5, anchorY: 1, x: 2048 / 2, y: 2732 - 55, // Move the background down by 80 pixels scaleX: 2048 / 1000, scaleY: (2732 - LK.gui.top.height - 200) / 1000 // Scale down from the top by 200 pixels }); // Set level to 1 game.level = 1; // Initialize player var player = new Player(); player.x = 2048; player.y = 2732; player.interactive = true; game.addChild(player); // Initialize wall1 var wall1 = new Wall(); wall1.x = 0; // Position wall1 at the left edge of the screen wall1.y = 2732 / 2; // Position wall1 at the middle of the screen wall1.width = 100; // Make wall1 thinner vertically wall1.height = 2732; // Make wall1 as tall as the screen game.addChild(wall1); // Initialize wall3 on the right side of the screen var wall3 = new Wall(); wall3.x = 2048 - wall3.width; // Position wall3 at the right edge of the screen wall3.y = 2732 / 2; // Position wall3 at the middle of the screen wall3.width = 100; // Make wall3 thinner wall3.height = 2732; // Make wall3 as tall as the screen game.addChild(wall3); // Initialize wall4 at the bottom of the screen var wall4 = new Wall(); wall4.x = 2048 / 2; // Position wall4 at the middle of the screen wall4.y = 2732 - wall4.height; // Position wall4 at the bottom of the screen wall4.width = 2048; // Make wall4 as wide as the screen wall4.height = 100; // Make wall4 thinner horizontally game.addChild(wall4); // Initialize wall2 var wall2 = new Wall(); wall2.x = 2048 / 2; // Position wall2 at the middle of the screen wall2.y = 0; // Position wall2 at the top of the screen wall2.width = 2048; // Make wall2 as wide as the screen wall2.height = 100; // Make wall2 thinner horizontally game.addChild(wall2); // Add Level 1 text on the top right var levelText = new Text2('Level 1', { size: 100, fill: 0xFFFFFF, font: "'Time new roman'" }); levelText.anchor.set(1, 0); // Sets anchor to the top right edge of the text. LK.gui.topRight.addChild(levelText); // Handle player movement // Import tween plugin var dragNode = null; game.down = function (x, y, obj) { dragNode = player; }; game.move = function (x, y, obj) { if (dragNode) { dragNode.x = x - dragNode.width / 10; dragNode.y = y - dragNode.height / 10; } }; game.up = function (x, y, obj) { dragNode = null; };
/****
* Classes
****/
// Class for the player character
var Player = Container.expand(function () {
var self = Container.call(this);
self.interactive = true; // Make the player interactive
var playerGraphics = self.attachAsset('player', {
anchorX: 1.9,
anchorY: 1.9
});
self.dragging = false; // Add a variable to track if the player is being dragged
});
// Class for the wall
var Wall = Container.expand(function () {
var self = Container.call(this);
var wallGraphics = self.attachAsset('wall1', {
anchorX: 0.05,
anchorY: 0.05
});
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Add background to the game
var background = game.attachAsset('Background1', {
anchorX: 0.5,
anchorY: 1,
x: 2048 / 2,
y: 2732 - 55,
// Move the background down by 80 pixels
scaleX: 2048 / 1000,
scaleY: (2732 - LK.gui.top.height - 200) / 1000 // Scale down from the top by 200 pixels
});
// Set level to 1
game.level = 1;
// Initialize player
var player = new Player();
player.x = 2048;
player.y = 2732;
player.interactive = true;
game.addChild(player);
// Initialize wall1
var wall1 = new Wall();
wall1.x = 0; // Position wall1 at the left edge of the screen
wall1.y = 2732 / 2; // Position wall1 at the middle of the screen
wall1.width = 100; // Make wall1 thinner vertically
wall1.height = 2732; // Make wall1 as tall as the screen
game.addChild(wall1);
// Initialize wall3 on the right side of the screen
var wall3 = new Wall();
wall3.x = 2048 - wall3.width; // Position wall3 at the right edge of the screen
wall3.y = 2732 / 2; // Position wall3 at the middle of the screen
wall3.width = 100; // Make wall3 thinner
wall3.height = 2732; // Make wall3 as tall as the screen
game.addChild(wall3);
// Initialize wall4 at the bottom of the screen
var wall4 = new Wall();
wall4.x = 2048 / 2; // Position wall4 at the middle of the screen
wall4.y = 2732 - wall4.height; // Position wall4 at the bottom of the screen
wall4.width = 2048; // Make wall4 as wide as the screen
wall4.height = 100; // Make wall4 thinner horizontally
game.addChild(wall4);
// Initialize wall2
var wall2 = new Wall();
wall2.x = 2048 / 2; // Position wall2 at the middle of the screen
wall2.y = 0; // Position wall2 at the top of the screen
wall2.width = 2048; // Make wall2 as wide as the screen
wall2.height = 100; // Make wall2 thinner horizontally
game.addChild(wall2);
// Add Level 1 text on the top right
var levelText = new Text2('Level 1', {
size: 100,
fill: 0xFFFFFF,
font: "'Time new roman'"
});
levelText.anchor.set(1, 0); // Sets anchor to the top right edge of the text.
LK.gui.topRight.addChild(levelText);
// Handle player movement
// Import tween plugin
var dragNode = null;
game.down = function (x, y, obj) {
dragNode = player;
};
game.move = function (x, y, obj) {
if (dragNode) {
dragNode.x = x - dragNode.width / 10;
dragNode.y = y - dragNode.height / 10;
}
};
game.up = function (x, y, obj) {
dragNode = null;
};