User prompt
Generat a random maze with rando shapes of wall
User prompt
Adjust the game
User prompt
sLOW IT more
User prompt
Slow the spawning
User prompt
Make roots with walls for player to move inside it
User prompt
Don't span walls in the screen spawn only from the top
User prompt
Reduce walls numbers
User prompt
Do game over only if time 0
User prompt
Let player dodge the walls till reach top make statu text time of 1 min each time touch top rest time
User prompt
Don't make game over only if maze touched the bottom
User prompt
Please fix the bug: 'ReferenceError: NewWall is not defined' in or related to this line: 'if ((game.children[i] instanceof Wall || game.children[i] instanceof NewWall) && self.intersects(game.children[i])) {' Line Number: 79
User prompt
Make random maze spawning from the top
User prompt
Make movable maze moved slowly
User prompt
Make some walls constreaned 2 2 or 3 3
User prompt
Increass the numbers of walls
User prompt
Make game over
User prompt
Make the object touchable for the player
User prompt
Make the spawning between left and right sides of the screen only
User prompt
Increes the nuber of walls
User prompt
Don't make game over
User prompt
Adjust the screen
User prompt
Please fix the bug: 'ReferenceError: newObjects is not defined' in or related to this line: 'newObjects.push(newObject);' Line Number: 171
User prompt
Please fix the bug: 'ReferenceError: newObjects is not defined' in or related to this line: 'newObjects.push(newObject);' Line Number: 171
User prompt
Please fix the bug: 'ReferenceError: newObjects is not defined' in or related to this line: 'newObjects.push(newObject);' Line Number: 171
User prompt
Make more objects
/**** * Classes ****/ // Create an Exit class var Exit = Container.expand(function () { var self = Container.call(this); var exitGraphics = self.attachAsset('line', { anchorX: 0.5, anchorY: 0.5, width: blockSize, height: blockSize }); }); // Create a new object class var NewObject = Container.expand(function () { var self = Container.call(this); var newObjectGraphics = self.attachAsset('new_object', { anchorX: 0.5, anchorY: 0.5, width: blockSize, height: blockSize }); }); // Create a NewWall class var NewWall = Container.expand(function () { var self = Container.call(this); var newWallGraphics = self.attachAsset('new_wall', { anchorX: 0.5, anchorY: 0.5, width: blockSize, height: blockSize }); self.speed = 5; self.update = function () { self.y += self.speed; }; }); //<Assets used in the game will automatically appear here> // 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 = 8; self.vx = 0; self.vy = 0; self.update = function () { var oldX = self.x; var oldY = self.y; 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 = 0; } // Check for collision with wall and space for (var i = 0; i < game.children.length; i++) { if ((game.children[i] instanceof Wall || game.children[i] instanceof NewWall) && self.intersects(game.children[i])) { // Add a push effect to the player when it collides with a wall self.x = oldX; self.y = oldY; break; } else if (game.children[i] instanceof Space && self.intersects(game.children[i])) { // Allow the player to pass through spaces continue; } else if (game.children[i] instanceof Exit && self.intersects(game.children[i])) { // Allow the player to pass through the line continue; } } }; }); // Create a Space class var Space = Container.expand(function () { var self = Container.call(this); var spaceGraphics = self.attachAsset('line', { anchorX: 0.5, anchorY: 0.5, width: blockSize * 2, height: blockSize * 2 }); }); // Create a Wall class var Wall = Container.expand(function () { var self = Container.call(this); var wallGraphics = self.attachAsset('new_wall', { anchorX: 0.5, anchorY: 0.5, width: blockSize, height: blockSize }); }); /**** * Initialize Game ****/ // Check for collision with wall // Function to generate a random maze var game = new LK.Game({ backgroundImage: 'Background1' }); /**** * Game Code ****/ var background = game.attachAsset('Background1', { anchorX: 0, anchorY: 0, width: game.width, height: game.height }); game.addChild(background); // Add move event to the game game.move = function (x, y, obj) { // Move the player to the x position of the touch or mouse event player.x = x - player.width / 2; }; var blockSize = 100; // Add player to the bottom middle of the screen var player = game.addChild(new Player()); player.x = game.width / 2; player.y = game.height - player.height / 2; ; game.down = function (x, y, obj) { // Start moving the player when touch or mouse down game.move(x, y, obj); }; game.up = function (x, y, obj) { // Stop moving the player when touch or mouse up player.vx = 0; }; // Create an array to store the NewWall instances var newWalls = []; // Add an update function to the game game.update = function () { // Add a new wall every 60 ticks if (LK.ticks % 60 == 0) { var newWall = new NewWall(); newWall.x = Math.random() * game.width; newWall.y = 0; newWalls.push(newWall); game.addChild(newWall); } // Create an array to store the NewObject instances var newObjects = []; // Add a new object every 120 ticks if (LK.ticks % 120 == 0) { var newObject = new NewObject(); newObject.x = Math.random() * game.width; newObject.y = 0; newObjects.push(newObject); game.addChild(newObject); } // Check for collision between the player and the new walls for (var i = newWalls.length - 1; i >= 0; i--) { if (player.intersects(newWalls[i])) { // Game over if the player touches a new wall LK.showGameOver(); } // Remove the new wall if it has moved off the screen if (newWalls[i].y > game.height) { game.removeChild(newWalls[i]); newWalls.splice(i, 1); } } };
===================================================================
--- original.js
+++ change.js
@@ -142,10 +142,8 @@
player.vx = 0;
};
// Create an array to store the NewWall instances
var newWalls = [];
-// Create an array to store the NewObject instances
-var newObjects = [];
// Add an update function to the game
game.update = function () {
// Add a new wall every 60 ticks
if (LK.ticks % 60 == 0) {
@@ -154,8 +152,10 @@
newWall.y = 0;
newWalls.push(newWall);
game.addChild(newWall);
}
+ // Create an array to store the NewObject instances
+ var newObjects = [];
// Add a new object every 120 ticks
if (LK.ticks % 120 == 0) {
var newObject = new NewObject();
newObject.x = Math.random() * game.width;