User prompt
move plants nfinite
User prompt
stop moving
User prompt
remove moving lines which is horigental
User prompt
make road lane line
User prompt
more lines
User prompt
closer
User prompt
closer white lines
User prompt
back
User prompt
remove other line
User prompt
back
User prompt
remove horigental white line
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'x')' in or related to this line: 'rightSideRoad.x = 1848;' Line Number: 92
User prompt
boundry a little inside
User prompt
side plants out of the boundry
User prompt
white line convert into mid in longitudinal with gaping
User prompt
red box convert into bike
User prompt
draw sides of road and trees
User prompt
opposit direction
User prompt
a bike running on it
User prompt
remove all and genrate a ifiniete road
Initial prompt
Moto Racers
/**** * Classes ****/ // Class for the bike var Bike = Container.expand(function () { var self = Container.call(this); var bikeGraphics = self.attachAsset('bikeAsset', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () {}; }); // Class for the road var Road = Container.expand(function () { var self = Container.call(this); var roadGraphics = self.attachAsset('road', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 10; self.update = function () { self.y += self.speed; if (self.y > 2732 + self.height) { self.y = -self.height + 800; } }; }); // Class for the side road var SideRoad = Container.expand(function () { var self = Container.call(this); var sideRoadGraphics = self.attachAsset('sideRoad', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () {}; }); // Class for the tree var Tree = Container.expand(function () { var self = Container.call(this); var treeGraphics = self.attachAsset('tree', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () {}; }); // Class for the white line var WhiteLine = Container.expand(function () { var self = Container.call(this); var whiteLineGraphics = self.attachAsset('whiteLine', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 10; self.update = function () { self.y += self.speed; if (self.y > 2732 + self.height) { self.y = -self.height + 400; } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Create and position two road segments var road1 = game.addChild(new Road()); road1.x = 1024; road1.y = 1366; var road2 = game.addChild(new Road()); road2.x = 1024; road2.y = 1366 + road1.height; // Create and position side roads var leftSideRoad = game.addChild(new SideRoad()); leftSideRoad.x = 200; var rightSideRoad = game.addChild(new SideRoad()); rightSideRoad.x = 1848; leftSideRoad.y = 1366; rightSideRoad.y = 1366; // Create and position two white lines var whiteLines = []; var whiteLine1 = game.addChild(new WhiteLine()); whiteLine1.x = 1024; whiteLine1.y = 0; whiteLines.push(whiteLine1); var whiteLine2 = game.addChild(new WhiteLine()); whiteLine2.x = 1024; whiteLine2.y = 400; whiteLines.push(whiteLine2); // Create and position trees var trees = []; for (var i = 0; i < 10; i++) { var tree = game.addChild(new Tree()); tree.x = Math.random() * 100 + 0; // Random x position outside the left boundary tree.y = Math.random() * 2732; // Random y position trees.push(tree); var tree2 = game.addChild(new Tree()); tree2.x = Math.random() * 100 + 1948; // Random x position outside the right boundary tree2.y = Math.random() * 2732; // Random y position trees.push(tree2); } // Create and position the bike var bike = game.addChild(new Bike()); bike.x = 1024; bike.y = 2000; // Update function for the game game.update = function () { road1.update(); road2.update(); leftSideRoad.update(); rightSideRoad.update(); bike.update(); trees.forEach(function (tree) { tree.update(); }); // Update the white lines whiteLines.forEach(function (whiteLine) { whiteLine.update(); }); };
===================================================================
--- original.js
+++ change.js
@@ -53,9 +53,9 @@
self.speed = 10;
self.update = function () {
self.y += self.speed;
if (self.y > 2732 + self.height) {
- self.y = -self.height;
+ self.y = -self.height + 400;
}
};
});
@@ -90,9 +90,9 @@
whiteLine1.y = 0;
whiteLines.push(whiteLine1);
var whiteLine2 = game.addChild(new WhiteLine());
whiteLine2.x = 1024;
-whiteLine2.y = 800;
+whiteLine2.y = 400;
whiteLines.push(whiteLine2);
// Create and position trees
var trees = [];
for (var i = 0; i < 10; i++) {