User prompt
Don't let player pass the maze walls
User prompt
1-Fill the inside space of maze walls with obstacles. 2-Make exit and player inside corner of walls
User prompt
Make many obstacles
User prompt
Make a static maze with different obstacles if player touch any obstacles do game over. Make the player in left bottom corner of the maze and exit on the top right of it
User prompt
Don't change th maze shape each time randoly let only one maze
User prompt
Make the player follow cursor exact same time not far from it
User prompt
If player touch exit asset in the maze do game over
User prompt
Don't teleport player to cursor and let it follow it only if hold on it
User prompt
Make collision between wall asset and player and can't pass through it if moving on the screen. can only move in the spaces.
User prompt
Resize the player and choose random location on the maze
User prompt
Make the exit in the middle of the screen
User prompt
resize it
User prompt
Make exit assets the exit in the maze
User prompt
Make the player position the right bottom side inside the maze not inside walls or outside it corner.
Code edit (1 edits merged)
Please save this source code
User prompt
Regenerate player and exit for the maze to be played
User prompt
Make the exit on the right top corner befor walls
User prompt
Add the exit asset to the maze make it shown in the screen, with same size of small wall asset
User prompt
Make the player position the left bottom corner inside maze
User prompt
Make the player have same size of the small walls without changing anything of the maze or its shape
User prompt
Add exit to the maze
User prompt
Change the exit position to be right upper corner before maze walls
User prompt
Add the exit asset to the game
User prompt
Analyse the game!
User prompt
Change playre position to the right 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 = 5;
self.update = function () {
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 || i === 3 && j > 2 && j < 8 || i === 6 && j > 4 && j < 10 || i > 6 && i < 10 && j === 6 || i === 8 && j > 2 && j < 8 || i === 10 && j > 4 && j < 10 || i > 10 && i < 14 && j === 8 || i === 5 && j === 5 || i === 7 && j === 7 || i === 9 && j === 9 || i === 11 && j === 11 || i === 13 && j === 13) {
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 * 2;
player.y = game.height - blockSize * 2;
// Create an exit in the maze
var exit = game.addChild(new Exit());
exit.width = blockSize;
exit.height = blockSize;
exit.x = game.width - blockSize * 2;
exit.y = blockSize * 2;
// Add mouse down event to make player follow the cursor only when clicked and dragged
var dragNode = null;
game.down = function (x, y, obj) {
dragNode = player;
};
game.move = function (x, y, obj) {
if (dragNode) {
dragNode.x = x - dragNode.width / 2;
dragNode.y = y - dragNode.height / 2;
if (player.intersects(exit)) {
LK.showGameOver();
}
}
};
game.up = function (x, y, obj) {
dragNode = null;
}; ===================================================================
--- original.js
+++ change.js
@@ -35,10 +35,9 @@
self.y = game.height;
}
for (var i = 0; i < game.children.length; i++) {
if (game.children[i] instanceof Wall && self.intersects(game.children[i])) {
- self.x -= self.speed * Math.sign(self.x - game.children[i].x);
- self.y -= self.speed * Math.sign(self.y - game.children[i].y);
+ LK.showGameOver();
}
}
};
});
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"!