User prompt
move center left and right messages behind lander on z axis
Code edit (2 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: rightThruster is not defined' in this line: 'rightThruster.visible = false;' Line Number: 88
User prompt
Fix Bug: 'ReferenceError: rightThruster is not defined' in this line: 'rightThruster.visible = false;' Line Number: 88
User prompt
Fix Bug: 'ReferenceError: leftThruster is not defined' in this line: 'leftThruster.visible = false;' Line Number: 81
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'x')' in this line: 'downThruster.x = lander.x;' Line Number: 407
User prompt
lander should be infront of messages in z axis
User prompt
add alfa of .5 to left rigth center message and dotted lines
User prompt
add more space between dots of dotted line
Code edit (1 edits merged)
Please save this source code
User prompt
move left center and right message 200 pixels higher
User prompt
On game start show 3 messages centered between the dotted lines. They should read, Left, Center and Right.
User prompt
add two dotted lines that split the screen in thirds vertically
User prompt
On platform reposition, make sure the whole asset is shown and no part is outside of the screen border
User prompt
After lander respwan restbx speed to 0
Code edit (1 edits merged)
Please save this source code
User prompt
Om lander respawn set x speed to 0
User prompt
platform should start moving on level 10
User prompt
asteroids should starts spawning on level 5
Code edit (1 edits merged)
Please save this source code
User prompt
Start moving method should have a 1 second pause before repositioning the platform
User prompt
When lander lands successfully, keep movingplatform in the same position of the impact for 1 second.
User prompt
Plaform asset should remain in its place for 1 second before respawn when lander lands
User prompt
Platform show always be placed in the 90% size center of x
User prompt
Hide lander for 1 second on respawn after succesfull landing
===================================================================
--- original.js
+++ change.js
@@ -42,18 +42,8 @@
self.speedY = 0;
self.fuel = 500;
self.isThrusting = false;
self.isLanding = false;
- // Initialize thrusters
- self.downThruster = new DownThruster();
- self.leftThruster = new LeftThruster();
- self.rightThruster = new RightThruster();
- self.addChild(self.downThruster);
- self.addChild(self.leftThruster);
- self.addChild(self.rightThruster);
- self.downThruster.visible = false;
- self.leftThruster.visible = false;
- self.rightThruster.visible = false;
self.update = function () {
if (!self.isLanding) {
self.x += self.speedX;
self.y += self.speedY;
@@ -73,27 +63,27 @@
ySpeedTxt.setText('Y Speed: ' + self.speedY.toFixed(2)); // Update Y Speed display
}
// Update thruster position and visibility
if (self.thrustDirection === 'left') {
- self.leftThruster.x = self.x - self.width / 2;
- self.leftThruster.y = self.y;
- self.leftThruster.visible = self.isThrusting;
+ leftThruster.x = self.x - self.width / 2;
+ leftThruster.y = self.y;
+ leftThruster.visible = self.isThrusting;
} else {
- self.leftThruster.visible = false;
+ leftThruster.visible = false;
}
if (self.thrustDirection === 'right') {
- self.rightThruster.x = self.x + self.width / 2;
- self.rightThruster.y = self.y;
- self.rightThruster.visible = self.isThrusting;
+ rightThruster.x = self.x + self.width / 2;
+ rightThruster.y = self.y;
+ rightThruster.visible = self.isThrusting;
} else {
- self.rightThruster.visible = false;
+ rightThruster.visible = false;
}
if (self.thrustDirection === 'down') {
- self.downThruster.x = 0;
- self.downThruster.y = self.height / 2 + 10;
- self.downThruster.visible = self.isThrusting;
+ downThruster.x = self.x;
+ downThruster.y = self.y + self.height / 2 + 10;
+ downThruster.visible = self.isThrusting;
} else {
- self.downThruster.visible = false;
+ downThruster.visible = false;
}
};
self.land = function () {
self.isLanding = true;
@@ -231,10 +221,10 @@
/****
* Game Code
****/
-// Initialize lander
// Stars class
+// Initialize lander
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
@@ -408,11 +398,20 @@
fill: "#ffffff"
});
scoreTxt.anchor.set(0.5, 0);
//LK.gui.top.addChild(scoreTxt);
+var lander = game.addChild(new Lander());
+lander.x = 1024; // Start in the middle of the screen horizontally
+lander.y = 250; // Start 250 pixels down from the top
// Initialize thrusters
-
+var downThruster = game.addChild(new DownThruster());
+downThruster.x = lander.x;
+downThruster.y = lander.y + lander.height / 2; // Position down thruster at the bottom center of the lander
+var leftThruster = game.addChild(new LeftThruster());
+leftThruster.visible = false;
+var rightThruster = game.addChild(new RightThruster());
+rightThruster.visible = false;
// Initialize level manager
var levelManager = game.addChild(new Level());
// Create and add two vertical dotted lines
@@ -449,20 +448,15 @@
var rightMessage = new Text2('Right\nThruster', {
size: 100,
fill: '#ffffff',
align: 'center',
- alpha: 0.5
+ alpha: 0.1
});
rightMessage.anchor.set(0.5, 0.5);
rightMessage.x = 2048 - 2048 / 3 / 2;
rightMessage.y = 1166;
game.addChild(rightMessage);
-// Initialize lander in front of messages
-var lander = game.addChild(new Lander());
-lander.x = 1024; // Start in the middle of the screen horizontally
-lander.y = 250; // Start 250 pixels down from the top
-
// Game variables
var isGameOver = false;
var isPaused = false;
var pauseTimer = 0;