User prompt
Görev veren NPC'ye tıkladığımız zaman Karakterin yukarısında Görev hakkında ''Kabul Et - Reddet'' butonları olsun. Ona göre etkileşimde olalım ve ona göre görevi yapalım veya yapmayalım. Verdiğimiz yanıta göre yapay zeka cevap versin ve verdiği görev hakkında işlem yapsın.
User prompt
NPC'ye tıkladığım zaman NPC görevi veya bulunduğum etkileşim Level altında küçük şekilde ve bir süre spawn olsun ve ne konuda etkileşimde bulundum ise bileyim.
User prompt
NPC soru sorduğunda, tıkladığım zaman NPC bir süre dursun.
User prompt
NPC Trade sorusu soruyor. tıkla diyor. Tıklıyorum, ticaret paneli açılmıyor.
User prompt
NPC'ye yaklaşıyorum ama hiçbirşey olmuyor. Ne çıkıyor ise, NPC üzerinde çıksın yaklaşınca.
User prompt
Haritada unsurların spawn olma oranını genel olarak ortalama %10 oranında artır. (Korsanlar hariç)
User prompt
Wave altına, Level ve EXP sistemi ekle, oyundaki RPG görevlerinden EXP kazanalım. RPG Macera oyunu olarak sistemi kur.
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'indexOf')' in or related to this line: 'if (!npcActive && tradeText.text.indexOf("Trade:") !== 0 && tradeText.text.indexOf("Special:") !== 0) {' Line Number: 1428
User prompt
NPC'ler ile ilgili etkileşim kuralım ve birçok RPG ve macera konusu ekle. Bazen de ticaret yapalım. NPC'ler yapay zeka oyuncuları tarafından yönetilsin.
User prompt
Kod içinde olan veya olmayan, oyuna uygun birçok özelliği veya mekaniği aktif et. Uyumsuz ise ekleme. Birbirinden farklı, Ticaret ve RPG katacak mekanik ve özellik ekle.
User prompt
Haritada unsurların spawn olma oranını genel olarak ortalama %10 oranında artır.
User prompt
''Reduce spawn rate of all entities and asteroids by 80%'' bunu %70 olarak değiştir. Ama korsanlar için %85 olsun. Çünkü korsan çok.
User prompt
Kod içinde olan veya olmayan, oyuna uygun birçok özelliği veya mekaniği aktif et. Uyumsuz ise ekleme. Birbirinden farklı, eğlence katacak mekanik ve özellik ekle.
User prompt
Asteroid'lere de otomatik ateş olsun. Ancak şuan haritada spawn olan unsur oranını %80 oranında azalt. Çok fazla unsur var.
User prompt
Kod içinde olan veya olmayan, oyuna uygun birçok özelliği veya mekaniği aktif et. Uyumsuz ise ekleme. Birbirinden farklı, eğlence katacak mekanik ve özellik ekle.
User prompt
Coins ve hammadde sayıları ekranda görünmüyor. Görünecek şekilde ekranda ki dış alanları sola kaydır.
User prompt
Düşmana, çok yaklaşırsak bize saldırsın ve biz ona çok yaklaşırsak saldıralım. Yoksa normal seyrinde devam etsinler.
User prompt
Haritada ki unsurlar otomatik spawn olma sistemini kaldır. İlerledikçe harita dışından spawn olarak gelsinler veya rastgele dolaşsınlar. sabit durmasın hiç birşey. Bir akış olsun.
User prompt
Harita sürekli aşağı doğru kaymasın, Karakterin gittiği yöne doğru haritada gidelim.
User prompt
Please fix the bug: 'TypeError: Cannot set properties of undefined (setting 'fill')' in or related to this line: 'healthText.style.fill = "#00ff00";' Line Number: 255
Code edit (1 edits merged)
Please save this source code
User prompt
Galactic Trader: Sonsuz Görevler
Initial prompt
Oyuncu, haritanın merkezinde bir uzay mekiğini joystick ile kontrol eder. Sonsuz bir galakside rastgele NPC’ler belirir ve oyuncuya görevler ile ticaret fırsatları sunar. Korsan savaş gemileriyle karşılaşılır; savaşarak coin ve hammadde toplanır. Toplanan kaynaklar ticaretle satılır, yeni yükseltmeler ve ekipmanlar alınır. Görevler ve ticaret ilerledikçe yeni bölgeler ve zorluklar açılır. Oyun, sonsuz ilerleme ve sürekli gelişen görevlerle devam eder.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 15; self.damage = 10; self.directionX = 0; self.directionY = -1; self.update = function () { self.x += self.directionX * self.speed; self.y += self.directionY * self.speed; }; return self; }); var Coin = Container.expand(function () { var self = Container.call(this); var coinGraphics = self.attachAsset('coin', { anchorX: 0.5, anchorY: 0.5 }); self.value = Math.floor(Math.random() * 10) + 5; self.update = function () { self.rotation += 0.05; }; return self; }); var EnemyBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('enemyBullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.damage = 5; self.directionX = 0; self.directionY = 0; self.update = function () { self.x += self.directionX * self.speed; self.y += self.directionY * self.speed; }; return self; }); var NPC = Container.expand(function () { var self = Container.call(this); var npcGraphics = self.attachAsset('npc', { anchorX: 0.5, anchorY: 0.5 }); self.questType = Math.random() < 0.5 ? 'trade' : 'delivery'; self.reward = Math.floor(Math.random() * 50) + 20; self.update = function () { // Float animation self.y += Math.sin(LK.ticks * 0.05) * 0.5; }; return self; }); var Pirate = Container.expand(function () { var self = Container.call(this); var pirateGraphics = self.attachAsset('pirate', { anchorX: 0.5, anchorY: 0.5 }); self.health = 30; self.speed = 2; self.fireRate = 60; self.lastFire = 0; self.loot = Math.floor(Math.random() * 30) + 10; self.takeDamage = function (amount) { self.health -= amount; LK.effects.flashObject(self, 0xffffff, 100); }; return self; }); var Resource = Container.expand(function () { var self = Container.call(this); var resourceGraphics = self.attachAsset('resource', { anchorX: 0.5, anchorY: 0.5 }); self.type = Math.random() < 0.5 ? 'metal' : 'energy'; self.amount = Math.floor(Math.random() * 5) + 1; self.update = function () { self.rotation += 0.03; }; return self; }); var Ship = Container.expand(function () { var self = Container.call(this); var shipGraphics = self.attachAsset('ship', { anchorX: 0.5, anchorY: 0.5 }); self.health = 100; self.maxHealth = 100; self.speed = 5; self.fireRate = 10; self.damage = 10; self.lastFire = 0; self.takeDamage = function (amount) { self.health -= amount; LK.effects.flashObject(self, 0xff0000, 200); if (self.health <= 0) { self.health = 0; LK.showGameOver(); } }; return self; }); var Star = Container.expand(function () { var self = Container.call(this); var starGraphics = self.attachAsset('star', { anchorX: 0.5, anchorY: 0.5 }); self.speed = Math.random() * 2 + 0.5; starGraphics.alpha = Math.random() * 0.8 + 0.2; self.update = function () { self.y += self.speed; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000033 }); /**** * Game Code ****/ // Game variables var ship; var joystickBase; var joystickHandle; var isDragging = false; var bullets = []; var enemyBullets = []; var npcs = []; var pirates = []; var coins = []; var resources = []; var stars = []; var camera = { x: 0, y: 0 }; // Player stats var playerCoins = storage.coins || 0; var playerMetal = storage.metal || 0; var playerEnergy = storage.energy || 0; var questsCompleted = storage.questsCompleted || 0; // UI Elements var coinText = new Text2('Coins: ' + playerCoins, { size: 50, fill: 0xFFFF00 }); coinText.anchor.set(0, 0); coinText.x = 20; coinText.y = 20; LK.gui.topRight.addChild(coinText); var resourceText = new Text2('Metal: ' + playerMetal + ' Energy: ' + playerEnergy, { size: 40, fill: 0xFFFFFF }); resourceText.anchor.set(0, 0); resourceText.x = 20; resourceText.y = 80; LK.gui.topRight.addChild(resourceText); var healthText = new Text2('Health: 100/100', { size: 50, fill: 0x00FF00 }); healthText.anchor.set(0.5, 0); LK.gui.top.addChild(healthText); // Create joystick joystickBase = game.addChild(LK.getAsset('joystickBase', { anchorX: 0.5, anchorY: 0.5, x: 300, y: 2432 })); joystickBase.alpha = 0.5; joystickHandle = game.addChild(LK.getAsset('joystickHandle', { anchorX: 0.5, anchorY: 0.5, x: 300, y: 2432 })); joystickHandle.alpha = 0.7; // Create ship ship = game.addChild(new Ship()); ship.x = 1024; ship.y = 1366; // Start background music LK.playMusic('bgmusic'); // Helper functions function spawnStar() { var star = new Star(); star.x = Math.random() * 2048; star.y = -10; stars.push(star); game.addChild(star); } function spawnNPC() { var npc = new NPC(); npc.x = Math.random() * 1648 + 200; npc.y = -100; npcs.push(npc); game.addChild(npc); } function spawnPirate() { var pirate = new Pirate(); pirate.x = Math.random() * 1648 + 200; pirate.y = -100; pirates.push(pirate); game.addChild(pirate); } function updateUI() { coinText.setText('Coins: ' + playerCoins); resourceText.setText('Metal: ' + playerMetal + ' Energy: ' + playerEnergy); healthText.setText('Health: ' + ship.health + '/' + ship.maxHealth); // Update health text color if (ship.health > 60) { healthText.style.fill = "#00ff00"; } else if (ship.health > 30) { healthText.style.fill = "#ffff00"; } else { healthText.style.fill = "#ff0000"; } } function saveProgress() { storage.coins = playerCoins; storage.metal = playerMetal; storage.energy = playerEnergy; storage.questsCompleted = questsCompleted; } // Event handlers game.down = function (x, y, obj) { if (Math.sqrt(Math.pow(x - joystickBase.x, 2) + Math.pow(y - joystickBase.y, 2)) < 100) { isDragging = true; joystickHandle.x = x; joystickHandle.y = y; } }; game.move = function (x, y, obj) { if (isDragging) { var dx = x - joystickBase.x; var dy = y - joystickBase.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 100) { dx = dx / distance * 100; dy = dy / distance * 100; } joystickHandle.x = joystickBase.x + dx; joystickHandle.y = joystickBase.y + dy; } }; game.up = function (x, y, obj) { isDragging = false; joystickHandle.x = joystickBase.x; joystickHandle.y = joystickBase.y; }; // Main game loop game.update = function () { // Ship movement if (isDragging) { var dx = joystickHandle.x - joystickBase.x; var dy = joystickHandle.y - joystickBase.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 10) { ship.x += dx / 100 * ship.speed; ship.y += dy / 100 * ship.speed; ship.rotation = Math.atan2(dy, dx) + Math.PI / 2; } } // Keep ship in bounds ship.x = Math.max(50, Math.min(1998, ship.x)); ship.y = Math.max(50, Math.min(2682, ship.y)); // Auto fire if (LK.ticks - ship.lastFire > ship.fireRate && pirates.length > 0) { var bullet = new Bullet(); bullet.x = ship.x; bullet.y = ship.y; // Find nearest pirate var nearestPirate = null; var nearestDistance = Infinity; for (var i = 0; i < pirates.length; i++) { var dist = Math.sqrt(Math.pow(pirates[i].x - ship.x, 2) + Math.pow(pirates[i].y - ship.y, 2)); if (dist < nearestDistance) { nearestDistance = dist; nearestPirate = pirates[i]; } } if (nearestPirate) { var angle = Math.atan2(nearestPirate.y - ship.y, nearestPirate.x - ship.x); bullet.directionX = Math.cos(angle); bullet.directionY = Math.sin(angle); bullet.rotation = angle + Math.PI / 2; } bullets.push(bullet); game.addChild(bullet); ship.lastFire = LK.ticks; LK.getSound('shoot').play(); } // Update bullets for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; if (bullet.x < -50 || bullet.x > 2098 || bullet.y < -50 || bullet.y > 2782) { bullet.destroy(); bullets.splice(i, 1); continue; } // Check collision with pirates for (var j = pirates.length - 1; j >= 0; j--) { if (bullet.intersects(pirates[j])) { pirates[j].takeDamage(bullet.damage); if (pirates[j].health <= 0) { // Drop loot var coin = new Coin(); coin.x = pirates[j].x; coin.y = pirates[j].y; coins.push(coin); game.addChild(coin); if (Math.random() < 0.3) { var resource = new Resource(); resource.x = pirates[j].x + (Math.random() - 0.5) * 50; resource.y = pirates[j].y + (Math.random() - 0.5) * 50; resources.push(resource); game.addChild(resource); } pirates[j].destroy(); pirates.splice(j, 1); } bullet.destroy(); bullets.splice(i, 1); LK.getSound('hit').play(); break; } } } // Update enemy bullets for (var i = enemyBullets.length - 1; i >= 0; i--) { var bullet = enemyBullets[i]; if (bullet.x < -50 || bullet.x > 2098 || bullet.y < -50 || bullet.y > 2782) { bullet.destroy(); enemyBullets.splice(i, 1); continue; } if (bullet.intersects(ship)) { ship.takeDamage(bullet.damage); updateUI(); bullet.destroy(); enemyBullets.splice(i, 1); LK.getSound('hit').play(); } } // Update pirates for (var i = 0; i < pirates.length; i++) { var pirate = pirates[i]; pirate.y += pirate.speed; // Pirate shooting if (LK.ticks - pirate.lastFire > pirate.fireRate) { var dist = Math.sqrt(Math.pow(ship.x - pirate.x, 2) + Math.pow(ship.y - pirate.y, 2)); if (dist < 800) { var bullet = new EnemyBullet(); bullet.x = pirate.x; bullet.y = pirate.y; var angle = Math.atan2(ship.y - pirate.y, ship.x - pirate.x); bullet.directionX = Math.cos(angle); bullet.directionY = Math.sin(angle); enemyBullets.push(bullet); game.addChild(bullet); pirate.lastFire = LK.ticks; } } if (pirate.y > 2800) { pirate.destroy(); pirates.splice(i, 1); i--; } } // Update NPCs for (var i = npcs.length - 1; i >= 0; i--) { var npc = npcs[i]; npc.y += 1; if (npc.y > 2800) { npc.destroy(); npcs.splice(i, 1); } } // Collect items for (var i = coins.length - 1; i >= 0; i--) { if (coins[i].intersects(ship)) { playerCoins += coins[i].value; coins[i].destroy(); coins.splice(i, 1); LK.getSound('collect').play(); updateUI(); saveProgress(); } } for (var i = resources.length - 1; i >= 0; i--) { if (resources[i].intersects(ship)) { if (resources[i].type === 'metal') { playerMetal += resources[i].amount; } else { playerEnergy += resources[i].amount; } resources[i].destroy(); resources.splice(i, 1); LK.getSound('collect').play(); updateUI(); saveProgress(); } } // Update stars for (var i = stars.length - 1; i >= 0; i--) { if (stars[i].y > 2750) { stars[i].destroy(); stars.splice(i, 1); } } // Spawn entities if (LK.ticks % 30 === 0) { spawnStar(); } if (LK.ticks % 300 === 0) { if (Math.random() < 0.6) { spawnPirate(); } else { spawnNPC(); } } // Update score LK.setScore(playerCoins + questsCompleted * 100); };
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,449 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+var storage = LK.import("@upit/storage.v1");
+
+/****
+* Classes
+****/
+var Bullet = Container.expand(function () {
+ var self = Container.call(this);
+ var bulletGraphics = self.attachAsset('bullet', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 15;
+ self.damage = 10;
+ self.directionX = 0;
+ self.directionY = -1;
+ self.update = function () {
+ self.x += self.directionX * self.speed;
+ self.y += self.directionY * self.speed;
+ };
+ return self;
+});
+var Coin = Container.expand(function () {
+ var self = Container.call(this);
+ var coinGraphics = self.attachAsset('coin', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.value = Math.floor(Math.random() * 10) + 5;
+ self.update = function () {
+ self.rotation += 0.05;
+ };
+ return self;
+});
+var EnemyBullet = Container.expand(function () {
+ var self = Container.call(this);
+ var bulletGraphics = self.attachAsset('enemyBullet', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 8;
+ self.damage = 5;
+ self.directionX = 0;
+ self.directionY = 0;
+ self.update = function () {
+ self.x += self.directionX * self.speed;
+ self.y += self.directionY * self.speed;
+ };
+ return self;
+});
+var NPC = Container.expand(function () {
+ var self = Container.call(this);
+ var npcGraphics = self.attachAsset('npc', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.questType = Math.random() < 0.5 ? 'trade' : 'delivery';
+ self.reward = Math.floor(Math.random() * 50) + 20;
+ self.update = function () {
+ // Float animation
+ self.y += Math.sin(LK.ticks * 0.05) * 0.5;
+ };
+ return self;
+});
+var Pirate = Container.expand(function () {
+ var self = Container.call(this);
+ var pirateGraphics = self.attachAsset('pirate', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.health = 30;
+ self.speed = 2;
+ self.fireRate = 60;
+ self.lastFire = 0;
+ self.loot = Math.floor(Math.random() * 30) + 10;
+ self.takeDamage = function (amount) {
+ self.health -= amount;
+ LK.effects.flashObject(self, 0xffffff, 100);
+ };
+ return self;
+});
+var Resource = Container.expand(function () {
+ var self = Container.call(this);
+ var resourceGraphics = self.attachAsset('resource', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.type = Math.random() < 0.5 ? 'metal' : 'energy';
+ self.amount = Math.floor(Math.random() * 5) + 1;
+ self.update = function () {
+ self.rotation += 0.03;
+ };
+ return self;
+});
+var Ship = Container.expand(function () {
+ var self = Container.call(this);
+ var shipGraphics = self.attachAsset('ship', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.health = 100;
+ self.maxHealth = 100;
+ self.speed = 5;
+ self.fireRate = 10;
+ self.damage = 10;
+ self.lastFire = 0;
+ self.takeDamage = function (amount) {
+ self.health -= amount;
+ LK.effects.flashObject(self, 0xff0000, 200);
+ if (self.health <= 0) {
+ self.health = 0;
+ LK.showGameOver();
+ }
+ };
+ return self;
+});
+var Star = Container.expand(function () {
+ var self = Container.call(this);
+ var starGraphics = self.attachAsset('star', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = Math.random() * 2 + 0.5;
+ starGraphics.alpha = Math.random() * 0.8 + 0.2;
+ self.update = function () {
+ self.y += self.speed;
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x000033
+});
+
+/****
+* Game Code
+****/
+// Game variables
+var ship;
+var joystickBase;
+var joystickHandle;
+var isDragging = false;
+var bullets = [];
+var enemyBullets = [];
+var npcs = [];
+var pirates = [];
+var coins = [];
+var resources = [];
+var stars = [];
+var camera = {
+ x: 0,
+ y: 0
+};
+// Player stats
+var playerCoins = storage.coins || 0;
+var playerMetal = storage.metal || 0;
+var playerEnergy = storage.energy || 0;
+var questsCompleted = storage.questsCompleted || 0;
+// UI Elements
+var coinText = new Text2('Coins: ' + playerCoins, {
+ size: 50,
+ fill: 0xFFFF00
+});
+coinText.anchor.set(0, 0);
+coinText.x = 20;
+coinText.y = 20;
+LK.gui.topRight.addChild(coinText);
+var resourceText = new Text2('Metal: ' + playerMetal + ' Energy: ' + playerEnergy, {
+ size: 40,
+ fill: 0xFFFFFF
+});
+resourceText.anchor.set(0, 0);
+resourceText.x = 20;
+resourceText.y = 80;
+LK.gui.topRight.addChild(resourceText);
+var healthText = new Text2('Health: 100/100', {
+ size: 50,
+ fill: 0x00FF00
+});
+healthText.anchor.set(0.5, 0);
+LK.gui.top.addChild(healthText);
+// Create joystick
+joystickBase = game.addChild(LK.getAsset('joystickBase', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 300,
+ y: 2432
+}));
+joystickBase.alpha = 0.5;
+joystickHandle = game.addChild(LK.getAsset('joystickHandle', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 300,
+ y: 2432
+}));
+joystickHandle.alpha = 0.7;
+// Create ship
+ship = game.addChild(new Ship());
+ship.x = 1024;
+ship.y = 1366;
+// Start background music
+LK.playMusic('bgmusic');
+// Helper functions
+function spawnStar() {
+ var star = new Star();
+ star.x = Math.random() * 2048;
+ star.y = -10;
+ stars.push(star);
+ game.addChild(star);
+}
+function spawnNPC() {
+ var npc = new NPC();
+ npc.x = Math.random() * 1648 + 200;
+ npc.y = -100;
+ npcs.push(npc);
+ game.addChild(npc);
+}
+function spawnPirate() {
+ var pirate = new Pirate();
+ pirate.x = Math.random() * 1648 + 200;
+ pirate.y = -100;
+ pirates.push(pirate);
+ game.addChild(pirate);
+}
+function updateUI() {
+ coinText.setText('Coins: ' + playerCoins);
+ resourceText.setText('Metal: ' + playerMetal + ' Energy: ' + playerEnergy);
+ healthText.setText('Health: ' + ship.health + '/' + ship.maxHealth);
+ // Update health text color
+ if (ship.health > 60) {
+ healthText.style.fill = "#00ff00";
+ } else if (ship.health > 30) {
+ healthText.style.fill = "#ffff00";
+ } else {
+ healthText.style.fill = "#ff0000";
+ }
+}
+function saveProgress() {
+ storage.coins = playerCoins;
+ storage.metal = playerMetal;
+ storage.energy = playerEnergy;
+ storage.questsCompleted = questsCompleted;
+}
+// Event handlers
+game.down = function (x, y, obj) {
+ if (Math.sqrt(Math.pow(x - joystickBase.x, 2) + Math.pow(y - joystickBase.y, 2)) < 100) {
+ isDragging = true;
+ joystickHandle.x = x;
+ joystickHandle.y = y;
+ }
+};
+game.move = function (x, y, obj) {
+ if (isDragging) {
+ var dx = x - joystickBase.x;
+ var dy = y - joystickBase.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance > 100) {
+ dx = dx / distance * 100;
+ dy = dy / distance * 100;
+ }
+ joystickHandle.x = joystickBase.x + dx;
+ joystickHandle.y = joystickBase.y + dy;
+ }
+};
+game.up = function (x, y, obj) {
+ isDragging = false;
+ joystickHandle.x = joystickBase.x;
+ joystickHandle.y = joystickBase.y;
+};
+// Main game loop
+game.update = function () {
+ // Ship movement
+ if (isDragging) {
+ var dx = joystickHandle.x - joystickBase.x;
+ var dy = joystickHandle.y - joystickBase.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance > 10) {
+ ship.x += dx / 100 * ship.speed;
+ ship.y += dy / 100 * ship.speed;
+ ship.rotation = Math.atan2(dy, dx) + Math.PI / 2;
+ }
+ }
+ // Keep ship in bounds
+ ship.x = Math.max(50, Math.min(1998, ship.x));
+ ship.y = Math.max(50, Math.min(2682, ship.y));
+ // Auto fire
+ if (LK.ticks - ship.lastFire > ship.fireRate && pirates.length > 0) {
+ var bullet = new Bullet();
+ bullet.x = ship.x;
+ bullet.y = ship.y;
+ // Find nearest pirate
+ var nearestPirate = null;
+ var nearestDistance = Infinity;
+ for (var i = 0; i < pirates.length; i++) {
+ var dist = Math.sqrt(Math.pow(pirates[i].x - ship.x, 2) + Math.pow(pirates[i].y - ship.y, 2));
+ if (dist < nearestDistance) {
+ nearestDistance = dist;
+ nearestPirate = pirates[i];
+ }
+ }
+ if (nearestPirate) {
+ var angle = Math.atan2(nearestPirate.y - ship.y, nearestPirate.x - ship.x);
+ bullet.directionX = Math.cos(angle);
+ bullet.directionY = Math.sin(angle);
+ bullet.rotation = angle + Math.PI / 2;
+ }
+ bullets.push(bullet);
+ game.addChild(bullet);
+ ship.lastFire = LK.ticks;
+ LK.getSound('shoot').play();
+ }
+ // Update bullets
+ for (var i = bullets.length - 1; i >= 0; i--) {
+ var bullet = bullets[i];
+ if (bullet.x < -50 || bullet.x > 2098 || bullet.y < -50 || bullet.y > 2782) {
+ bullet.destroy();
+ bullets.splice(i, 1);
+ continue;
+ }
+ // Check collision with pirates
+ for (var j = pirates.length - 1; j >= 0; j--) {
+ if (bullet.intersects(pirates[j])) {
+ pirates[j].takeDamage(bullet.damage);
+ if (pirates[j].health <= 0) {
+ // Drop loot
+ var coin = new Coin();
+ coin.x = pirates[j].x;
+ coin.y = pirates[j].y;
+ coins.push(coin);
+ game.addChild(coin);
+ if (Math.random() < 0.3) {
+ var resource = new Resource();
+ resource.x = pirates[j].x + (Math.random() - 0.5) * 50;
+ resource.y = pirates[j].y + (Math.random() - 0.5) * 50;
+ resources.push(resource);
+ game.addChild(resource);
+ }
+ pirates[j].destroy();
+ pirates.splice(j, 1);
+ }
+ bullet.destroy();
+ bullets.splice(i, 1);
+ LK.getSound('hit').play();
+ break;
+ }
+ }
+ }
+ // Update enemy bullets
+ for (var i = enemyBullets.length - 1; i >= 0; i--) {
+ var bullet = enemyBullets[i];
+ if (bullet.x < -50 || bullet.x > 2098 || bullet.y < -50 || bullet.y > 2782) {
+ bullet.destroy();
+ enemyBullets.splice(i, 1);
+ continue;
+ }
+ if (bullet.intersects(ship)) {
+ ship.takeDamage(bullet.damage);
+ updateUI();
+ bullet.destroy();
+ enemyBullets.splice(i, 1);
+ LK.getSound('hit').play();
+ }
+ }
+ // Update pirates
+ for (var i = 0; i < pirates.length; i++) {
+ var pirate = pirates[i];
+ pirate.y += pirate.speed;
+ // Pirate shooting
+ if (LK.ticks - pirate.lastFire > pirate.fireRate) {
+ var dist = Math.sqrt(Math.pow(ship.x - pirate.x, 2) + Math.pow(ship.y - pirate.y, 2));
+ if (dist < 800) {
+ var bullet = new EnemyBullet();
+ bullet.x = pirate.x;
+ bullet.y = pirate.y;
+ var angle = Math.atan2(ship.y - pirate.y, ship.x - pirate.x);
+ bullet.directionX = Math.cos(angle);
+ bullet.directionY = Math.sin(angle);
+ enemyBullets.push(bullet);
+ game.addChild(bullet);
+ pirate.lastFire = LK.ticks;
+ }
+ }
+ if (pirate.y > 2800) {
+ pirate.destroy();
+ pirates.splice(i, 1);
+ i--;
+ }
+ }
+ // Update NPCs
+ for (var i = npcs.length - 1; i >= 0; i--) {
+ var npc = npcs[i];
+ npc.y += 1;
+ if (npc.y > 2800) {
+ npc.destroy();
+ npcs.splice(i, 1);
+ }
+ }
+ // Collect items
+ for (var i = coins.length - 1; i >= 0; i--) {
+ if (coins[i].intersects(ship)) {
+ playerCoins += coins[i].value;
+ coins[i].destroy();
+ coins.splice(i, 1);
+ LK.getSound('collect').play();
+ updateUI();
+ saveProgress();
+ }
+ }
+ for (var i = resources.length - 1; i >= 0; i--) {
+ if (resources[i].intersects(ship)) {
+ if (resources[i].type === 'metal') {
+ playerMetal += resources[i].amount;
+ } else {
+ playerEnergy += resources[i].amount;
+ }
+ resources[i].destroy();
+ resources.splice(i, 1);
+ LK.getSound('collect').play();
+ updateUI();
+ saveProgress();
+ }
+ }
+ // Update stars
+ for (var i = stars.length - 1; i >= 0; i--) {
+ if (stars[i].y > 2750) {
+ stars[i].destroy();
+ stars.splice(i, 1);
+ }
+ }
+ // Spawn entities
+ if (LK.ticks % 30 === 0) {
+ spawnStar();
+ }
+ if (LK.ticks % 300 === 0) {
+ if (Math.random() < 0.6) {
+ spawnPirate();
+ } else {
+ spawnNPC();
+ }
+ }
+ // Update score
+ LK.setScore(playerCoins + questsCompleted * 100);
+};
\ No newline at end of file
Uzay temalı global Cevher ticareti, gerçekçi, Altında "Trade" yazsın. In-Game asset. High contrast. No shadows
Uzay temalı global Cevher ticareti, uzay istasyonu, gerçekçi, Altında "Space Stations" yazsın. In-Game asset. High contrast. No shadows
Uzay temalı global Cevher deposu, uzay kargosu, gerçekçi, Altında "Storage" yazsın. In-Game asset. High contrast. No shadows
Uzay temalı Gemi Geliştirme, Tamirci İstasyonu, gerçekçi, Altında "Upgrade" yazsın. In-Game asset. High contrast. No shadows
Uzay temalı global Achievements, gerçekçi, Altında "Achievements" yazsın. In-Game asset. High contrast. No shadows
Uzay temalı, içi altın dolu kapağı açık kasa, gerçekçi, In-Game asset. High contrast. No shadows
Uzay temalı Spaceship Crew, gerçekçi, Altında "crew" yazsın. In-Game asset. High contrast. No shadows
Uzay temalı Savaş Gemisi, gerçekçi, yazısız üstten görünüm. In-Game asset. High contrast. No shadows
Uzay temalı Savaş Gemisi, gerçekçi, yazısız üstten görünüm. In-Game asset. High contrast. No shadows
Uzay temalı altın coin, gerçekçi, yazısız üstten görünüm. In-Game asset. High contrast. No shadows
Uzay temalı Savaş Gemisi, gerçekçi, yazısız üstten görünüm. In-Game asset. High contrast. No shadows
Uzay temalı Savaş Gemisi, gerçekçi, yazısız üstten görünüm. In-Game asset. High contrast. No shadows
Uzay temalı Savaş Gemisi, gerçekçi, yazısız üstten görünüm. In-Game asset. High contrast. No shadows
Uzay temalı Savaş Gemisi, gerçekçi, yazısız üstten görünüm. In-Game asset. High contrast. No shadows
Uzay temalı Savaş Gemisi, gerçekçi, yazısız üstten görünüm. In-Game asset. High contrast. No shadows
Uzay temalı Savaş Gemisi, gerçekçi, yazısız üstten görünüm. In-Game asset. High contrast. No shadows
Uzay temalı Savaş Gemisi, gerçekçi, yazısız üstten görünüm. In-Game asset. High contrast. No shadows
Uzay temalı asteroid, üzerinde cevherler bulunsun, gerçekçi, yazısız üstten görünüm. In-Game asset. High contrast. No shadows