User prompt
play crash sound when rocket crash
User prompt
oyun basladiginda ekledigimiz muzik calsin
User prompt
arkadan ara sira opacity %50 olacak sekilde uzay ve insan ile ilgili varolussal sozler gecsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
add 2 more planets
User prompt
gezegenlerin opacity oranini %25 yapalim ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
gezegenler sinus egrisi yaparak gecsinler ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
gezegenler dumduz degil biraz yukari dogru bombeli gecsinler ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
geaegen gecis sikligini arttiralim ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
1 gezegen birden fazla gorunmesin
User prompt
gezegenler kendi etrafinda donmesin ve sagdan sola veya soldan saga gecis yapsinlar ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
add 7 planet assets
User prompt
arkaplandaki gezegenler soldan saga dogru ilerleyip kaybolsunlar ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
arka plandan bazen %50 opacity ile gezegenler gecsin sadece goruntu amacli ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
engeller ilerleyen bolumlerde hareket edebilsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
rocket platformun onunden asagi insin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
engeller kendi etrafinda yavas bir sekilde donsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
add 4 different obstacle asset
User prompt
her yeni bolume geciste platform hizini % 3 arttiralim ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
platform 2 kat daha yavas hareket etsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
ilerideki bazi bolumlerde platform yavas bir sekilde hareket etsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
platforma inince oyun bitmesin diger bolume gecelim diger bolumde de roketin carpabilecegi engeller koyalim engellere carparsa oyun game over olsun
User prompt
tiklayinca roket ucmasin sadece asagi dusmesini yavaslatalim
User prompt
roket platform disina duserse game over olsun. Platform uzerine duserse diger bolume gecelim
User prompt
roket platforma inince puan kazanalim
User prompt
2 kat daha azaltalim
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Obstacle = Container.expand(function () {
var self = Container.call(this);
// Randomly select one of 4 obstacle types
var obstacleTypes = ['obstacle', 'obstacle2', 'obstacle3', 'obstacle4'];
var randomType = obstacleTypes[Math.floor(Math.random() * obstacleTypes.length)];
var obstacleGraphics = self.attachAsset(randomType, {
anchorX: 0.5,
anchorY: 0.5
});
self.isMoving = false;
self.originalX = 0;
self.originalY = 0;
// Start continuous slow rotation
function startRotation() {
tween(self, {
rotation: self.rotation + Math.PI * 2
}, {
duration: 8000,
easing: tween.linear,
onFinish: startRotation
});
}
startRotation();
self.startMoving = function () {
if (self.isMoving) return;
self.isMoving = true;
self.originalX = self.x;
self.originalY = self.y;
// Random movement pattern
var movementType = Math.floor(Math.random() * 3);
if (movementType === 0) {
// Horizontal movement
var moveLeft = function moveLeft() {
tween(self, {
x: self.originalX - 200
}, {
duration: 3000,
easing: tween.easeInOut,
onFinish: moveRight
});
};
var moveRight = function moveRight() {
tween(self, {
x: self.originalX + 200
}, {
duration: 3000,
easing: tween.easeInOut,
onFinish: moveLeft
});
};
moveLeft();
} else if (movementType === 1) {
// Vertical movement
var moveUp = function moveUp() {
tween(self, {
y: self.originalY - 150
}, {
duration: 2500,
easing: tween.easeInOut,
onFinish: moveDown
});
};
var moveDown = function moveDown() {
tween(self, {
y: self.originalY + 150
}, {
duration: 2500,
easing: tween.easeInOut,
onFinish: moveUp
});
};
moveUp();
} else {
var _circularMove = function circularMove() {
angle += 0.02;
var newX = self.originalX + Math.cos(angle) * radius;
var newY = self.originalY + Math.sin(angle) * radius;
tween(self, {
x: newX,
y: newY
}, {
duration: 100,
easing: tween.linear,
onFinish: _circularMove
});
};
// Circular movement
var angle = 0;
var radius = 100;
_circularMove();
}
};
return self;
});
var Planet = Container.expand(function () {
var self = Container.call(this);
// Randomly select one of 9 planet types
var planetTypes = ['planet1', 'planet2', 'planet3', 'planet4', 'planet5', 'planet6', 'planet7', 'planet8', 'planet9'];
var randomType = planetTypes[Math.floor(Math.random() * planetTypes.length)];
var planetGraphics = self.attachAsset(randomType, {
anchorX: 0.5,
anchorY: 0.5
});
// Set 25% opacity
planetGraphics.alpha = 0.25;
self.planetType = randomType; // Store the planet type for tracking
self.speed = Math.random() * 0.3 + 0.1; // Very slow movement
self.direction = Math.random() < 0.5 ? 1 : -1; // Random direction: 1 for left-to-right, -1 for right-to-left
self.update = function () {
self.x += self.speed * 2 * self.direction; // Move in random direction
// Reset planet when it goes off screen
if (self.direction === 1 && self.x > 2248) {
// Moving left-to-right, reset to left side
self.x = -200;
self.y = Math.random() * 2732; // Random Y position across screen height
} else if (self.direction === -1 && self.x < -200) {
// Moving right-to-left, reset to right side
self.x = 2248;
self.y = Math.random() * 2732; // Random Y position across screen height
}
};
return self;
});
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.isMoving = false;
self.startMoving = function () {
if (self.isMoving) return;
self.isMoving = true;
// Calculate speed based on current level (3% faster each level)
var speedMultiplier = Math.pow(1.03, currentLevel - 3); // Start from level 3
var baseDuration = 6000;
var moveDuration = baseDuration / speedMultiplier;
// Create continuous horizontal movement
function moveLeft() {
tween(self, {
x: 300
}, {
duration: moveDuration,
easing: tween.linear,
onFinish: moveRight
});
}
function moveRight() {
tween(self, {
x: 1748
}, {
duration: moveDuration,
easing: tween.linear,
onFinish: moveLeft
});
}
// Start movement cycle
if (self.x < 1024) {
moveRight();
} else {
moveLeft();
}
};
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 = 0; // Start with no initial 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 (free fall) - reduce by 75% when mouse pressed
var gravityForce = mousePressed ? 0.0125 : 0.05;
self.velocityY += gravityForce;
// 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();
}
// Check if rocket falls outside platform area
if (self.y > 2550 && currentPlatform) {
var platformLeft = currentPlatform.x - currentPlatform.landingZone / 2;
var platformRight = currentPlatform.x + currentPlatform.landingZone / 2;
if (self.x < platformLeft || self.x > platformRight) {
self.crash();
}
}
};
self.applyThrust = function (direction) {
self.thrust = Math.min(self.maxThrust, self.thrust + 0.03);
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 when landing on platform
LK.setScore(LK.getScore() + 10);
scoreTxt.setText(LK.getScore());
// Show level complete effect and progress to next level
LK.effects.flashScreen(0x00FF00, 500);
// Reset for next level after delay
LK.setTimeout(function () {
currentLevel++;
self.reset();
spawnNewPlatform();
spawnObstacles();
}, 1500);
}
self.lastLanded = true;
};
self.reset = function () {
self.x = 1024;
self.y = 100;
self.velocityX = 0;
self.velocityY = 0; // Start with no velocity for free fall
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 planets = [];
var obstacles = [];
var currentLevel = 1;
var mousePressed = false;
var lastMouseX = 1024;
var activePlanetTypes = {}; // Track which planet types are currently visible
// 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('Hold mouse to slow descent', {
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);
}
// Create background planets
for (var i = 0; i < 3; i++) {
var planet = game.addChild(new Planet());
// Set initial position based on direction
if (planet.direction === 1) {
planet.x = Math.random() * 2048; // Left-to-right planets start anywhere
} else {
planet.x = Math.random() * 2048; // Right-to-left planets start anywhere
}
planet.y = Math.random() * 2732;
planets.push(planet);
activePlanetTypes[planet.planetType] = true; // Mark this planet type as active
}
function spawnObstacles() {
// Clear existing obstacles
for (var i = 0; i < obstacles.length; i++) {
obstacles[i].destroy();
}
obstacles = [];
// Spawn obstacles based on current level (more obstacles in higher levels)
var numObstacles = Math.min(currentLevel - 1, 5); // Start spawning from level 2
for (var i = 0; i < numObstacles; i++) {
var obstacle = game.addChild(new Obstacle());
obstacle.x = Math.random() * 1600 + 224;
obstacle.y = 1500 + Math.random() * 800; // Place between spacecraft start and platform
obstacles.push(obstacle);
// Start moving obstacles for levels 4 and above
if (currentLevel >= 4) {
obstacle.startMoving();
}
}
}
function spawnNewPlatform() {
if (currentPlatform) {
tween.stop(currentPlatform);
currentPlatform.destroy();
}
currentPlatform = game.addChild(new Platform());
currentPlatform.x = Math.random() * 1600 + 224; // Keep platforms away from edges
currentPlatform.y = 2600;
// Start moving platform for levels 3 and above
if (currentLevel >= 3) {
currentPlatform.startMoving();
}
}
// Spawn initial platform
spawnNewPlatform();
// Initialize obstacles
spawnObstacles();
// Create timer for random planet spawning
LK.setInterval(function () {
// 20% chance to spawn a new planet every 2 seconds
if (Math.random() < 0.2) {
var planet = game.addChild(new Planet());
// Only spawn if this planet type is not already active
if (!activePlanetTypes[planet.planetType]) {
// Set spawn position based on direction
if (planet.direction === 1) {
planet.x = -200; // Start from left side for left-to-right movement
} else {
planet.x = 2248; // Start from right side for right-to-left movement
}
planet.y = Math.random() * 2732; // Random Y position
planets.push(planet);
activePlanetTypes[planet.planetType] = true; // Mark this planet type as active
} else {
// Destroy the planet if its type is already active
planet.destroy();
}
}
}, 2000);
// 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 collision with obstacles
for (var i = 0; i < obstacles.length; i++) {
if (spacecraft.intersects(obstacles[i]) && !spacecraft.isLanded) {
spacecraft.crash();
break;
}
}
// Check for landing
if (currentPlatform && !spacecraft.isLanded) {
spacecraft.lastLanded = false;
currentPlatform.checkLanding(spacecraft);
}
// Clean up planets that are too far off screen
for (var i = planets.length - 1; i >= 0; i--) {
if (planets[i].x > 2448 || planets[i].x < -400) {
// Clean up when they go off either edge
activePlanetTypes[planets[i].planetType] = false; // Mark planet type as inactive
planets[i].destroy();
planets.splice(i, 1);
}
}
// Update score display
scoreTxt.setText(LK.getScore());
}; ===================================================================
--- original.js
+++ change.js
@@ -101,10 +101,10 @@
return self;
});
var Planet = Container.expand(function () {
var self = Container.call(this);
- // Randomly select one of 7 planet types
- var planetTypes = ['planet1', 'planet2', 'planet3', 'planet4', 'planet5', 'planet6', 'planet7'];
+ // Randomly select one of 9 planet types
+ var planetTypes = ['planet1', 'planet2', 'planet3', 'planet4', 'planet5', 'planet6', 'planet7', 'planet8', 'planet9'];
var randomType = planetTypes[Math.floor(Math.random() * planetTypes.length)];
var planetGraphics = self.attachAsset(randomType, {
anchorX: 0.5,
anchorY: 0.5
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