Code edit (2 edits merged)
Please save this source code
User prompt
Rest player position to bottom right
User prompt
Lower it to the bottom
User prompt
Scale it more
User prompt
Scale it down from top
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 (10 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
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
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Class for the player character var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 10; // Increase player's speed attribute self.update = function () { // Player update logic }; }); /**** * 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: 0.5, x: 2048 / 2, y: 2732 / 2 }); // Set level to 1 game.level = 1; // Initialize player var player = new Player(); player.x = 2048 / 2; player.y = 2732 / 2; game.addChild(player); // Handle player movement // Import tween plugin game.down = function (x, y, obj) { var targetX = x; var targetY = y; var dx = targetX - player.x; var dy = targetY - player.y; if (Math.abs(dx) > Math.abs(dy)) { // Move horizontally tween(player, { x: player.x + Math.sign(dx) * player.speed * 10 }, { duration: 500 }); } else { // Move vertically tween(player, { y: player.y + Math.sign(dy) * player.speed * 10 }, { duration: 500 }); } };
===================================================================
--- original.js
+++ change.js
@@ -22,18 +22,27 @@
/****
* Initialize Game
****/
var game = new LK.Game({
- backgroundColor: 0x000000 //Init game with black background
+ backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
+// Add background to the game
+var background = game.attachAsset('Background1', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 2048 / 2,
+ y: 2732 / 2
+});
+// Set level to 1
+game.level = 1;
// Initialize player
var player = new Player();
-player.x = 100;
-player.y = 100;
+player.x = 2048 / 2;
+player.y = 2732 / 2;
game.addChild(player);
// Handle player movement
// Import tween plugin
game.down = function (x, y, obj) {