User prompt
roket hizlanmasini 5 kat azaltalim
User prompt
tikladigimiz zaman roketin hizi yavas artsin
User prompt
mouse tiklayinca ivmelenmeyi 4 kat daha azaltalim
User prompt
yer cekimini 2 kat arttiralim
User prompt
ivmelenmeyi %75 dusurelim
User prompt
biraz daha azaltalim
User prompt
ivmeyi biraz azaltalim
User prompt
uzay mekigi serbest dusus yapsin ve biz gaz verince yavaslasin
Code edit (1 edits merged)
Please save this source code
User prompt
Space Lander
Initial prompt
yukaridan asagi dogru inen bir uzay mekigini ekranin altindaki rastgele yerlerde cikan platforma mouse yardimi ile indirmeye calistigimiz bir oyun yapalim
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Platform = Container.expand(function () {
var self = Container.call(this);
var platformGraphics = self.attachAsset('platform', {
anchorX: 0.5,
anchorY: 0.5
});
self.landingZone = 180; // Safe landing zone width
self.checkLanding = function (spacecraft) {
var dx = Math.abs(spacecraft.x - self.x);
var dy = Math.abs(spacecraft.y - self.y);
if (dx < self.landingZone / 2 && dy < 80) {
// Check if landing speed is safe
if (spacecraft.velocityY < 4 && Math.abs(spacecraft.velocityX) < 3) {
spacecraft.land();
return true;
} else {
spacecraft.crash();
return false;
}
}
return false;
};
return self;
});
var Spacecraft = Container.expand(function () {
var self = Container.call(this);
var body = self.attachAsset('spacecraft', {
anchorX: 0.5,
anchorY: 0.5
});
var flame = self.attachAsset('flame', {
anchorX: 0.5,
anchorY: 0,
x: 0,
y: 60
});
self.velocityX = 0;
self.velocityY = 2; // Base descent speed
self.thrust = 0;
self.maxThrust = 6;
self.thrustDecay = 0.9;
self.horizontalDamping = 0.95;
self.isLanded = false;
self.lastLanded = false;
flame.visible = false;
self.update = function () {
if (self.isLanded) return;
// Apply thrust and movement
self.velocityY -= self.thrust;
self.velocityX *= self.horizontalDamping;
self.thrust *= self.thrustDecay;
// Apply gravity
self.velocityY += 0.15;
// Update position
self.x += self.velocityX;
self.y += self.velocityY;
// Keep spacecraft in bounds horizontally
if (self.x < 40) {
self.x = 40;
self.velocityX = 0;
}
if (self.x > 2008) {
self.x = 2008;
self.velocityX = 0;
}
// Show flame when thrusting
flame.visible = self.thrust > 0.5;
// Check if crashed (hit bottom without landing)
if (self.y > 2650) {
self.crash();
}
};
self.applyThrust = function (direction) {
self.thrust = Math.min(self.maxThrust, self.thrust + 0.8);
if (direction !== 0) {
self.velocityX += direction * 0.4;
}
LK.getSound('thrust').play();
};
self.crash = function () {
LK.effects.flashScreen(0xFF0000, 1000);
LK.getSound('crash').play();
LK.showGameOver();
};
self.land = function () {
if (!self.lastLanded && !self.isLanded) {
self.isLanded = true;
self.velocityX = 0;
self.velocityY = 0;
self.thrust = 0;
flame.visible = false;
LK.getSound('landing').play();
LK.effects.flashObject(self, 0x00FF00, 500);
// Increase score
LK.setScore(LK.getScore() + 1);
scoreTxt.setText(LK.getScore());
// Reset for next landing after delay
LK.setTimeout(function () {
self.reset();
spawnNewPlatform();
}, 1000);
}
self.lastLanded = true;
};
self.reset = function () {
self.x = 1024;
self.y = 100;
self.velocityX = 0;
self.velocityY = 2;
self.thrust = 0;
self.isLanded = false;
self.lastLanded = false;
flame.visible = false;
};
return self;
});
var Star = Container.expand(function () {
var self = Container.call(this);
var starGraphics = self.attachAsset('stars', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = Math.random() * 1 + 0.5;
self.update = function () {
self.y += self.speed;
if (self.y > 2732) {
self.y = -10;
self.x = Math.random() * 2048;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x0A0A0A
});
/****
* Game Code
****/
var spacecraft;
var currentPlatform;
var stars = [];
var mousePressed = false;
var lastMouseX = 1024;
// Create score display
var scoreTxt = new Text2('0', {
size: 120,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Create instruction text
var instructionTxt = new Text2('Mouse to steer and thrust', {
size: 60,
fill: 0x888888
});
instructionTxt.anchor.set(0.5, 0);
instructionTxt.y = 150;
LK.gui.top.addChild(instructionTxt);
// Initialize spacecraft
spacecraft = game.addChild(new Spacecraft());
spacecraft.x = 1024;
spacecraft.y = 100;
// Create background stars
for (var i = 0; i < 30; i++) {
var star = game.addChild(new Star());
star.x = Math.random() * 2048;
star.y = Math.random() * 2732;
stars.push(star);
}
function spawnNewPlatform() {
if (currentPlatform) {
currentPlatform.destroy();
}
currentPlatform = game.addChild(new Platform());
currentPlatform.x = Math.random() * 1600 + 224; // Keep platforms away from edges
currentPlatform.y = 2600;
}
// Spawn initial platform
spawnNewPlatform();
// Mouse controls
game.down = function (x, y, obj) {
mousePressed = true;
lastMouseX = x;
};
game.up = function (x, y, obj) {
mousePressed = false;
};
game.move = function (x, y, obj) {
lastMouseX = x;
};
game.update = function () {
if (mousePressed && !spacecraft.isLanded) {
// Calculate thrust direction based on mouse position
var direction = 0;
if (lastMouseX < spacecraft.x - 50) {
direction = -1;
} else if (lastMouseX > spacecraft.x + 50) {
direction = 1;
}
spacecraft.applyThrust(direction);
}
// Check for landing
if (currentPlatform && !spacecraft.isLanded) {
spacecraft.lastLanded = false;
currentPlatform.checkLanding(spacecraft);
}
// Update score display
scoreTxt.setText(LK.getScore());
}; ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,222 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var Platform = Container.expand(function () {
+ var self = Container.call(this);
+ var platformGraphics = self.attachAsset('platform', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.landingZone = 180; // Safe landing zone width
+ self.checkLanding = function (spacecraft) {
+ var dx = Math.abs(spacecraft.x - self.x);
+ var dy = Math.abs(spacecraft.y - self.y);
+ if (dx < self.landingZone / 2 && dy < 80) {
+ // Check if landing speed is safe
+ if (spacecraft.velocityY < 4 && Math.abs(spacecraft.velocityX) < 3) {
+ spacecraft.land();
+ return true;
+ } else {
+ spacecraft.crash();
+ return false;
+ }
+ }
+ return false;
+ };
+ return self;
+});
+var Spacecraft = Container.expand(function () {
+ var self = Container.call(this);
+ var body = self.attachAsset('spacecraft', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var flame = self.attachAsset('flame', {
+ anchorX: 0.5,
+ anchorY: 0,
+ x: 0,
+ y: 60
+ });
+ self.velocityX = 0;
+ self.velocityY = 2; // Base descent speed
+ self.thrust = 0;
+ self.maxThrust = 6;
+ self.thrustDecay = 0.9;
+ self.horizontalDamping = 0.95;
+ self.isLanded = false;
+ self.lastLanded = false;
+ flame.visible = false;
+ self.update = function () {
+ if (self.isLanded) return;
+ // Apply thrust and movement
+ self.velocityY -= self.thrust;
+ self.velocityX *= self.horizontalDamping;
+ self.thrust *= self.thrustDecay;
+ // Apply gravity
+ self.velocityY += 0.15;
+ // Update position
+ self.x += self.velocityX;
+ self.y += self.velocityY;
+ // Keep spacecraft in bounds horizontally
+ if (self.x < 40) {
+ self.x = 40;
+ self.velocityX = 0;
+ }
+ if (self.x > 2008) {
+ self.x = 2008;
+ self.velocityX = 0;
+ }
+ // Show flame when thrusting
+ flame.visible = self.thrust > 0.5;
+ // Check if crashed (hit bottom without landing)
+ if (self.y > 2650) {
+ self.crash();
+ }
+ };
+ self.applyThrust = function (direction) {
+ self.thrust = Math.min(self.maxThrust, self.thrust + 0.8);
+ if (direction !== 0) {
+ self.velocityX += direction * 0.4;
+ }
+ LK.getSound('thrust').play();
+ };
+ self.crash = function () {
+ LK.effects.flashScreen(0xFF0000, 1000);
+ LK.getSound('crash').play();
+ LK.showGameOver();
+ };
+ self.land = function () {
+ if (!self.lastLanded && !self.isLanded) {
+ self.isLanded = true;
+ self.velocityX = 0;
+ self.velocityY = 0;
+ self.thrust = 0;
+ flame.visible = false;
+ LK.getSound('landing').play();
+ LK.effects.flashObject(self, 0x00FF00, 500);
+ // Increase score
+ LK.setScore(LK.getScore() + 1);
+ scoreTxt.setText(LK.getScore());
+ // Reset for next landing after delay
+ LK.setTimeout(function () {
+ self.reset();
+ spawnNewPlatform();
+ }, 1000);
+ }
+ self.lastLanded = true;
+ };
+ self.reset = function () {
+ self.x = 1024;
+ self.y = 100;
+ self.velocityX = 0;
+ self.velocityY = 2;
+ self.thrust = 0;
+ self.isLanded = false;
+ self.lastLanded = false;
+ flame.visible = false;
+ };
+ return self;
+});
+var Star = Container.expand(function () {
+ var self = Container.call(this);
+ var starGraphics = self.attachAsset('stars', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = Math.random() * 1 + 0.5;
+ self.update = function () {
+ self.y += self.speed;
+ if (self.y > 2732) {
+ self.y = -10;
+ self.x = Math.random() * 2048;
+ }
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x0A0A0A
+});
+
+/****
+* Game Code
+****/
+var spacecraft;
+var currentPlatform;
+var stars = [];
+var mousePressed = false;
+var lastMouseX = 1024;
+// Create score display
+var scoreTxt = new Text2('0', {
+ size: 120,
+ fill: 0xFFFFFF
+});
+scoreTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreTxt);
+// Create instruction text
+var instructionTxt = new Text2('Mouse to steer and thrust', {
+ size: 60,
+ fill: 0x888888
+});
+instructionTxt.anchor.set(0.5, 0);
+instructionTxt.y = 150;
+LK.gui.top.addChild(instructionTxt);
+// Initialize spacecraft
+spacecraft = game.addChild(new Spacecraft());
+spacecraft.x = 1024;
+spacecraft.y = 100;
+// Create background stars
+for (var i = 0; i < 30; i++) {
+ var star = game.addChild(new Star());
+ star.x = Math.random() * 2048;
+ star.y = Math.random() * 2732;
+ stars.push(star);
+}
+function spawnNewPlatform() {
+ if (currentPlatform) {
+ currentPlatform.destroy();
+ }
+ currentPlatform = game.addChild(new Platform());
+ currentPlatform.x = Math.random() * 1600 + 224; // Keep platforms away from edges
+ currentPlatform.y = 2600;
+}
+// Spawn initial platform
+spawnNewPlatform();
+// Mouse controls
+game.down = function (x, y, obj) {
+ mousePressed = true;
+ lastMouseX = x;
+};
+game.up = function (x, y, obj) {
+ mousePressed = false;
+};
+game.move = function (x, y, obj) {
+ lastMouseX = x;
+};
+game.update = function () {
+ if (mousePressed && !spacecraft.isLanded) {
+ // Calculate thrust direction based on mouse position
+ var direction = 0;
+ if (lastMouseX < spacecraft.x - 50) {
+ direction = -1;
+ } else if (lastMouseX > spacecraft.x + 50) {
+ direction = 1;
+ }
+ spacecraft.applyThrust(direction);
+ }
+ // Check for landing
+ if (currentPlatform && !spacecraft.isLanded) {
+ spacecraft.lastLanded = false;
+ currentPlatform.checkLanding(spacecraft);
+ }
+ // Update score display
+ scoreTxt.setText(LK.getScore());
+};
\ No newline at end of file
one windowed red and white space ship with 4 legs with flame under it. In-Game asset. 2d. High contrast. No shadows
random asteroid stone. In-Game asset. 2d. High contrast. No shadows
star shaped random asteroid stone. In-Game asset. 2d. High contrast. No shadows
rocket landing platform. In-Game asset. 2d. High contrast. No shadows
rocket flame but only flame. In-Game asset. 2d. High contrast. No shadows
white shiny star. In-Game asset. 2d. High contrast. No shadows
realistic saturn. In-Game asset. 2d. High contrast. No shadows
realistic milky way. In-Game asset. 2d. High contrast. No shadows
realistic milky way. In-Game asset. 2d. High contrast. No shadows
mercury realistic. In-Game asset. 2d. High contrast. No shadows
earth realistic. In-Game asset. 2d. High contrast. No shadows
random galaxies realistic. In-Game asset. 2d. High contrast. No shadows
realistic sun. In-Game asset. 2d. High contrast. No shadows
realistic pluton. In-Game asset. 2d. High contrast. No shadows