User prompt
Merminin ucu ateş edilen yöne doğru dönsun
User prompt
Player ateş ettiği tarafa dönsün
User prompt
Marketteki ögeler üstüne tıklanarak satın alınsın
User prompt
Marketteki eşyalar satın alınabilsin ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Kazanılan COIN ile marketten satın alım yapılsın ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Kazanılan "COIN" ile marketten satın alım yapılabilsin. Skor her oyunda sıfırlansın ama "COIN" satın alım yapılmadığı sürece azalmasın ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Zombiler bize çarpınca "COIN" kazanılmasın ama skor artsın
User prompt
Zombileri öldürerek kazandığımız "COIN" skorun altında görünsün
User prompt
Marketteki "POINT" yerine zombileri öldürerek kazanılan "COIN" kullanılsın
User prompt
Marketteki "BUY" butonunu kaldır
User prompt
Market sekmesindeki satın alınacak eşyaları almak için üstünde "BUY" yazan bir buton oluştur
User prompt
Market menüsündeki satın alma barları yazılarla eşit boyutta olsun
User prompt
Market sekmesi daha büyük görünsün
User prompt
"Score" yerine "POINT" kullanılsın
User prompt
Market sekmesindeki eşyalar satın alınabilsin ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Market sekmesindeki eşyalar oyunda elde ettiğimiz "Score" ile alınsın ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Oyun sonundaki "MARKET" butonuna tıklayınca market sekmesi açılsın ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
"ammo pickup" özelliğini kaldır
User prompt
Bitiş menüsüne market butonu ekle
User prompt
Sonradan eklenilen özelliklerin hepsini sil
User prompt
"BUY" yazısının üstüne tıklayınca üstündeki şey satın alınsın
User prompt
Satın alınacak şeylerin altında "BUY" diye bir yazı olsun ona basınca üstündeki ürünleri satın alsın ve oyunu etkilesin.
User prompt
Satın alma panelindeki şeyler kullanılmıyoru bunu düzelt
User prompt
Oyun bittikten sonra otomatik olarak düşmanlar gelmeyi bıraksın ve satın alma işlemi bittikten sonra oyun tekrar başlasın
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'toGlobal')' in or related to this line: 'var localPos = self.toLocal(obj.parent.toGlobal(obj.position));' Line Number: 255
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var AmmoPickup = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('ammoPickup', { anchorX: 0.5, anchorY: 0.5 }); self.ammoAmount = 10; self.lifetime = 600; self.lastPlayerCollision = false; self.update = function () { self.lifetime--; graphics.rotation += 0.05; if (self.lifetime <= 0) { self.remove(); return; } var currentCollision = self.intersects(player); if (!self.lastPlayerCollision && currentCollision) { player.addAmmo(self.ammoAmount); LK.getSound('pickup').play(); self.remove(); return; } self.lastPlayerCollision = currentCollision; }; self.remove = function () { var index = ammoPickups.indexOf(self); if (index > -1) { ammoPickups.splice(index, 1); } self.destroy(); }; return self; }); var Bullet = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.dx = 0; self.dy = 0; self.lifetime = 120; self.update = function () { self.x += self.dx * self.speed; self.y += self.dy * self.speed; self.lifetime--; if (self.lifetime <= 0 || self.isOutOfBounds()) { self.remove(); return; } for (var i = 0; i < zombies.length; i++) { var zombie = zombies[i]; if (self.intersects(zombie)) { zombie.takeDamage(1); self.remove(); return; } } }; self.isOutOfBounds = function () { return self.x < 0 || self.x > 2048 || self.y < 0 || self.y > 2732; }; self.remove = function () { var index = bullets.indexOf(self); if (index > -1) { bullets.splice(index, 1); } self.destroy(); }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); // Load upgrades from storage var healthUpgrade = (storage.maxHealthLevel || 0) * 20; var ammoUpgrade = (storage.maxAmmoLevel || 0) * 10; self.health = 100 + healthUpgrade; self.maxHealth = 100 + healthUpgrade; self.ammo = 30 + ammoUpgrade; self.maxAmmo = 30 + ammoUpgrade; self.shootCooldown = 0; self.update = function () { if (self.shootCooldown > 0) { self.shootCooldown--; } }; self.takeDamage = function (damage) { self.health -= damage; if (self.health <= 0) { self.health = 0; gameActive = false; LK.effects.flashScreen(0xff0000, 1000); // Show upgrade panel instead of immediate game over var upgradePanel = new UpgradePanel(); upgradePanel.x = 2048 / 2; upgradePanel.y = 2732 / 2; game.addChild(upgradePanel); } else { LK.effects.flashObject(self, 0xff0000, 200); } }; self.addAmmo = function (amount) { self.ammo = Math.min(self.ammo + amount, self.maxAmmo); }; self.canShoot = function () { return self.ammo > 0 && self.shootCooldown <= 0; }; self.shoot = function () { if (self.canShoot()) { self.ammo--; self.shootCooldown = 10; return true; } return false; }; return self; }); var UpgradePanel = Container.expand(function () { var self = Container.call(this); // Panel background var panelBg = LK.getAsset('upgradePanel', { width: 1600, height: 1200, color: 0x222222, shape: 'box', anchorX: 0.5, anchorY: 0.5 }); self.addChild(panelBg); // Title var title = new Text2('UPGRADE YOUR CHARACTER', { size: 80, fill: 0xFFFFFF }); title.anchor.set(0.5, 0.5); title.x = 0; title.y = -450; self.addChild(title); // Score display var scoreText = new Text2('Final Score: ' + LK.getScore(), { size: 60, fill: 0xFFFF00 }); scoreText.anchor.set(0.5, 0.5); scoreText.x = 0; scoreText.y = -350; self.addChild(scoreText); // Upgrade buttons var upgradeButtons = []; var upgrades = [{ name: 'Health', cost: 100, property: 'maxHealth', increase: 20 }, { name: 'Ammo', cost: 80, property: 'maxAmmo', increase: 10 }, { name: 'Damage', cost: 150, property: 'damage', increase: 1 }]; for (var i = 0; i < upgrades.length; i++) { var upgrade = upgrades[i]; var currentLevel = storage[upgrade.property + 'Level'] || 0; var cost = upgrade.cost + currentLevel * 50; // Button background var buttonBg = LK.getAsset('upgradeButton', { width: 400, height: 150, color: LK.getScore() >= cost ? 0x00AA00 : 0xAA0000, shape: 'box', anchorX: 0.5, anchorY: 0.5 }); buttonBg.x = (i - 1) * 500; buttonBg.y = -100; self.addChild(buttonBg); // Button text var buttonText = new Text2(upgrade.name + ' +' + upgrade.increase + '\nCost: ' + cost + '\nLevel: ' + currentLevel, { size: 40, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); buttonText.x = buttonBg.x; buttonText.y = buttonBg.y; self.addChild(buttonText); // Store button data upgradeButtons.push({ bg: buttonBg, text: buttonText, upgrade: upgrade, cost: cost, currentLevel: currentLevel }); } // Continue button var continueButton = LK.getAsset('continueButton', { width: 300, height: 100, color: 0x0080FF, shape: 'box', anchorX: 0.5, anchorY: 0.5 }); continueButton.x = 0; continueButton.y = 300; self.addChild(continueButton); var continueText = new Text2('CONTINUE', { size: 50, fill: 0xFFFFFF }); continueText.anchor.set(0.5, 0.5); continueText.x = 0; continueText.y = 300; self.addChild(continueText); // Handle button clicks self.down = function (x, y, obj) { // Convert game coordinates to local coordinates var localPos; if (obj && obj.parent && obj.parent.toGlobal && obj.position) { localPos = self.toLocal(obj.parent.toGlobal(obj.position)); } else { // Fallback: use the x,y parameters directly and convert from game coordinates var gamePos = game.toLocal({ x: x, y: y }); localPos = self.toLocal(gamePos); } // Check upgrade buttons for (var i = 0; i < upgradeButtons.length; i++) { var button = upgradeButtons[i]; if (Math.abs(localPos.x - button.bg.x) < 200 && Math.abs(localPos.y - button.bg.y) < 75 && LK.getScore() >= button.cost) { // Purchase upgrade LK.setScore(LK.getScore() - button.cost); var newLevel = button.currentLevel + 1; storage[button.upgrade.property + 'Level'] = newLevel; // Update display var newCost = button.upgrade.cost + newLevel * 50; button.text.setText(button.upgrade.name + ' +' + button.upgrade.increase + '\nCost: ' + newCost + '\nLevel: ' + newLevel); button.bg.tint = LK.getScore() >= newCost ? 0x00AA00 : 0xAA0000; scoreText.setText('Final Score: ' + LK.getScore()); return; } } // Check continue button if (Math.abs(localPos.x - continueButton.x) < 150 && Math.abs(localPos.y - continueButton.y) < 50) { self.close(); } }; self.close = function () { self.destroy(); // Reset game state gameActive = true; waveNumber = 1; zombiesInWave = 5; zombiesSpawned = 0; spawnTimer = 0; pickupTimer = 0; LK.setScore(0); // Apply upgrades to player var healthUpgrade = (storage.maxHealthLevel || 0) * 20; var ammoUpgrade = (storage.maxAmmoLevel || 0) * 10; player.health = 100 + healthUpgrade; player.maxHealth = 100 + healthUpgrade; player.ammo = 30 + ammoUpgrade; player.maxAmmo = 30 + ammoUpgrade; // Restart game with upgrades LK.showGameOver(); }; return self; }); var Zombie = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('zombie', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 1 + Math.random() * 0.5; self.health = 1; self.damage = 10; self.lastPlayerCollision = false; self.update = function () { var dx = player.x - self.x; var dy = player.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } var currentCollision = self.intersects(player); if (!self.lastPlayerCollision && currentCollision) { player.takeDamage(self.damage); self.takeDamage(1); } self.lastPlayerCollision = currentCollision; }; self.takeDamage = function (damage) { // Apply damage upgrade var damageUpgrade = (storage.damageLevel || 0) * 1; var totalDamage = damage + damageUpgrade; self.health -= totalDamage; if (self.health <= 0) { LK.effects.flashObject(self, 0xffffff, 100); LK.setScore(LK.getScore() + 10); LK.getSound('zombieHit').play(); var index = zombies.indexOf(self); if (index > -1) { zombies.splice(index, 1); } self.destroy(); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2d2d2d }); /**** * Game Code ****/ var arena = game.attachAsset('arena', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); var player = game.addChild(new Player()); player.x = 2048 / 2; player.y = 2732 / 2; var zombies = []; var bullets = []; var ammoPickups = []; var waveNumber = 1; var zombiesInWave = 5; var zombiesSpawned = 0; var spawnTimer = 0; var pickupTimer = 0; var gameActive = true; var healthBar = new Text2('Health: 100', { size: 60, fill: 0xFF0000 }); healthBar.anchor.set(0, 0); LK.gui.topLeft.addChild(healthBar); var ammoDisplay = new Text2('Ammo: 30', { size: 60, fill: 0x00FF00 }); ammoDisplay.anchor.set(0, 0); ammoDisplay.y = 70; LK.gui.topLeft.addChild(ammoDisplay); var scoreDisplay = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreDisplay.anchor.set(0.5, 0); LK.gui.top.addChild(scoreDisplay); var waveDisplay = new Text2('Wave: 1', { size: 60, fill: 0xFFFF00 }); waveDisplay.anchor.set(1, 0); LK.gui.topRight.addChild(waveDisplay); function spawnZombie() { var zombie = new Zombie(); var angle = Math.random() * Math.PI * 2; var spawnRadius = 1000; zombie.x = player.x + Math.cos(angle) * spawnRadius; zombie.y = player.y + Math.sin(angle) * spawnRadius; zombies.push(zombie); game.addChild(zombie); } function spawnAmmoPickup() { var pickup = new AmmoPickup(); var angle = Math.random() * Math.PI * 2; var radius = 200 + Math.random() * 400; pickup.x = player.x + Math.cos(angle) * radius; pickup.y = player.y + Math.sin(angle) * radius; ammoPickups.push(pickup); game.addChild(pickup); } function shootBullet(targetX, targetY) { if (player.shoot()) { var bullet = new Bullet(); bullet.x = player.x; bullet.y = player.y; var dx = targetX - player.x; var dy = targetY - player.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { bullet.dx = dx / distance; bullet.dy = dy / distance; } bullets.push(bullet); game.addChild(bullet); LK.getSound('shoot').play(); } } game.down = function (x, y, obj) { shootBullet(x, y); }; game.update = function () { if (gameActive) { spawnTimer++; pickupTimer++; if (zombiesSpawned < zombiesInWave && spawnTimer >= 60) { spawnZombie(); zombiesSpawned++; spawnTimer = 0; } if (zombiesSpawned >= zombiesInWave && zombies.length === 0) { waveNumber++; zombiesInWave = Math.min(5 + waveNumber * 2, 20); zombiesSpawned = 0; waveDisplay.setText('Wave: ' + waveNumber); for (var i = 0; i < zombies.length; i++) { zombies[i].speed += 0.1; } } if (pickupTimer >= 900) { spawnAmmoPickup(); pickupTimer = 0; } } healthBar.setText('Health: ' + player.health); ammoDisplay.setText('Ammo: ' + player.ammo); scoreDisplay.setText('Score: ' + LK.getScore()); for (var i = bullets.length - 1; i >= 0; i--) { bullets[i].update(); } for (var i = zombies.length - 1; i >= 0; i--) { zombies[i].update(); } for (var i = ammoPickups.length - 1; i >= 0; i--) { ammoPickups[i].update(); } }; LK.playMusic('bgmusic');
===================================================================
--- original.js
+++ change.js
@@ -276,8 +276,15 @@
zombiesSpawned = 0;
spawnTimer = 0;
pickupTimer = 0;
LK.setScore(0);
+ // Apply upgrades to player
+ var healthUpgrade = (storage.maxHealthLevel || 0) * 20;
+ var ammoUpgrade = (storage.maxAmmoLevel || 0) * 10;
+ player.health = 100 + healthUpgrade;
+ player.maxHealth = 100 + healthUpgrade;
+ player.ammo = 30 + ammoUpgrade;
+ player.maxAmmo = 30 + ammoUpgrade;
// Restart game with upgrades
LK.showGameOver();
};
return self;
@@ -307,9 +314,12 @@
}
self.lastPlayerCollision = currentCollision;
};
self.takeDamage = function (damage) {
- self.health -= damage;
+ // Apply damage upgrade
+ var damageUpgrade = (storage.damageLevel || 0) * 1;
+ var totalDamage = damage + damageUpgrade;
+ self.health -= totalDamage;
if (self.health <= 0) {
LK.effects.flashObject(self, 0xffffff, 100);
LK.setScore(LK.getScore() + 10);
LK.getSound('zombieHit').play();
Üstten görünümlü zombi. In-Game asset. 2d. High contrast. No shadows
Ortasında elips şeklinde bir boşluk hariç her yeri sık ağaçlık olan bir orman. In-Game asset. 2d. High contrast. No shadows
Ahşap tema. In-Game asset. 2d. High contrast. No shadows
pompalı tüfek mermisi. In-Game asset. 2d. High contrast. No shadows
hafif makineli tüfek mermisi. In-Game asset. 2d. High contrast. No shadows
Uzi çiz. In-Game asset. 2d. High contrast. No shadows
Pompalı Tüfek. In-Game asset. 2d. High contrast. No shadows
Bunun arkaplanını sil
Arkaplanını sil
boss zombie. In-Game asset. 2d. High contrast. No shadows
dümdüz sadece buzullardan oluşsun aralarında yarıklar olmasın