User prompt
If lander intersects platform and speed y is bigger than 1 then its game over
User prompt
If lander interscets with platfor and y speed is more than one then show crash asset and game over after 1 second
User prompt
Reduce fuel and y speed font size in half
User prompt
Move y speed text 50 pixels below fuel
User prompt
Below fuel show the y speed of the lander
User prompt
Show fuel quantity in the top right corner
User prompt
On click, lander will burst its thruster reduce its descensce speed
Initial prompt
Lander 1990
===================================================================
--- original.js
+++ change.js
@@ -16,8 +16,9 @@
self.y += self.speedY;
if (self.isThrusting && self.fuel > 0) {
self.speedY -= 0.2; // Thruster effect
self.fuel -= 1;
+ fuelTxt.setText(self.fuel.toString() + ' Fuel'); // Update fuel display
} else {
self.speedY += 0.05; // Gravity effect
}
}
@@ -26,8 +27,9 @@
self.isLanding = true;
};
self.refuel = function () {
self.fuel = 100;
+ fuelTxt.setText(self.fuel.toString() + ' Fuel'); // Update fuel display
};
});
// Platform class
var Platform = Container.expand(function () {
@@ -67,8 +69,16 @@
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
+// Fuel display text
+var fuelTxt = new Text2(lander.fuel.toString() + ' Fuel', {
+ size: 100,
+ fill: "#ffffff"
+});
+fuelTxt.anchor.set(1, 0);
+LK.gui.topRight.addChild(fuelTxt);
+
// Event listeners
game.on('down', function (obj) {
lander.isThrusting = true;
});