User prompt
Lower the background from top only to be below the pause button.
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'height')' in or related to this line: 'var background = game.attachAsset('Background1', {' Line Number: 39
User prompt
Lower the image line of the top to below pause button
User prompt
scale it to be below the pause.
User prompt
Scale it from top to down little bit more
Code edit (14 edits merged)
Please save this source code
User prompt
Lower the background1 image to bottom
Code edit (1 edits merged)
Please save this source code
User prompt
Lower the background down pause button
User prompt
scale it from top down little below the pause button
User prompt
Scale the background from bottom to pause button and to the screen left right boundaries
User prompt
Change to another "time new roman" font
User prompt
Make the font for any text in this game "Time new roman"
User prompt
Make the level text bigger
User prompt
Add text Level 1 with white color on the top right
User prompt
Add background1 to the game and make this first level level 1.
User prompt
Increase the distance movement of player more
Code edit (1 edits merged)
Please save this source code
User prompt
Increase distance of player movment more
User prompt
Remove diagonal player movement
User prompt
Make the player movement smooth ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Add more distance for the player and speed
User prompt
Remove all object let only player and its movement and background1
User prompt
Rest player position to the bottom left 2.2 2.2
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'x')' in or related to this line: 'game.mouse.x = playerNode.x;' Line Number: 34
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Define the MazeWall class var MazeWall = Container.expand(function () { var self = Container.call(this); }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ var isDragging = false; var dragNode = null; var distance = 0; //Declare method for handling move events on game. function handleMove(x, y, obj) { // Player movements removed } // 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); ; // 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: 2.2, anchorY: 2.2, scaleX: 1.5, scaleY: 1.5, x: 2048, y: 2732 }); // Manually attach asset to element, rather than using self.attachAsset game.addChild(playerNode); // Add event listeners to handle player movement game.down = function (x, y, obj) { // Check if the player was clicked if (playerNode.getBounds().contains(x, y)) { // If so, start dragging the player isDragging = true; dragNode = playerNode; // Calculate the distance between the player and the cursor distance = Math.sqrt(Math.pow(x - playerNode.x, 2) + Math.pow(y - playerNode.y, 2)); // Also call move handler right away to make effect instant. handleMove(x, y, obj); } }; ; ; game.update = function () { // Check for collision with maze walls var mazeWalls = []; for (var i = 0; i < game.children.length; i++) { if (game.children[i] instanceof MazeWall) { mazeWalls.push(game.children[i]); } } for (var i = 0; i < mazeWalls.length; i++) { if (playerNode.intersects(mazeWalls[i])) { // Stop player movement playerNode.vx = 0; playerNode.vy = 0; break; } } }; //Mouse or touch up on game object game.up = function (x, y, obj) { // Stop dragging the player isDragging = false; dragNode = null; };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Define the MazeWall class
var MazeWall = Container.expand(function () {
var self = Container.call(this);
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
var isDragging = false;
var dragNode = null;
var distance = 0;
//Declare method for handling move events on game.
function handleMove(x, y, obj) {
// Player movements removed
}
// 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);
;
// 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: 2.2,
anchorY: 2.2,
scaleX: 1.5,
scaleY: 1.5,
x: 2048,
y: 2732
});
// Manually attach asset to element, rather than using self.attachAsset
game.addChild(playerNode);
// Add event listeners to handle player movement
game.down = function (x, y, obj) {
// Check if the player was clicked
if (playerNode.getBounds().contains(x, y)) {
// If so, start dragging the player
isDragging = true;
dragNode = playerNode;
// Calculate the distance between the player and the cursor
distance = Math.sqrt(Math.pow(x - playerNode.x, 2) + Math.pow(y - playerNode.y, 2));
// Also call move handler right away to make effect instant.
handleMove(x, y, obj);
}
};
;
;
game.update = function () {
// Check for collision with maze walls
var mazeWalls = [];
for (var i = 0; i < game.children.length; i++) {
if (game.children[i] instanceof MazeWall) {
mazeWalls.push(game.children[i]);
}
}
for (var i = 0; i < mazeWalls.length; i++) {
if (playerNode.intersects(mazeWalls[i])) {
// Stop player movement
playerNode.vx = 0;
playerNode.vy = 0;
break;
}
}
};
//Mouse or touch up on game object
game.up = function (x, y, obj) {
// Stop dragging the player
isDragging = false;
dragNode = null;
};