User prompt
Resize the player and exit to be bigger then this a bit
User prompt
Save this maze to be the level 1 don't generate more when loading the game let this one be the only game maze.
User prompt
Make the top right inside corner maze the exit
User prompt
Make it inside corner not outside
User prompt
Make the player in bottom right inside corner of the maze
User prompt
Don't generate inside walls corners now.
User prompt
Dont generate walls in the corners of the maze
User prompt
Slow its movment
User prompt
Make only 4 directions for the cube
User prompt
Make collision for the new walls
User prompt
Randomize the shapes
User prompt
Make the screen the ground for all objects and all can be touched
User prompt
add collision to player
User prompt
change the shape of maze walls
User prompt
do different shapes
User prompt
Add same walls of the removed maze
User prompt
Let the walls maze and the maze just remove the random option to not randomize the maze in each load of the game.
User prompt
Remove random obstacles function let this maze for the game now.
User prompt
Make player move by click direction and follow that direction
User prompt
Add more
User prompt
Make the obstacle walls can be touched
User prompt
random the shapes of walls for the maze inside all the space
User prompt
Fill the maze by abstacles
User prompt
Make it inside maze corner not screen corner
User prompt
Hold position player on the left bottom walls of maze corner
/**** * Classes ****/ // Create an Exit class var Exit = Container.expand(function () { var self = Container.call(this); var exitGraphics = self.attachAsset('Exit', { anchorX: 1, anchorY: 1, width: blockSize * 2, height: blockSize * 2 }); }); // Create a Player class var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5, width: blockSize, height: blockSize }); self.speed = 2; self.update = function () { self.x += self.vx; self.y += self.vy; if (self.x < 0) { self.x = 0; } if (self.y < 0) { self.y = 0; } if (self.x > game.width) { self.x = game.width; } if (self.y > game.height) { self.y = game.height; } for (var i = 0; i < game.children.length; i++) { if (game.children[i] instanceof Wall && self.intersects(game.children[i])) { LK.showGameOver(); } } }; }); //<Assets used in the game will automatically appear here> // Create a Wall class var Wall = Container.expand(function () { var self = Container.call(this); var wallGraphics = self.attachAsset('wall', { anchorX: 0.5, anchorY: 0.5 }); }); /**** * Initialize Game ****/ // Function to generate a random maze var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Function to generate a static maze var blockSize = 50; var background = LK.getAsset('Background1', { anchorX: 0.5, anchorY: 0.5 }); background.width = game.width; background.height = game.height; background.x = game.width / 2; background.y = game.height / 2; game.addChildAt(background, 0); function generateMaze() { var mazeWidth = Math.floor(game.width / blockSize); var mazeHeight = Math.floor(game.height / blockSize); for (var i = 0; i < mazeWidth; i++) { for (var j = 0; j < mazeHeight; j++) { if ((i === 0 || i === mazeWidth - 1 || j === 0 || j === mazeHeight - 1 || Math.random() < 0.3) && !(i === 0 && j === 0) && !(i === 0 && j === mazeHeight - 1) && !(i === mazeWidth - 1 && j === 0) && !(i === mazeWidth - 1 && j === mazeHeight - 1)) { var wall = LK.getAsset('wall', { anchorX: 0.5, anchorY: 0.5 }); wall.width = blockSize; wall.height = blockSize; wall.x = i * blockSize + blockSize / 2; wall.y = j * blockSize + blockSize / 2; game.addChild(wall); } } } } generateMaze(); var player = game.addChild(new Player()); player.x = blockSize * 1.5; player.y = game.height - blockSize * 1.5; // Create an exit in the maze var exit = game.addChild(new Exit()); exit.width = blockSize; exit.height = blockSize; exit.x = game.width - blockSize * 2.5; exit.y = blockSize * 2.5; // Add mouse down event to make player follow the cursor only when clicked and dragged var dragNode = null; game.down = function (x, y, obj) { var dx = x - player.x; var dy = y - player.y; if (Math.abs(dx) > Math.abs(dy)) { // Horizontal movement player.vx = dx > 0 ? player.speed : -player.speed; player.vy = 0; } else { // Vertical movement player.vx = 0; player.vy = dy > 0 ? player.speed : -player.speed; } }; game.move = function (x, y, obj) { if (dragNode) { var oldX = dragNode.x; var oldY = dragNode.y; dragNode.x = x - dragNode.width / 2; dragNode.y = y - dragNode.height / 2; for (var i = 0; i < game.children.length; i++) { if (game.children[i] instanceof Wall && dragNode.intersects(game.children[i])) { dragNode.x = oldX; dragNode.y = oldY; break; } } if (player.intersects(exit)) { LK.showGameOver(); } } }; game.up = function (x, y, obj) { dragNode = null; };
===================================================================
--- original.js
+++ change.js
@@ -79,9 +79,9 @@
var mazeWidth = Math.floor(game.width / blockSize);
var mazeHeight = Math.floor(game.height / blockSize);
for (var i = 0; i < mazeWidth; i++) {
for (var j = 0; j < mazeHeight; j++) {
- if (i === 0 || i === mazeWidth - 1 || j === 0 || j === mazeHeight - 1 || Math.random() < 0.3) {
+ if ((i === 0 || i === mazeWidth - 1 || j === 0 || j === mazeHeight - 1 || Math.random() < 0.3) && !(i === 0 && j === 0) && !(i === 0 && j === mazeHeight - 1) && !(i === mazeWidth - 1 && j === 0) && !(i === mazeWidth - 1 && j === mazeHeight - 1)) {
var wall = LK.getAsset('wall', {
anchorX: 0.5,
anchorY: 0.5
});