Code edit (1 edits merged)
Please save this source code
User prompt
under score, create a health bar, middle of the screen, labeled "Fuel" with the bar beside it
Code edit (2 edits merged)
Please save this source code
User prompt
increase score by 0.1 for every 1 second
Code edit (2 edits merged)
Please save this source code
User prompt
add track as background
Code edit (3 edits merged)
Please save this source code
User prompt
make the text white
User prompt
make the score visible in the middle of the screen
Code edit (1 edits merged)
Please save this source code
User prompt
add score tracker
Code edit (1 edits merged)
Please save this source code
User prompt
delete both tracks and show just background
User prompt
delete track
User prompt
place the score tracker labeled "distance" on top of the track
User prompt
place it over track
User prompt
add score tracker in white text, label it "Distance"
Code edit (14 edits merged)
Please save this source code
User prompt
dont delete track until -10000
Code edit (1 edits merged)
Please save this source code
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
/**** * 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 >= 10000) { self.destroy(); } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ 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('Distance: 0', { size: 500, fill: "#ffffff" }); scoreTxt.anchor.set(0.5, 0); game.addChild(scoreTxt); scoreTxt.x = 2048 / 2; scoreTxt.y = 100; 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
@@ -80,9 +80,9 @@
tires[j].destroy();
tires.splice(j, 1);
var score = 0;
var scoreTxt = new Text2('Distance: 0', {
- size: 100,
+ size: 500,
fill: "#ffffff"
});
scoreTxt.anchor.set(0.5, 0);
game.addChild(scoreTxt);
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