User prompt
Süper meteor yap. Bu meteor %1 şansla oluşsun ve hızlı meteor ile aynı hızda olsun
User prompt
score 25’i geçince hızlı meteor oluşsun
User prompt
score arttıkça zorluk artmasını kaldır
User prompt
uydunun assetini satellite yap
User prompt
hızlı meteoru azıcık yavaşlat
User prompt
hızlı meteorun assetini FastMeteorite Yap
User prompt
%5 şansla doğan çok hızlı bir meteor yap
User prompt
uyduyu çok az yukarı taşı
User prompt
uydunun mermisi meteoyu yok etsin
User prompt
uyduyu parmak veya mouse ile sürükleyerek belli bir yatayda hareket ettirelim
User prompt
Uydu ateş etsin
User prompt
1- uydu sabit dursun
User prompt
bir uydu ekle ondan meteor yok edelim
User prompt
meteorlar tıklanınca yok olsun
User prompt
1- meteorları yavaşlat. 2- meteora bir hitbox ekle
User prompt
mermiyi kaldır
User prompt
turreti kaldır tıklayarak meteorları yok edelim
User prompt
turreti yönlendirmek için ok yönlü butonlar yap
User prompt
turreti döndürürken ekranın soluna tıklayınca sola dönsün sağa tıklanınca sağa dönsün
User prompt
butonları turretin altına getir
User prompt
butonları ekranın altının ortaına getir
User prompt
Butonları ortala ve üzerine yönünü yaz
User prompt
meteorları azalt
User prompt
dünya ve turret assetlerini yukarı doğru taşı ve yön butonlarını belirgin yap
User prompt
turreti yönlendirmek için butonlar ekle
/**** * Classes ****/ // Meteor class: Falling enemy var Meteor = Container.expand(function () { var self = Container.call(this); var meteor = self.attachAsset('meteor', { anchorX: 0.5, anchorY: 0.5 }); // Add a hitbox property (circle for simplicity) self.hitbox = { x: 0, y: 0, radius: meteor.width * 0.38 // slightly smaller than graphic for fairness }; // Randomize speed and rotation self.speed = 12 + Math.random() * meteorSpeedBoost; self.rotationSpeed = (Math.random() - 0.5) * 0.08; // For intersection tracking self.lastIntersecting = false; self.update = function () { self.y += self.speed * 0.4; // slowed down to 40% of original speed self.rotation += self.rotationSpeed; // Update hitbox position self.hitbox.x = self.x; self.hitbox.y = self.y; }; return self; }); // Projectile class: Fired by satellite var Projectile = Container.expand(function () { var self = Container.call(this); var proj = self.attachAsset('projectile', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -38; // Fast upward self.lastY = undefined; self.update = function () { if (self.lastY === undefined) self.lastY = self.y; self.y += self.speed; }; return self; }); // Satellite class: Orbits above earth, destroys meteors on tap var Satellite = Container.expand(function () { var self = Container.call(this); // Use a simple ellipse as satellite for now var sat = self.attachAsset('explosion', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.7, scaleY: 0.4 }); // Satellite hitbox (circle) self.hitbox = { x: 0, y: 0, radius: sat.width * 0.35 }; // Orbit parameters self.orbitRadius = 600; self.orbitCenterX = 2048 / 2; self.orbitCenterY = 2732 - 200; self.orbitAngle = Math.random() * Math.PI * 2; self.orbitSpeed = 0.012 + Math.random() * 0.01; self.update = function () { self.x = self.orbitCenterX; self.y = self.orbitCenterY; self.hitbox.x = self.x; self.hitbox.y = self.y; }; return self; }); /**** * Initialize Game ****/ // Turret class: Player's cannon at the bottom var game = new LK.Game({ backgroundColor: 0x0a2233 }); /**** * Game Code ****/ // Sound effects // Explosion effect (for future use) // Earth: Ground at the bottom // Meteor: Falling enemy // Projectile: Player's bullet // Turret: Defense cannon at the bottom // Game variables var meteors = []; var projectiles = []; var satelliteFireTimer = 0; var satelliteFireInterval = 30; // frames between shots var earth; var satellite; var scoreTxt; var livesTxt; var lives = 5; var score = 0; var meteorSpawnInterval = 60; // frames var meteorSpeedBoost = 0; // increases as game progresses var meteorTimer = 0; earth = LK.getAsset('earth', { anchorX: 0.5, anchorY: 1, x: 2048 / 2, y: 2732 }); game.addChild(earth); // Add satellite satellite = new Satellite(); satellite.orbitCenterX = 2048 / 2; satellite.orbitCenterY = 2732 - 200; satellite.orbitRadius = 600; game.addChild(satellite); // Score text (top center) scoreTxt = new Text2('Score: 0', { size: 100, fill: "#fff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Lives text (top right, avoid top left 100x100) livesTxt = new Text2('Lives: 5', { size: 80, fill: 0xFFB300 }); livesTxt.anchor.set(1, 0); LK.gui.topRight.addChild(livesTxt); // Dragging logic for satellite var draggingSatellite = false; var dragOffsetX = 0; game.move = function (x, y, obj) { // If currently dragging satellite, update its X position only if (draggingSatellite) { // Clamp satellite X to stay within game bounds (avoid going off screen) var minX = 120; var maxX = 2048 - 120; var newX = x - dragOffsetX; if (newX < minX) newX = minX; if (newX > maxX) newX = maxX; satellite.x = newX; satellite.orbitCenterX = newX; // keep its logical center in sync return; } // First, check if satellite is tapped to start dragging var dxSat = x - satellite.x; var dySat = y - satellite.y; var distSat = Math.sqrt(dxSat * dxSat + dySat * dySat); if (distSat <= satellite.hitbox.radius) { // Start dragging draggingSatellite = true; dragOffsetX = x - satellite.x; return; } // Check if a meteor is tapped for (var i = meteors.length - 1; i >= 0; i--) { var mtr = meteors[i]; // Calculate distance from tap to meteor center var dx = x - mtr.x; var dy = y - mtr.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist <= mtr.hitbox.radius) { // Destroy meteor mtr.destroy(); meteors.splice(i, 1); score += 1; scoreTxt.setText('Score: ' + score); // Optional: add explosion effect here if desired break; // Only destroy one meteor per tap } } }; // Release drag on up game.up = function (x, y, obj) { draggingSatellite = false; }; game.up = function (x, y, obj) {}; // Main update loop game.update = function () { // Spawn meteors meteorTimer++; var spawnRate = Math.max(18, meteorSpawnInterval - Math.floor(score / 10) * 4); if (meteorTimer >= spawnRate) { meteorTimer = 0; var m = new Meteor(); // Random X, avoid edges m.x = 120 + Math.random() * (2048 - 240); m.y = -80; meteors.push(m); game.addChild(m); } // Increase difficulty meteorSpeedBoost = Math.min(18, Math.floor(score / 8) * 2); // Update meteors for (var k = meteors.length - 1; k >= 0; k--) { var mtr = meteors[k]; mtr.update(); // If meteor hits earth if (mtr.y + 60 >= earth.y - earth.height / 2) { LK.getSound('lose').play(); mtr.destroy(); meteors.splice(k, 1); lives -= 1; livesTxt.setText('Lives: ' + lives); // Flash screen LK.effects.flashScreen(0xff0000, 400); if (lives <= 0) { LK.showGameOver(); return; } } } // Update satellite if (satellite && satellite.update) { satellite.update(); // Satellite fires projectiles at interval satelliteFireTimer++; if (satelliteFireTimer >= satelliteFireInterval) { satelliteFireTimer = 0; var proj = new Projectile(); proj.x = satellite.x; proj.y = satellite.y - 60; // fire from above satellite projectiles.push(proj); game.addChild(proj); } } };
===================================================================
--- original.js
+++ change.js
@@ -131,63 +131,33 @@
fill: 0xFFB300
});
livesTxt.anchor.set(1, 0);
LK.gui.topRight.addChild(livesTxt);
+// Dragging logic for satellite
+var draggingSatellite = false;
+var dragOffsetX = 0;
game.move = function (x, y, obj) {
- // First, check if satellite is tapped
+ // If currently dragging satellite, update its X position only
+ if (draggingSatellite) {
+ // Clamp satellite X to stay within game bounds (avoid going off screen)
+ var minX = 120;
+ var maxX = 2048 - 120;
+ var newX = x - dragOffsetX;
+ if (newX < minX) newX = minX;
+ if (newX > maxX) newX = maxX;
+ satellite.x = newX;
+ satellite.orbitCenterX = newX; // keep its logical center in sync
+ return;
+ }
+ // First, check if satellite is tapped to start dragging
var dxSat = x - satellite.x;
var dySat = y - satellite.y;
var distSat = Math.sqrt(dxSat * dxSat + dySat * dySat);
if (distSat <= satellite.hitbox.radius) {
- // If satellite is tapped, destroy the closest meteor to satellite (if any)
- var closestIdx = -1;
- var closestDist = 99999;
- for (var i = 0; i < meteors.length; i++) {
- var mdx = meteors[i].x - satellite.x;
- var mdy = meteors[i].y - satellite.y;
- var mdist = Math.sqrt(mdx * mdx + mdy * mdy);
- if (mdist < closestDist) {
- closestDist = mdist;
- closestIdx = i;
- // Update projectiles
- for (var p = projectiles.length - 1; p >= 0; p--) {
- var proj = projectiles[p];
- proj.update();
- // Remove if off screen
- if (proj.lastY >= -100 && proj.y < -100) {
- proj.destroy();
- projectiles.splice(p, 1);
- continue;
- }
- // Check collision with meteors
- for (var m = meteors.length - 1; m >= 0; m--) {
- var mtr = meteors[m];
- var dx = proj.x - mtr.x;
- var dy = proj.y - mtr.y;
- var dist = Math.sqrt(dx * dx + dy * dy);
- if (dist < mtr.hitbox.radius) {
- // Destroy both
- mtr.destroy();
- meteors.splice(m, 1);
- proj.destroy();
- projectiles.splice(p, 1);
- score += 1;
- scoreTxt.setText('Score: ' + score);
- break;
- }
- }
- }
- }
- ;
- }
- if (closestIdx !== -1 && closestDist < 400) {
- // Only destroy if close enough to satellite
- meteors[closestIdx].destroy();
- meteors.splice(closestIdx, 1);
- score += 1;
- scoreTxt.setText('Score: ' + score);
- }
- return; // Only allow one action per tap
+ // Start dragging
+ draggingSatellite = true;
+ dragOffsetX = x - satellite.x;
+ return;
}
// Check if a meteor is tapped
for (var i = meteors.length - 1; i >= 0; i--) {
var mtr = meteors[i];
@@ -205,8 +175,12 @@
break; // Only destroy one meteor per tap
}
}
};
+// Release drag on up
+game.up = function (x, y, obj) {
+ draggingSatellite = false;
+};
game.up = function (x, y, obj) {};
// Main update loop
game.update = function () {
// Spawn meteors
meteor . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
dünya yüzeyi. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
blue meteor. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
green meteorite. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
spaceship. In-Game asset. 2d. High contrast. No shadows
spaceship debris. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
laser projectile. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
space with only stars. In-Game asset. real. High contrast. with shadows. high resolution
dünyanın bir bölümünün yüzeyi. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
alien. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
golden dolar symbol. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
yellow meteor. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
game heart. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
shield. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
red meteor with x2 write. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat