User prompt
Another wall respawning with wall2!
User prompt
Remove wall1 from the screen if level 2 start and replace it by wall2
User prompt
Check for bugs
User prompt
Replace wall1 by wall2 in level 2
User prompt
Remove wall 1 from level 2
User prompt
Remove mazewalls from level 2
User prompt
Respawn wall2 from right side
User prompt
wall1 still respawning in level2!
User prompt
Fix th egame in level 2
User prompt
Stop respawning from left and right in level 2
User prompt
Add wall2 to level 2 from top random shapes as level 1
User prompt
Remove all walls from level 2
User prompt
If level 2 start stop respawning of level 1 objects
User prompt
Set wall2 respawning from the top randomly in level 2
User prompt
Remove the respawning in level 2
User prompt
Remove wall1 from level 2
User prompt
Respawn asset Wall2 from top in level 2, remove wall1 respawning from level 2
User prompt
Remove statu of 30 sec
User prompt
Make time 10 in level1 remove 30 sec
User prompt
Remove respawning from right side in level 2 add wall2 to level 2 random respawning from the top
User prompt
Respawn wall1 only in level 1 not in level 2
User prompt
fix set 13
User prompt
Remove respwning from top in level 1
User prompt
Reduce respawning in level 1
User prompt
Respawn wall1 in level 1 randomly from top and right Respawn wall2 in level 2 randomly from top and left Respawn wall3 in level 3 randomly from top and bottom
/****
* Classes
****/
var BottomWall = Container.expand(function () {
var self = Container.call(this);
var wallGraphics = self.attachAsset('wall1', {
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('wall1', {
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('wall1', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
self.x -= 5;
if (self.x < 0) {
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]) && mazeWalls[i].parent) {
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) {
LK.showGameOver();
}
}
}
};
});
var RightWall = Container.expand(function () {
var self = Container.call(this);
var wallGraphics = self.attachAsset('wall1', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
self.x += 5;
if (self.x > 2048) {
self.destroy();
}
};
});
var TopWall = Container.expand(function () {
var self = Container.call(this);
var wallGraphics = self.attachAsset('wall1', {
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('wall1', {
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);
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);
}
// 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, 2000);
function generateMazeWall() {
var wall;
var rand = Math.random();
var speed = 5; // Default speed
if (level == 1) {
if (Math.random() > 0.5) {
// Spawn from the right
wall = new Container();
var wallGraphics = wall.attachAsset('wall1', {
anchorX: 0.5,
anchorY: 0.5
});
wall.scaleX = 0.25;
wall.scaleY = Math.random() * 0.5 + 0.75;
wall.x = 2048 + wall.width;
wall.y = Math.random() * (2732 - wall.height) + wall.height / 2;
wall.speed = speed;
mazeWalls.push(wall);
game.addChild(wall);
wall.update = function () {
this.x -= this.speed;
if (this.x < -this.width) {
this.x = 2048 + this.width;
this.y = Math.random() * (2732 - this.height) + this.height / 2;
}
};
}
} else if (level == 2) {
// Spawn from the top
wall = new Container();
var wallGraphics = wall.attachAsset('Wall2', {
anchorX: 0.5,
anchorY: 0.5
});
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;
mazeWalls.push(wall);
game.addChild(wall);
wall.update = function () {
this.y += this.speed;
if (this.y > 2732) {
this.y = -this.height;
this.x = Math.random() * (2048 - this.width) + this.width / 2;
}
};
} else if (level == 3) {
if (Math.random() > 0.5) {
// Spawn from the top
wall = new Container();
var wallGraphics = wall.attachAsset('Wall3', {
anchorX: 0.5,
anchorY: 0.5
});
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;
mazeWalls.push(wall);
game.addChild(wall);
wall.update = function () {
this.y += this.speed;
if (this.y > 2732) {
this.y = -this.height;
this.x = Math.random() * (2048 - this.width) + this.width / 2;
}
};
}
if (Math.random() > 0.5) {
// Spawn from the bottom
wall = new Container();
var wallGraphics = wall.attachAsset('Wall3', {
anchorX: 0.5,
anchorY: 0.5
});
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;
mazeWalls.push(wall);
game.addChild(wall);
wall.update = function () {
this.y -= this.speed;
if (this.y < -this.height) {
this.y = 2732 + this.height;
this.x = Math.random() * (2048 - this.width) + this.width / 2;
}
};
}
}
}
function moveMazeWalls() {
for (var i = mazeWalls.length - 1; i >= 0; i--) {
mazeWalls[i].update();
if (mazeWalls[i].y > 2732 || mazeWalls[i].y < -mazeWalls[i].height || mazeWalls[i].x > 2048 || mazeWalls[i].x < -mazeWalls[i].width) {
mazeWalls[i].destroy(); // Ensure wall is removed from the game
mazeWalls.splice(i, 1);
}
}
}
LK.setInterval(generateMazeWall, 500);
// Update timer every second
LK.setInterval(function () {
timer--;
var seconds = timer;
timerText.setText('Time: ' + (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);
}
// Remove lag when reach 5 sec
if (timer == 5) {
LK.clearInterval(generateMazeWall);
}
}, 1000);
var player = new Player();
game.addChild(player);
player.x = 2048 / 2;
player.y = 2732 / 2;
// Initialize timer and level variables
var timer = 10; // 10 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: 10', {
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
@@ -172,30 +172,28 @@
}
};
}
} else if (level == 2) {
- if (Math.random() > 0.5) {
- // Spawn from the top
- wall = new Container();
- var wallGraphics = wall.attachAsset('Wall2', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- 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;
- mazeWalls.push(wall);
- game.addChild(wall);
- wall.update = function () {
- this.y += this.speed;
- if (this.y > 2732) {
- this.y = -this.height;
- this.x = Math.random() * (2048 - this.width) + this.width / 2;
- }
- };
- }
+ // Spawn from the top
+ wall = new Container();
+ var wallGraphics = wall.attachAsset('Wall2', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ 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;
+ mazeWalls.push(wall);
+ game.addChild(wall);
+ wall.update = function () {
+ this.y += this.speed;
+ if (this.y > 2732) {
+ this.y = -this.height;
+ this.x = Math.random() * (2048 - this.width) + this.width / 2;
+ }
+ };
} else if (level == 3) {
if (Math.random() > 0.5) {
// Spawn from the top
wall = new Container();
Playable maze with orange lines. at black background.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d coin. Ninja face in the coin. red coin. 2 circles inside it. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Fullscreen, high definition, light, blur, small time watch, colors, wood, for a game titled "Maze" and with the description "Navigate ever-changing mazes! Each level with different background, coins, time speed. Can you finish collecting coins before time is up? Challenge your skills in Maze!". with text on banner "MAZE"!