User prompt
düşman nesneler vurulduğunda patlamaeffekt görünsün
User prompt
Please fix the bug: 'TypeError: LK.effects.explodeObject is not a function' in or related to this line: 'LK.effects.explodeObject(obj, {' Line Number: 315
User prompt
düşman nesnelere patlama efekti ekle
User prompt
düşman hızlarını yeniden ayarla, hızı azalt ve bölüm ilerledikçe arttır
User prompt
uzayNesnesi ve uzayNesnesi2 rastgele gelsin
User prompt
uzayNesnesi2 yi de ekle
User prompt
gemim ekran boyunca aşağı ,yukarı, sa, sol hareket edebilsin
User prompt
düşman astroidleri ve düşman gemileri rastgele çıksın ve hızları bölüm ilerledikçe artsın
User prompt
oyun akışını soldan sağa hareket edecek şekilde döndürmeni ve düşmanların sağdan sola doğru rastgele gelmesini istiyorum
Code edit (1 edits merged)
Please save this source code
User prompt
Space Blaster: Uzay Savaşçısı
Initial prompt
space shootor benzeri uzay boşluğunda hareket eden cisimleri vuran bir uzay aracı olan oyun
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Mermi (Bullet) var Bullet = Container.expand(function () { var self = Container.call(this); var bulletAsset = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); // Asset: ellipse, width: 32, height: 32, color: 0xffe066 bulletAsset.width = 32; bulletAsset.height = 32; bulletAsset.color = 0xffe066; self.speed = -32; // Upwards self.update = function () { self.y += self.speed; }; return self; }); // Uzay Aracı (Player Ship) var PlayerShip = Container.expand(function () { var self = Container.call(this); // Ship asset: blue ellipse var shipAsset = self.attachAsset('playerShip', { anchorX: 0.5, anchorY: 0.5 }); // Asset will be created as: ellipse, width: 140, height: 100, color: 0x3a9cff shipAsset.width = 140; shipAsset.height = 100; shipAsset.color = 0x3a9cff; self.radius = 70; // For collision return self; }); // Uzay Cismi (Asteroid/Enemy) var SpaceObject = Container.expand(function () { var self = Container.call(this); // Randomly choose asteroid or enemy var isAsteroid = Math.random() < 0.7; var color = isAsteroid ? 0x888888 : 0xff4444; var width = isAsteroid ? 120 + Math.random() * 60 : 100; var height = isAsteroid ? 120 + Math.random() * 60 : 100; var objAsset = self.attachAsset('spaceObject', { anchorX: 0.5, anchorY: 0.5 }); objAsset.width = width; objAsset.height = height; objAsset.color = color; self.radius = width / 2; // Random spawn edge and direction var edge = Math.floor(Math.random() * 4); // 0:top, 1:right, 2:bottom, 3:left var speed = 6 + Math.random() * 4; var angle; if (edge === 0) { // Top self.x = 200 + Math.random() * (2048 - 400); self.y = -height; angle = Math.PI / 2 + (Math.random() - 0.5) * 0.7; } else if (edge === 1) { // Right self.x = 2048 + width; self.y = 400 + Math.random() * (2732 - 800); angle = Math.PI + (Math.random() - 0.5) * 0.7; } else if (edge === 2) { // Bottom self.x = 200 + Math.random() * (2048 - 400); self.y = 2732 + height; angle = -Math.PI / 2 + (Math.random() - 0.5) * 0.7; } else { // Left self.x = -width; self.y = 400 + Math.random() * (2732 - 800); angle = (Math.random() - 0.5) * 0.7; } self.vx = Math.cos(angle) * speed; self.vy = Math.sin(angle) * speed; self.update = function () { self.x += self.vx; self.y += self.vy; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000010 }); /**** * Game Code ****/ // Oyun değişkenleri var playerShip = new PlayerShip(); playerShip.x = 2048 / 2; playerShip.y = 2732 - 350; game.addChild(playerShip); var bullets = []; var spaceObjects = []; var canShoot = true; var shootInterval = 250; // ms var lastShootTick = 0; var score = 0; var difficulty = 1; var spawnInterval = 90; // ticks var lastSpawnTick = 0; // Skor gösterimi var scoreTxt = new Text2('0', { size: 120, fill: "#fff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Dokunma/sürükleme ile gemi hareketi var dragging = false; function handleMove(x, y, obj) { if (dragging) { // Sınırları aşmasın var minX = playerShip.width / 2 + 40; var maxX = 2048 - playerShip.width / 2 - 40; var minY = playerShip.height / 2 + 200; var maxY = 2732 - playerShip.height / 2 - 40; playerShip.x = Math.max(minX, Math.min(maxX, x)); playerShip.y = Math.max(minY, Math.min(maxY, y)); } } game.move = handleMove; game.down = function (x, y, obj) { // Geminin üstüne dokunulmuşsa veya her yere dokunulabiliyorsa dragging = true; handleMove(x, y, obj); }; game.up = function (x, y, obj) { dragging = false; }; // Otomatik ateş (her shootInterval ms'de bir) function tryShoot() { if (!canShoot) return; var bullet = new Bullet(); bullet.x = playerShip.x; bullet.y = playerShip.y - playerShip.height / 2 - 10; bullets.push(bullet); game.addChild(bullet); canShoot = false; LK.setTimeout(function () { canShoot = true; }, shootInterval); } // Uzay cismi oluştur function spawnSpaceObject() { var obj = new SpaceObject(); spaceObjects.push(obj); game.addChild(obj); } // Çarpışma kontrolü (daire-çarpışma) function isCircleHit(a, b) { var dx = a.x - b.x; var dy = a.y - b.y; var dist = Math.sqrt(dx * dx + dy * dy); var r1 = a.radius || (a.width ? a.width / 2 : 0); var r2 = b.radius || (b.width ? b.width / 2 : 0); return dist < r1 + r2 - 10; } // Zorluk arttırma function updateDifficulty() { // Her 10 puanda bir zorluk artsın var newDifficulty = 1 + Math.floor(score / 10); if (newDifficulty > difficulty) { difficulty = newDifficulty; spawnInterval = Math.max(30, 90 - (difficulty - 1) * 10); } } // Oyun döngüsü game.update = function () { // Otomatik ateş if (LK.ticks - lastShootTick > Math.floor(shootInterval / 16)) { tryShoot(); lastShootTick = LK.ticks; } // Uzay cismi oluşturma if (LK.ticks - lastSpawnTick > spawnInterval) { spawnSpaceObject(); lastSpawnTick = LK.ticks; } // Mermileri güncelle for (var i = bullets.length - 1; i >= 0; i--) { var b = bullets[i]; b.update(); // Ekran dışıysa sil if (b.y < -50) { b.destroy(); bullets.splice(i, 1); } } // Uzay cisimlerini güncelle for (var j = spaceObjects.length - 1; j >= 0; j--) { var obj = spaceObjects[j]; obj.update(); // Ekran dışıysa sil if (obj.x < -200 || obj.x > 2048 + 200 || obj.y < -200 || obj.y > 2732 + 200) { obj.destroy(); spaceObjects.splice(j, 1); continue; } // Gemiye çarptı mı? if (isCircleHit(obj, playerShip)) { LK.effects.flashScreen(0xff0000, 800); LK.showGameOver(); return; } // Mermiyle çarpışma for (var k = bullets.length - 1; k >= 0; k--) { var b = bullets[k]; if (isCircleHit(obj, b)) { // Patlama efekti LK.effects.flashObject(obj, 0xffff00, 200); obj.destroy(); spaceObjects.splice(j, 1); b.destroy(); bullets.splice(k, 1); score += 1; scoreTxt.setText(score); updateDifficulty(); break; } } } };
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,236 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+// Mermi (Bullet)
+var Bullet = Container.expand(function () {
+ var self = Container.call(this);
+ var bulletAsset = self.attachAsset('bullet', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Asset: ellipse, width: 32, height: 32, color: 0xffe066
+ bulletAsset.width = 32;
+ bulletAsset.height = 32;
+ bulletAsset.color = 0xffe066;
+ self.speed = -32; // Upwards
+ self.update = function () {
+ self.y += self.speed;
+ };
+ return self;
+});
+// Uzay Aracı (Player Ship)
+var PlayerShip = Container.expand(function () {
+ var self = Container.call(this);
+ // Ship asset: blue ellipse
+ var shipAsset = self.attachAsset('playerShip', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Asset will be created as: ellipse, width: 140, height: 100, color: 0x3a9cff
+ shipAsset.width = 140;
+ shipAsset.height = 100;
+ shipAsset.color = 0x3a9cff;
+ self.radius = 70; // For collision
+ return self;
+});
+// Uzay Cismi (Asteroid/Enemy)
+var SpaceObject = Container.expand(function () {
+ var self = Container.call(this);
+ // Randomly choose asteroid or enemy
+ var isAsteroid = Math.random() < 0.7;
+ var color = isAsteroid ? 0x888888 : 0xff4444;
+ var width = isAsteroid ? 120 + Math.random() * 60 : 100;
+ var height = isAsteroid ? 120 + Math.random() * 60 : 100;
+ var objAsset = self.attachAsset('spaceObject', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ objAsset.width = width;
+ objAsset.height = height;
+ objAsset.color = color;
+ self.radius = width / 2;
+ // Random spawn edge and direction
+ var edge = Math.floor(Math.random() * 4); // 0:top, 1:right, 2:bottom, 3:left
+ var speed = 6 + Math.random() * 4;
+ var angle;
+ if (edge === 0) {
+ // Top
+ self.x = 200 + Math.random() * (2048 - 400);
+ self.y = -height;
+ angle = Math.PI / 2 + (Math.random() - 0.5) * 0.7;
+ } else if (edge === 1) {
+ // Right
+ self.x = 2048 + width;
+ self.y = 400 + Math.random() * (2732 - 800);
+ angle = Math.PI + (Math.random() - 0.5) * 0.7;
+ } else if (edge === 2) {
+ // Bottom
+ self.x = 200 + Math.random() * (2048 - 400);
+ self.y = 2732 + height;
+ angle = -Math.PI / 2 + (Math.random() - 0.5) * 0.7;
+ } else {
+ // Left
+ self.x = -width;
+ self.y = 400 + Math.random() * (2732 - 800);
+ angle = (Math.random() - 0.5) * 0.7;
+ }
+ self.vx = Math.cos(angle) * speed;
+ self.vy = Math.sin(angle) * speed;
+ self.update = function () {
+ self.x += self.vx;
+ self.y += self.vy;
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x000010
+});
+
+/****
+* Game Code
+****/
+// Oyun değişkenleri
+var playerShip = new PlayerShip();
+playerShip.x = 2048 / 2;
+playerShip.y = 2732 - 350;
+game.addChild(playerShip);
+var bullets = [];
+var spaceObjects = [];
+var canShoot = true;
+var shootInterval = 250; // ms
+var lastShootTick = 0;
+var score = 0;
+var difficulty = 1;
+var spawnInterval = 90; // ticks
+var lastSpawnTick = 0;
+// Skor gösterimi
+var scoreTxt = new Text2('0', {
+ size: 120,
+ fill: "#fff"
+});
+scoreTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreTxt);
+// Dokunma/sürükleme ile gemi hareketi
+var dragging = false;
+function handleMove(x, y, obj) {
+ if (dragging) {
+ // Sınırları aşmasın
+ var minX = playerShip.width / 2 + 40;
+ var maxX = 2048 - playerShip.width / 2 - 40;
+ var minY = playerShip.height / 2 + 200;
+ var maxY = 2732 - playerShip.height / 2 - 40;
+ playerShip.x = Math.max(minX, Math.min(maxX, x));
+ playerShip.y = Math.max(minY, Math.min(maxY, y));
+ }
+}
+game.move = handleMove;
+game.down = function (x, y, obj) {
+ // Geminin üstüne dokunulmuşsa veya her yere dokunulabiliyorsa
+ dragging = true;
+ handleMove(x, y, obj);
+};
+game.up = function (x, y, obj) {
+ dragging = false;
+};
+// Otomatik ateş (her shootInterval ms'de bir)
+function tryShoot() {
+ if (!canShoot) return;
+ var bullet = new Bullet();
+ bullet.x = playerShip.x;
+ bullet.y = playerShip.y - playerShip.height / 2 - 10;
+ bullets.push(bullet);
+ game.addChild(bullet);
+ canShoot = false;
+ LK.setTimeout(function () {
+ canShoot = true;
+ }, shootInterval);
+}
+// Uzay cismi oluştur
+function spawnSpaceObject() {
+ var obj = new SpaceObject();
+ spaceObjects.push(obj);
+ game.addChild(obj);
+}
+// Çarpışma kontrolü (daire-çarpışma)
+function isCircleHit(a, b) {
+ var dx = a.x - b.x;
+ var dy = a.y - b.y;
+ var dist = Math.sqrt(dx * dx + dy * dy);
+ var r1 = a.radius || (a.width ? a.width / 2 : 0);
+ var r2 = b.radius || (b.width ? b.width / 2 : 0);
+ return dist < r1 + r2 - 10;
+}
+// Zorluk arttırma
+function updateDifficulty() {
+ // Her 10 puanda bir zorluk artsın
+ var newDifficulty = 1 + Math.floor(score / 10);
+ if (newDifficulty > difficulty) {
+ difficulty = newDifficulty;
+ spawnInterval = Math.max(30, 90 - (difficulty - 1) * 10);
+ }
+}
+// Oyun döngüsü
+game.update = function () {
+ // Otomatik ateş
+ if (LK.ticks - lastShootTick > Math.floor(shootInterval / 16)) {
+ tryShoot();
+ lastShootTick = LK.ticks;
+ }
+ // Uzay cismi oluşturma
+ if (LK.ticks - lastSpawnTick > spawnInterval) {
+ spawnSpaceObject();
+ lastSpawnTick = LK.ticks;
+ }
+ // Mermileri güncelle
+ for (var i = bullets.length - 1; i >= 0; i--) {
+ var b = bullets[i];
+ b.update();
+ // Ekran dışıysa sil
+ if (b.y < -50) {
+ b.destroy();
+ bullets.splice(i, 1);
+ }
+ }
+ // Uzay cisimlerini güncelle
+ for (var j = spaceObjects.length - 1; j >= 0; j--) {
+ var obj = spaceObjects[j];
+ obj.update();
+ // Ekran dışıysa sil
+ if (obj.x < -200 || obj.x > 2048 + 200 || obj.y < -200 || obj.y > 2732 + 200) {
+ obj.destroy();
+ spaceObjects.splice(j, 1);
+ continue;
+ }
+ // Gemiye çarptı mı?
+ if (isCircleHit(obj, playerShip)) {
+ LK.effects.flashScreen(0xff0000, 800);
+ LK.showGameOver();
+ return;
+ }
+ // Mermiyle çarpışma
+ for (var k = bullets.length - 1; k >= 0; k--) {
+ var b = bullets[k];
+ if (isCircleHit(obj, b)) {
+ // Patlama efekti
+ LK.effects.flashObject(obj, 0xffff00, 200);
+ obj.destroy();
+ spaceObjects.splice(j, 1);
+ b.destroy();
+ bullets.splice(k, 1);
+ score += 1;
+ scoreTxt.setText(score);
+ updateDifficulty();
+ break;
+ }
+ }
+ }
+};
\ No newline at end of file
düşman uzay gemisi. In-Game asset. 2d. High contrast. No shadows
patlama efekti. In-Game asset. 2d. High contrast. No shadows
mermi yönünü sağa çevir ve yat
satürn. In-Game asset. 2d. High contrast. No shadows
meteor taşı. In-Game asset. 2d. High contrast. No shadows
bölüm sonu canavar için devasa uzay gemisi. In-Game asset. 2d. High contrast. No shadows
rengini değiştir
ışın mermisi. In-Game asset. 2d. High contrast. No shadows
yanan ateş topları. In-Game asset. 2d. High contrast. No shadows
oyunda açılacak bir uzay portalı için görüntüyü netleştir
A magical sci-fi starburst explosion for a 2D game effect, with a bright blue and white energy core bursting outward in radiant spikes, surrounded by glowing particles, swirling light trails, and a soft nebula-like aura. The effect should feel like a powerful portal discharge or dimensional rift opening, with dynamic energy and cinematic glow. Transparent background, digital art style, top-down angle, ideal for sprite use in games.. In-Game asset. 2d. High contrast. No shadows
A stunning 2D top-down galaxy for a space-themed game background, featuring a massive spiral galaxy with swirling arms in vibrant shades of blue, purple, and pink, a bright glowing core, scattered star clusters, distant nebulae, and a few small planets orbiting around. The galaxy should feel colorful, mysterious, and vast, with soft glowing effects and high contrast for a sci-fi aesthetic. Style: digital art, seamless background, suitable for looping game parallax layers.. In-Game asset. 2d. High contrast. No shadows
kalkanın içinde gemi olmasın
A 2D sci-fi gift box or power-up crate floating in space, with a glowing metallic surface, futuristic design, bright neon blue and silver accents, and a soft pulsing light effect. The box should look valuable and mysterious, slightly levitating with subtle sparkles or energy rings around it. Designed for a top-down space shooter game. Transparent background, digital art, ideal for sprite use.. In-Game asset. 2d. High contrast. No shadows
A 2D sci-fi power-up gift box that grants a shield, designed with a glowing blue energy core inside a metallic futuristic container. The box features holographic shield symbols, neon cyan highlights, and soft pulsing light. It is slightly levitating, surrounded by sparkles and a faint energy ring. The design should clearly suggest it gives protective power. Transparent background, digital art style, ideal for sprite use in a top-down space shooter game.. In-Game asset. 2d. High contrast. No shadows
bu görseli hız için değiştir
Design a basic 2D top-down spaceship with a compact, angular body and minimal detailing. The ship should have a small central cockpit, two modest rear thrusters, and one weapon mount. Colors are simple — grays and blues — suggesting a utilitarian design. It should look like a beginner’s ship: reliable but not advanced. In-Game asset. 2d. High contrast. No shadows
Upgrade the Level 1 ship into a more capable 2D top-down design. Add wing extensions with subtle glowing lines, a larger engine section with animated thrusters, and two visible weapon hardpoints. Add more color variation (blues, steel, light glow effects) to indicate progress and increased power.. In-Game asset. 2d. High contrast. No shadows
Transform the ship into a high-tech 2D top-down spacecraft. Add shield emitters with rotating energy halos, four weapon slots, side thrusters, and an enhanced cockpit with a golden or crystal-like glow. The silhouette is wider and more refined. Visuals should include detailed paneling, moving parts, and advanced energy flows.. In-Game asset. 2d. High contrast. No shadows
elmas. In-Game asset. 2d. High contrast. No shadows
uzay 2d etkileyici lazer ışını. In-Game asset. 2d. High contrast. No shadows