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.
User prompt
why does the bottom of the track disappear?
Code edit (1 edits merged)
Please save this source code
User prompt
scroll track in opposite direction
User prompt
scroll track on infinate loop
User prompt
load 'track' as background
User prompt
Rename 'supply' to 'tire'
User prompt
Rename 'obstacle' to 'gascan'
Initial prompt
Dust Devil Dash!
/**** * 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 >= 4200) { 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 = 2048 / 2; track1.y = 2732 / 2; var track2 = game.addChild(new Track()); track2.x = 2048 / 2; track2.y = 0; 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 > 1100 / 2 && x < 3 * 1024 / 2) { duneBuggy.x = x; } }; game.up = function (x, y, obj) { // No action needed on up event };
===================================================================
--- original.js
+++ change.js
@@ -132,9 +132,9 @@
game.down = function (x, y, obj) {
duneBuggy.x = x;
};
game.move = function (x, y, obj) {
- if (x > 1024 / 2 && x < 3 * 1024 / 2) {
+ if (x > 1100 / 2 && x < 3 * 1024 / 2) {
duneBuggy.x = x;
}
};
game.up = function (x, y, obj) {
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