User prompt
dont delete the track untill it completely disappears from screen
Code edit (4 edits merged)
Please save this source code
User prompt
sew tracks together
Code edit (10 edits merged)
Please save this source code
User prompt
connect the tracks before they become visible on the playspace
User prompt
Use two background-images, that move in the same speed. When it reached a specific point(like x = -2048), move the background to x = 4096.
User prompt
make backgroung seamless
Code edit (1 edits merged)
Please save this source code
Code edit (13 edits merged)
Please save this source code
User prompt
track is disappearing at the bottom
Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: game.setBackground is not a function' in or related to this line: 'game.setBackground(track1);' Line Number: 97
User prompt
make 'track' the background
User prompt
can't see score
User prompt
add score tracker, 1 second of time equals 100 ft., place it in the lower right side of the screen
Code edit (1 edits merged)
Please save this source code
Code edit (6 edits merged)
Please save this source code
User prompt
put distance tracker over 'track'
User prompt
add distance tracker, 1 second of driving equals 100 ft., wild font n top right corner
Code edit (3 edits merged)
Please save this source code
User prompt
keep dunebuggy in middle half of the screen
User prompt
dunebuggy stays in middle half of the screen
User prompt
add a 3rd 'track' to keep it from disappearing
User prompt
the track is disappearing again, do i need to make it longer?
User prompt
ok the track stopped disappearing but it skips now.
/**** * Classes ****/ //<Assets used in the game will automatically appear here> // DuneBuggy class to represent the player's vehicle var DuneBuggy = Container.expand(function () { var self = Container.call(this); var buggyGraphics = self.attachAsset('duneBuggy', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { // Update logic for the buggy, if needed }; }); // Obstacle class to represent obstacles in the game var GasCan = Container.expand(function () { var self = Container.call(this); var gascanGraphics = self.attachAsset('gascan', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -3; self.update = function () { self.y += self.speed; }; }); // Tire class to represent tires that can be picked up var Tire = Container.expand(function () { var self = Container.call(this); var tireGraphics = self.attachAsset('tire', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -3; self.update = function () { self.y += self.speed; }; }); // Track class to represent the scrolling track var Track = Container.expand(function () { var self = Container.call(this); var trackGraphics = self.attachAsset('track', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -13; self.update = function () { self.y -= self.speed; if (self.y >= 2732) { self.y = -4200; } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Initialize the track var track1 = game.addChild(new Track()); track1.x = 1500 / 2; track1.y = 2732 / 2; var track2 = game.addChild(new Track()); track2.x = 1500 / 2; track2.y = 15000 / 2; var duneBuggy = game.addChild(new DuneBuggy()); duneBuggy.x = 2048 / 2; duneBuggy.y = 2732 - 200; var gasCans = []; for (var i = gasCans.length - 1; i >= 0; i--) { gasCans[i].update(); if (gasCans[i].y < -50) { gasCans[i].destroy(); gasCans.splice(i, 1); var tires = []; for (var j = tires.length - 1; j >= 0; j--) { tires[j].update(); if (tires[j].y < -50) { tires[j].destroy(); tires.splice(j, 1); var score = 0; var scoreTxt = new Text2('Score: 0', { size: 100, fill: "#ffffff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); game.update = function () { // Update obstacles and track track1.update(); track2.update(); }; if (duneBuggy.intersects(gasCans[i])) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } } // Update supplies } if (duneBuggy.intersects(tires[j])) { score += 10; scoreTxt.setText('Score: ' + score); tires[j].destroy(); tires.splice(j, 1); } } // Spawn new obstacles and tires if (LK.ticks % 60 == 0) { var newGasCan = new GasCan(); newGasCan.x = Math.random() * 2048; newGasCan.y = 0; gasCans.push(newGasCan); game.addChild(newGasCan); } if (LK.ticks % 120 == 0) { var newTire = new Tire(); newTire.x = Math.random() * 2048; newTire.y = 0; tires.push(newTire); game.addChild(newTire); } } ; game.down = function (x, y, obj) { duneBuggy.x = x; }; game.move = function (x, y, obj) { if (x > 1024 / 2 && x < 3 * 1024 / 2) { duneBuggy.x = x; } }; game.up = function (x, y, obj) { // No action needed on up event };
===================================================================
--- original.js
+++ change.js
@@ -47,9 +47,9 @@
});
self.speed = -13;
self.update = function () {
self.y -= self.speed;
- if (self.y >= 4200) {
+ if (self.y >= 2732) {
self.y = -4200;
}
};
});
@@ -65,13 +65,13 @@
* Game Code
****/
// Initialize the track
var track1 = game.addChild(new Track());
-track1.x = 2048 / 2;
+track1.x = 1500 / 2;
track1.y = 2732 / 2;
var track2 = game.addChild(new Track());
-track2.x = 2048 / 2;
-track2.y = 4096 / 2;
+track2.x = 1500 / 2;
+track2.y = 15000 / 2;
var duneBuggy = game.addChild(new DuneBuggy());
duneBuggy.x = 2048 / 2;
duneBuggy.y = 2732 - 200;
var gasCans = [];
sheep
Sound effect
crash
Sound effect
yelp
Sound effect
rabbit
Sound effect
runner
Sound effect
runner
Sound effect
roar
Sound effect
airwrench
Sound effect
liquid
Sound effect
music
Music
crash2
Sound effect
yehaw
Sound effect
woohoo
Sound effect
bird
Sound effect
splat
Sound effect
splat
Sound effect
gascanbonus
Sound effect
tirebonus
Sound effect