User prompt
Düşman karakterin sağlığı kırmızı bizim karekterlerimizin yeşil olsun
User prompt
Sadece düşman karakterlerin sağlığı #ff0000 olsun
User prompt
Rengi #ff0000 olsun
User prompt
Düşman karakterlerin sağlığı kırmızı olsun
User prompt
Bu dikdörtgen ve yazı kulenin tam üstünde olsun ve renkleri mavi olsun
User prompt
Bu yazı tam kulenin üstünde olsun
User prompt
Her iki kulenin 1000 canı olsun ve yeşil dikdörtgen ve içindeki yazı 3 kat daha küçük olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Ve kulenin de aynı şekilde sağlıkları olsun iki kuleninde 1000 canı olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
İçindeki yazıda 2.5 kat daha büyük olsun
User prompt
Bu yeşil dikdörtgen karakterin 2kat daha üstünde olsun ve 2.5 kat daha büyük olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Bu kutu ve 2 kat daha yukarıda ve 2.5 kat daha büyük olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Sağlıkları yeşil bir dikdörtgen içinde yazsın örneğin 10 sağlığı olan bir karakterin 5 sağlığı kalınca yeşil alan %/0 küçüksün ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Her karakterin üstünde sağlıkları yazsın worker in 10 warrior un warrior un 20 archer in 30 wizardın 40 dragonun 50 sağlığı olsun
User prompt
Karakterlerin altında isimleri değil kaç coin oldukları yazsin
User prompt
Archer ve wizardın yerini değiştir
User prompt
Warrior u 10 coin wizardı 20 coin dragon u 25 coin yap ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Yine iç içe girmesin
User prompt
Görselleri ve yazıları iç içe girmesin
User prompt
Boylarını biraz küçült ve sıkıştırma ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
En alttaki karakter satın alma yerindeki karakterleri sıkıştır ma ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
15 coin e alınan yeni okçu karakterini ekle ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
1.1 kat daha ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Siyah yeri aşağıya doğru 1.3 kat küçült ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Coins yazısı siyah yerin üstünde olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
1.25 kat daha yukarı ve 2 kat daha büyüt ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/**** * Plugins ****/ var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Coin = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('coin', { anchorX: 0.5, anchorY: 0.5 }); self.value = 1; self.collected = false; return self; }); var CombatUnit = Container.expand(function (team, unitType) { var self = Container.call(this); var assetName = team === 'player' ? unitType : 'ai' + unitType.charAt(0).toUpperCase() + unitType.slice(1); var graphics = self.attachAsset(assetName, { anchorX: 0.5, anchorY: 0.5 }); self.team = team; self.unitType = unitType; self.speed = unitType === 'dragon' ? 3 : unitType === 'wizard' ? 1.5 : unitType === 'archer' ? 2.5 : 2; self.damage = unitType === 'dragon' ? 25 : unitType === 'wizard' ? 15 : unitType === 'archer' ? 12 : 10; self.health = unitType === 'dragon' ? 60 : unitType === 'wizard' ? 30 : unitType === 'archer' ? 35 : 40; self.maxHealth = self.health; self.attackRange = unitType === 'wizard' ? 100 : unitType === 'archer' ? 120 : 50; self.attackCooldown = 0; self.target = null; self.update = function () { if (self.attackCooldown > 0) { self.attackCooldown--; } if (!self.target) { self.findNearestEnemyTower(); } else { self.moveToTarget(); } }; self.findNearestEnemyTower = function () { var enemyTowers = self.team === 'player' ? aiTowers : playerTowers; var nearestTower = null; var nearestDistance = Infinity; for (var i = 0; i < enemyTowers.length; i++) { var tower = enemyTowers[i]; var distance = Math.sqrt(Math.pow(tower.x - self.x, 2) + Math.pow(tower.y - self.y, 2)); if (distance < nearestDistance) { nearestDistance = distance; nearestTower = tower; } } self.target = nearestTower; }; self.moveToTarget = function () { if (!self.target) { return; } var dx = self.target.x - self.x; var dy = self.target.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < self.attackRange) { self.attackTarget(); } else { self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } }; self.attackTarget = function () { if (self.attackCooldown <= 0 && self.target) { self.target.health -= self.damage; self.attackCooldown = 60; LK.getSound('attack').play(); if (self.target.health <= 0) { self.destroyTower(); } } }; self.destroyTower = function () { var towers = self.team === 'player' ? aiTowers : playerTowers; var index = towers.indexOf(self.target); if (index > -1) { towers.splice(index, 1); self.target.destroy(); LK.getSound('towerDestroyed').play(); self.target = null; } }; return self; }); var Tower = Container.expand(function (team) { var self = Container.call(this); var assetName = team === 'player' ? 'playerTower' : 'aiTower'; var graphics = self.attachAsset(assetName, { anchorX: 0.5, anchorY: 1.0 }); self.team = team; self.health = 100; self.maxHealth = 100; return self; }); var Worker = Container.expand(function (team) { var self = Container.call(this); var assetName = team === 'player' ? 'worker' : 'aiWorker'; var graphics = self.attachAsset(assetName, { anchorX: 0.5, anchorY: 0.5 }); self.team = team; self.speed = 2; self.target = null; self.collectRange = 40; self.update = function () { if (!self.target) { self.findNearestCoin(); } else { self.moveToTarget(); } }; self.findNearestCoin = function () { var nearestCoin = null; var nearestDistance = Infinity; var targetCoins = self.team === 'player' ? playerCoins_array : aiCoins_array; for (var i = 0; i < targetCoins.length; i++) { var coin = targetCoins[i]; if (!coin.collected) { var distance = Math.sqrt(Math.pow(coin.x - self.x, 2) + Math.pow(coin.y - self.y, 2)); if (distance < nearestDistance) { nearestDistance = distance; nearestCoin = coin; } } } self.target = nearestCoin; }; self.moveToTarget = function () { if (!self.target || self.target.collected) { self.target = null; return; } var dx = self.target.x - self.x; var dy = self.target.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < self.collectRange) { self.collectCoin(); } else { self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } }; self.collectCoin = function () { if (self.target && !self.target.collected) { self.target.collected = true; if (self.team === 'player') { playerCoins += self.target.value; } else { aiCoins += self.target.value; } LK.getSound('coinCollect').play(); self.target = null; } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x228B22 }); /**** * Game Code ****/ var playerCoins = 0; var aiCoins = 0; var playerTowers = []; var aiTowers = []; var coins = []; var playerCoins_array = []; var aiCoins_array = []; var playerUnits = []; var aiUnits = []; var coinSpawnTimer = 0; var aiActionTimer = 0; // UI Elements var coinDisplay = new Text2('Coins: 0', { size: 80, fill: '#ffff00' }); coinDisplay.anchor.set(0.5, 0.5); coinDisplay.x = 0; coinDisplay.y = -273.75; LK.gui.bottom.addChild(coinDisplay); var workerButton = new Text2('Worker (5)', { size: 45, fill: '#ffffff' }); workerButton.anchor.set(0.5, 0.5); workerButton.x = -400; workerButton.y = -50; var warriorButton = new Text2('Warrior (7)', { size: 45, fill: '#ffffff' }); warriorButton.anchor.set(0.5, 0.5); warriorButton.x = -133; warriorButton.y = -50; var wizardButton = new Text2('Wizard (10)', { size: 45, fill: '#ffffff' }); wizardButton.anchor.set(0.5, 0.5); wizardButton.x = 133; wizardButton.y = -50; var archerButton = new Text2('Archer (15)', { size: 45, fill: '#ffffff' }); archerButton.anchor.set(0.5, 0.5); archerButton.x = 266; archerButton.y = -50; var dragonButton = new Text2('Dragon (20)', { size: 45, fill: '#ffffff' }); dragonButton.anchor.set(0.5, 0.5); dragonButton.x = 400; dragonButton.y = -50; // Add unified black background behind all recruitment buttons and unit images var unifiedBackground = LK.getAsset('blackBackground', { anchorX: 0.5, anchorY: 0.5, scaleX: 24.576, scaleY: 3.102 }); unifiedBackground.x = 0; unifiedBackground.y = -85; unifiedBackground.tint = 0x000000; unifiedBackground.alpha = 0.5; LK.gui.bottom.addChild(unifiedBackground); // Add unit images above recruitment buttons var workerImage = LK.getAsset('worker', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5 }); workerImage.x = -400; workerImage.y = -120; LK.gui.bottom.addChild(workerImage); var warriorImage = LK.getAsset('warrior', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5 }); warriorImage.x = -133; warriorImage.y = -120; LK.gui.bottom.addChild(warriorImage); var wizardImage = LK.getAsset('wizard', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5 }); wizardImage.x = 133; wizardImage.y = -120; LK.gui.bottom.addChild(wizardImage); var archerImage = LK.getAsset('archer', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5 }); archerImage.x = 266; archerImage.y = -120; LK.gui.bottom.addChild(archerImage); var dragonImage = LK.getAsset('dragon', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5 }); dragonImage.x = 400; dragonImage.y = -120; LK.gui.bottom.addChild(dragonImage); // Add texts after backgrounds so they appear on top LK.gui.bottom.addChild(workerButton); LK.gui.bottom.addChild(warriorButton); LK.gui.bottom.addChild(wizardButton); LK.gui.bottom.addChild(archerButton); LK.gui.bottom.addChild(dragonButton); // Initialize towers function initializeTowers() { // Player tower var playerTower = new Tower('player'); playerTower.x = 1024; playerTower.y = 2200; playerTowers.push(playerTower); game.addChild(playerTower); // AI tower var aiTower = new Tower('ai'); aiTower.x = 1024; aiTower.y = 300; aiTowers.push(aiTower); game.addChild(aiTower); } ; function spawnCoin() { // Spawn player coin var playerCoin = new Coin(); playerCoin.x = Math.random() * 1800 + 124; playerCoin.y = Math.random() * 1000 + 1200; // Lower half for player playerCoins_array.push(playerCoin); coins.push(playerCoin); game.addChild(playerCoin); // Spawn AI coin var aiCoin = new Coin(); aiCoin.x = Math.random() * 1800 + 124; aiCoin.y = Math.random() * 1000 + 400; // Upper half for AI aiCoins_array.push(aiCoin); coins.push(aiCoin); game.addChild(aiCoin); } function spawnUnit(team, unitType) { var unit; var cost = unitType === 'worker' ? 5 : unitType === 'warrior' ? 7 : unitType === 'wizard' ? 10 : unitType === 'archer' ? 15 : 20; if (team === 'player' && playerCoins >= cost) { playerCoins -= cost; if (unitType === 'worker') { unit = new Worker('player'); } else { unit = new CombatUnit('player', unitType); } unit.x = playerTowers[0].x + Math.random() * 200 - 100; unit.y = playerTowers[0].y - 100; playerUnits.push(unit); game.addChild(unit); LK.getSound('unitSpawn').play(); } else if (team === 'ai' && aiCoins >= cost) { aiCoins -= cost; if (unitType === 'worker') { unit = new Worker('ai'); } else { unit = new CombatUnit('ai', unitType); } unit.x = aiTowers[0].x + Math.random() * 200 - 100; unit.y = aiTowers[0].y + 100; aiUnits.push(unit); game.addChild(unit); } } function aiLogic() { if (aiActionTimer <= 0) { if (aiCoins >= 20 && Math.random() < 0.1) { spawnUnit('ai', 'dragon'); } else if (aiCoins >= 15 && Math.random() < 0.15) { spawnUnit('ai', 'archer'); } else if (aiCoins >= 10 && Math.random() < 0.2) { spawnUnit('ai', 'wizard'); } else if (aiCoins >= 7 && Math.random() < 0.3) { spawnUnit('ai', 'warrior'); } else if (aiCoins >= 5 && Math.random() < 0.4) { spawnUnit('ai', 'worker'); } aiActionTimer = 120; } aiActionTimer--; } function checkGameEnd() { if (playerTowers.length === 0) { LK.showGameOver(); } else if (aiTowers.length === 0) { LK.showYouWin(); } } function cleanupCollectedCoins() { // Clean up from main coins array for (var i = coins.length - 1; i >= 0; i--) { if (coins[i].collected) { coins[i].destroy(); coins.splice(i, 1); } } // Clean up from player coins array for (var i = playerCoins_array.length - 1; i >= 0; i--) { if (playerCoins_array[i].collected) { playerCoins_array.splice(i, 1); } } // Clean up from AI coins array for (var i = aiCoins_array.length - 1; i >= 0; i--) { if (aiCoins_array[i].collected) { aiCoins_array.splice(i, 1); } } } // Button event handlers workerButton.down = function () { spawnUnit('player', 'worker'); }; warriorButton.down = function () { spawnUnit('player', 'warrior'); }; wizardButton.down = function () { spawnUnit('player', 'wizard'); }; archerButton.down = function () { spawnUnit('player', 'archer'); }; dragonButton.down = function () { spawnUnit('player', 'dragon'); }; // Initialize game initializeTowers(); // Spawn initial workers for both teams var playerWorker = new Worker('player'); playerWorker.x = playerTowers[0].x + 50; playerWorker.y = playerTowers[0].y - 100; playerUnits.push(playerWorker); game.addChild(playerWorker); var aiWorker = new Worker('ai'); aiWorker.x = aiTowers[0].x + 50; aiWorker.y = aiTowers[0].y + 100; aiUnits.push(aiWorker); game.addChild(aiWorker); // Main game loop game.update = function () { // Update coin display coinDisplay.setText('Coins: ' + playerCoins); // Spawn coins coinSpawnTimer++; if (coinSpawnTimer >= 180) { spawnCoin(); coinSpawnTimer = 0; } // AI logic aiLogic(); // Clean up collected coins cleanupCollectedCoins(); // Check game end conditions checkGameEnd(); };
===================================================================
--- original.js
+++ change.js
@@ -1,5 +1,10 @@
/****
+* Plugins
+****/
+var storage = LK.import("@upit/storage.v1");
+
+/****
* Classes
****/
var Coin = Container.expand(function () {
var self = Container.call(this);
@@ -19,13 +24,13 @@
anchorY: 0.5
});
self.team = team;
self.unitType = unitType;
- self.speed = unitType === 'dragon' ? 3 : unitType === 'wizard' ? 1.5 : 2;
- self.damage = unitType === 'dragon' ? 25 : unitType === 'wizard' ? 15 : 10;
- self.health = unitType === 'dragon' ? 60 : unitType === 'wizard' ? 30 : 40;
+ self.speed = unitType === 'dragon' ? 3 : unitType === 'wizard' ? 1.5 : unitType === 'archer' ? 2.5 : 2;
+ self.damage = unitType === 'dragon' ? 25 : unitType === 'wizard' ? 15 : unitType === 'archer' ? 12 : 10;
+ self.health = unitType === 'dragon' ? 60 : unitType === 'wizard' ? 30 : unitType === 'archer' ? 35 : 40;
self.maxHealth = self.health;
- self.attackRange = unitType === 'wizard' ? 100 : 50;
+ self.attackRange = unitType === 'wizard' ? 100 : unitType === 'archer' ? 120 : 50;
self.attackCooldown = 0;
self.target = null;
self.update = function () {
if (self.attackCooldown > 0) {
@@ -213,8 +218,15 @@
});
wizardButton.anchor.set(0.5, 0.5);
wizardButton.x = 133;
wizardButton.y = -50;
+var archerButton = new Text2('Archer (15)', {
+ size: 45,
+ fill: '#ffffff'
+});
+archerButton.anchor.set(0.5, 0.5);
+archerButton.x = 266;
+archerButton.y = -50;
var dragonButton = new Text2('Dragon (20)', {
size: 45,
fill: '#ffffff'
});
@@ -224,9 +236,9 @@
// Add unified black background behind all recruitment buttons and unit images
var unifiedBackground = LK.getAsset('blackBackground', {
anchorX: 0.5,
anchorY: 0.5,
- scaleX: 22.176,
+ scaleX: 24.576,
scaleY: 3.102
});
unifiedBackground.x = 0;
unifiedBackground.y = -85;
@@ -260,8 +272,17 @@
});
wizardImage.x = 133;
wizardImage.y = -120;
LK.gui.bottom.addChild(wizardImage);
+var archerImage = LK.getAsset('archer', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 1.5,
+ scaleY: 1.5
+});
+archerImage.x = 266;
+archerImage.y = -120;
+LK.gui.bottom.addChild(archerImage);
var dragonImage = LK.getAsset('dragon', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
@@ -273,8 +294,9 @@
// Add texts after backgrounds so they appear on top
LK.gui.bottom.addChild(workerButton);
LK.gui.bottom.addChild(warriorButton);
LK.gui.bottom.addChild(wizardButton);
+LK.gui.bottom.addChild(archerButton);
LK.gui.bottom.addChild(dragonButton);
// Initialize towers
function initializeTowers() {
// Player tower
@@ -308,9 +330,9 @@
game.addChild(aiCoin);
}
function spawnUnit(team, unitType) {
var unit;
- var cost = unitType === 'worker' ? 5 : unitType === 'warrior' ? 7 : unitType === 'wizard' ? 10 : 20;
+ var cost = unitType === 'worker' ? 5 : unitType === 'warrior' ? 7 : unitType === 'wizard' ? 10 : unitType === 'archer' ? 15 : 20;
if (team === 'player' && playerCoins >= cost) {
playerCoins -= cost;
if (unitType === 'worker') {
unit = new Worker('player');
@@ -338,8 +360,10 @@
function aiLogic() {
if (aiActionTimer <= 0) {
if (aiCoins >= 20 && Math.random() < 0.1) {
spawnUnit('ai', 'dragon');
+ } else if (aiCoins >= 15 && Math.random() < 0.15) {
+ spawnUnit('ai', 'archer');
} else if (aiCoins >= 10 && Math.random() < 0.2) {
spawnUnit('ai', 'wizard');
} else if (aiCoins >= 7 && Math.random() < 0.3) {
spawnUnit('ai', 'warrior');
@@ -387,8 +411,11 @@
};
wizardButton.down = function () {
spawnUnit('player', 'wizard');
};
+archerButton.down = function () {
+ spawnUnit('player', 'archer');
+};
dragonButton.down = function () {
spawnUnit('player', 'dragon');
};
// Initialize game
Worker. In-Game asset. 2d. High contrast. No shadows
Wizard. In-Game asset. 2d. High contrast. No shadows
Dragon. In-Game asset. 2d. High contrast. No shadows
Warrior. In-Game asset. 2d. High contrast. No shadows
etrafı kırmızı işçi. In-Game asset. 2d. High contrast. No shadows
Archer. In-Game asset. 2d. High contrast. No shadows
Magic. In-Game asset. 2d. High contrast. No shadows
Sadece 1 Altın parçacığı. In-Game asset. 2d. High contrast. No shadows
Köşelerdeki taş yerleri kaldır
Çözünürlüğü artır ve kırmızı şeyleri kaldır. In-Game asset. 2d. High contrast. No shadows
Ağzından ateş püskürtsün
Tam yukarıdan bakılan bir kule clash royaledeki gibi. In-Game asset. 2d. High contrast. No shadows
Mavi yerler kırmızı olsun
Sol tarafında kılıçlar olan start buton. In-Game asset. 2d. High contrast. No shadows
How to play button. In-Game asset. 2d. High contrast. No shadows
Tower defence menü background. In-Game asset. 2d. High contrast. No shadows
Towers On Attack yazısı. In-Game asset. 2d. High contrast. No shadows
Zombie. In-Game asset. 2d. High contrast. No shadows
Normal Mode button. In-Game asset. 2d. High contrast. No shadows
Zombie Mode buton. In-Game asset. 2d. High contrast. No shadows