User prompt
Resize the walls in level 2 make it bigger
User prompt
Remove loading Background2 in level 1 before Background1
User prompt
Make level 2 walls respawning randomly and taller some vertical some horizontal from top to bottom and the left to right only
User prompt
remove statu 1 min in level 1
User prompt
Make time in level 1 20 sec only remove 30 sec
User prompt
Add Wall2 asset to level 2 and remove mazeWall asset from level 2
User prompt
Add background2 to level 2 and background3 to level 3
User prompt
Reduce in level 1
User prompt
Reduce number of walls in level 2 make
User prompt
Set wall3 as walls that respawning in level 3 only, ensure that
User prompt
Set Wall2 the walls that respawning for level 2, ensure that its not respawning in other levels
User prompt
Set mazeWall the objects assets for level 1 only ensure that its not respawning in othr levels
User prompt
1-Add mazeWalls to the game as object respawning for level 1 from to side and right side only. 2-Add Wall2 to the game as object for level 2 respawning from top and left sides. 3-Add wall3 to the game as object for level 3 respawning from and right sides.
User prompt
Make the wall2 the object raspawning for level 2 only, make the asset mazeWall the walls that respawning for level 1
User prompt
Make wall2 the object that respawn in level2 from all the sides
User prompt
Make mazewall asset for level: 1 only, wall2 asset for level: 2 only, wall3 for level: 3 only.
User prompt
Reduce number of walls respawning from each side
User prompt
Make each side respawn both walls vertical and horizontal randomly
User prompt
Make level 1 time 30 sec, level 2 40 sec, level 3 1 min
User prompt
Remove 1 min from level 1 and 2
User prompt
Increase the number of respaning
User prompt
Respawn horizontal and vertical from all the sides, same in other levels
User prompt
Don't set inisial level to 13 set it to 3 only
User prompt
fix se 13
User prompt
Remove background asset only let other backgrounds1 2 3
/**** * Classes ****/ var BottomWall = Container.expand(function () { var self = Container.call(this); var wallGraphics = self.attachAsset('mazeWall', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.y -= 5; if (self.y < 0) { self.destroy(); } }; }); var HorizontalWall = Container.expand(function () { var self = Container.call(this); var wallGraphics = self.attachAsset('mazeWall', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.x += 5; if (self.x > 2048) { self.x = 0; } else if (self.x < 0) { self.x = 2048; } }; }); var LeftWall = Container.expand(function () { var self = Container.call(this); var wallGraphics = self.attachAsset('mazeWall', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.x += 5; if (self.x > 2048) { self.destroy(); } }; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { for (var i = 0; i < mazeWalls.length; i++) { if (self.intersects(mazeWalls[i])) { var dx = self.x - mazeWalls[i].x; var dy = self.y - mazeWalls[i].y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < self.width / 2 + mazeWalls[i].width / 2 && self.y > mazeWalls[i].y && self.y < mazeWalls[i].y + mazeWalls[i].height) { LK.showGameOver(); } } } }; }); var RightWall = Container.expand(function () { var self = Container.call(this); var wallGraphics = self.attachAsset('mazeWall', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.x -= 5; if (self.x < 0) { self.destroy(); } }; }); var TopWall = Container.expand(function () { var self = Container.call(this); var wallGraphics = self.attachAsset('mazeWall', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.y += 5; if (self.y > 2732) { self.destroy(); } }; }); var VerticalWall = Container.expand(function () { var self = Container.call(this); var wallGraphics = self.attachAsset('mazeWall', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.y += 5; if (self.y > 2732) { self.y = 0; } else if (self.y < 0) { self.y = 2732; } }; }); /**** * Initialize Game ****/ // Removed maze regeneration and player reinitialization // Removed player movement and click event listener related to the maze // Function to generate a random maze var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ var background1 = LK.getAsset('Background1', { anchorX: 0.5, anchorY: 0.5 }); background1.scaleX = 2048 / background1.width; background1.scaleY = 2732 / background1.height; background1.x = 2048 / 2; background1.y = 2732 / 2; game.addChild(background1); // Update game loop to move maze walls // Add event listener for player movement game.move = function (x, y, obj) { player.x = x; player.y = y; }; var mazeWalls = []; moveMazeWalls(); LK.setInterval(generateMazeWall, 1000); function generateMazeWall() { var wall; var rand = Math.random(); var speed = level == 2 ? 10 : 5; // Increase speed in level 2 if (level == 1) { if (rand < 0.1) { wall = new VerticalWall(); wall.scaleX = 0.25; wall.scaleY = Math.random() * 0.5 + 1.5; wall.x = Math.random() * (2048 - wall.width) + wall.width / 2; wall.y = -wall.height; wall.speed = speed; // Set speed } else if (rand < 0.2) { wall = new HorizontalWall(); wall.scaleX = Math.random() * 0.5 + 0.75; wall.scaleY = 0.25; wall.x = -wall.width; wall.y = Math.random() * (2732 - wall.height) + wall.height / 2; wall.speed = speed; // Set speed } else if (rand < 0.3) { wall = new RightWall(); wall.scaleX = 0.25; wall.scaleY = Math.random() * 0.5 + 1.5; wall.x = 2048 + wall.width; wall.y = Math.random() * (2732 - wall.height) + wall.height / 2; wall.speed = speed; // Set speed } else if (rand < 0.4) { wall = new BottomWall(); wall.scaleX = Math.random() * 0.5 + 0.75; wall.scaleY = 0.25; wall.x = Math.random() * (2048 - wall.width) + wall.width / 2; wall.y = 2732 + wall.height; wall.speed = speed; // Set speed } else if (rand < 0.5) { wall = new LeftWall(); wall.scaleX = 0.25; wall.scaleY = Math.random() * 0.5 + 1.5; wall.x = -wall.width; wall.y = Math.random() * (2732 - wall.height) + wall.height / 2; wall.speed = speed; // Set speed } else { wall = new TopWall(); wall.scaleX = Math.random() * 0.5 + 0.75; wall.scaleY = 0.25; wall.x = Math.random() * (2048 - wall.width) + wall.width / 2; wall.y = -wall.height; wall.speed = speed; // Set speed } mazeWalls.push(wall); game.addChild(wall); } else if (level == 2) { var background2 = LK.getAsset('Background2', { anchorX: 0.5, anchorY: 0.5 }); background2.scaleX = 2048 / background2.width; background2.scaleY = 2732 / background2.height; background2.x = 2048 / 2; background2.y = 2732 / 2; game.addChild(background2); if (rand < 0.25) { wall = new Container(); var wallGraphics = wall.attachAsset('Wall2', { anchorX: 0.5, anchorY: 0.5 }); wall.scaleX = 0.5; wall.scaleY = Math.random() * 1.0 + 2.0; wall.x = Math.random() * (2048 - wall.width) + wall.width / 2; wall.y = -wall.height; wall.update = function () { this.y += 5; if (this.y > 2732) { this.destroy(); } }; } else if (rand < 0.5) { wall = new Container(); var wallGraphics = wall.attachAsset('Wall2', { anchorX: 0.5, anchorY: 0.5 }); wall.scaleX = Math.random() * 1.0 + 1.5; wall.scaleY = 0.5; wall.x = -wall.width; wall.y = Math.random() * (2732 - wall.height) + wall.height / 2; wall.update = function () { this.x += 5; if (this.x > 2048) { this.destroy(); } }; } mazeWalls.push(wall); game.addChild(wall); } else if (level == 3) { var background3 = LK.getAsset('Background3', { anchorX: 0.5, anchorY: 0.5 }); background3.scaleX = 2048 / background3.width; background3.scaleY = 2732 / background3.height; background3.x = 2048 / 2; background3.y = 2732 / 2; game.addChild(background3); wall = new Container(); var wallGraphics = wall.attachAsset('wall3', { anchorX: 0.5, anchorY: 0.5 }); wall.scaleX = Math.random() * 0.5 + 0.75; wall.scaleY = Math.random() * 0.5 + 0.75; wall.x = Math.random() * (2048 - wall.width) + wall.width / 2; wall.y = Math.random() * (2732 - wall.height) + wall.height / 2; wall.update = function () { this.y += 5; if (this.y > 2732) { this.destroy(); } }; mazeWalls.push(wall); game.addChild(wall); wall = new Container(); var wallGraphics = wall.attachAsset('Wall2', { anchorX: 0.5, anchorY: 0.5 }); wall.scaleX = Math.random() * 0.5 + 0.75; wall.scaleY = Math.random() * 0.5 + 0.75; wall.x = Math.random() * (2048 - wall.width) + wall.width / 2; wall.y = Math.random() * (2732 - wall.height) + wall.height / 2; wall.update = function () { this.y += 5; if (this.y > 2732) { this.destroy(); } }; mazeWalls.push(wall); game.addChild(wall); } } function moveMazeWalls() { for (var i = mazeWalls.length - 1; i >= 0; i--) { mazeWalls[i].update(); if (mazeWalls[i].y > 2732) { mazeWalls.splice(i, 1); } } } LK.setInterval(generateMazeWall, 500); // Update timer every second LK.setInterval(function () { timer--; var minutes = Math.floor(timer / 60); var seconds = timer % 60; timerText.setText('Time: ' + minutes + ':' + (seconds < 10 ? '0' : '') + seconds); // If time is up, go to next level if (timer <= 0) { level++; if (level == 2) { timer = 40; // 40 seconds for level 2 } else if (level == 3) { timer = 60; // 60 seconds for level 3 } levelText.setText('Level: ' + level); } }, 1000); var player = new Player(); game.addChild(player); player.x = 2048 / 2; player.y = 2732 / 2; // Initialize timer and level variables var timer = 20; // 20 seconds for level 1 var level = 1; // Add level text to the top right corner var levelText = new Text2('Level: 1', { size: 100, fill: 0x808080 // Grey color }); levelText.anchor.set(1, 0); // Sets anchor to the top right corner of the text. LK.gui.topRight.addChild(levelText); // Add timer text to the top left corner var timerText = new Text2('Time: 0:20', { size: 100, fill: 0x808080 // Grey color }); timerText.anchor.set(0, 0); // Sets anchor to the top left corner of the text. LK.gui.topLeft.addChild(timerText); ;
===================================================================
--- original.js
+++ change.js
@@ -199,10 +199,10 @@
var wallGraphics = wall.attachAsset('Wall2', {
anchorX: 0.5,
anchorY: 0.5
});
- wall.scaleX = 0.25;
- wall.scaleY = Math.random() * 0.5 + 1.5;
+ wall.scaleX = 0.5;
+ wall.scaleY = Math.random() * 1.0 + 2.0;
wall.x = Math.random() * (2048 - wall.width) + wall.width / 2;
wall.y = -wall.height;
wall.update = function () {
this.y += 5;
@@ -215,10 +215,10 @@
var wallGraphics = wall.attachAsset('Wall2', {
anchorX: 0.5,
anchorY: 0.5
});
- wall.scaleX = Math.random() * 0.5 + 0.75;
- wall.scaleY = 0.25;
+ wall.scaleX = Math.random() * 1.0 + 1.5;
+ wall.scaleY = 0.5;
wall.x = -wall.width;
wall.y = Math.random() * (2732 - wall.height) + wall.height / 2;
wall.update = function () {
this.x += 5;