User prompt
When I have explosive arrows and poison arrows and other combos not all of them seem to elactually afflict the monsters
User prompt
Make it so you can see the lightning and explosions and extra effects that affect other monsters come out of the arrows βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the letters for tye upgrade cards fit in the space of the card
User prompt
Make it so every time the monsters get better the color of them changes
User prompt
Make it so you can not get the same orbital object or special arrow affect twice and increase the varaity of arrow affects and orbital objects
User prompt
The special arrow affects are not working
User prompt
Make the special arrow effects a separate card from the orbital objects
User prompt
Make the orbital objects an extra upgrade card and do damage to monsters
User prompt
Make it so you can have one of the upgrade cards a shield or swords and other things circling around you βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make it so you one of the three cards every round is a special power up like poison arrows explosive arrows etc
User prompt
Move the cards a bit more to the left
User prompt
Center the upgrade cards because I can't see the third one
User prompt
Make it three cards
User prompt
Can you make it so you get 1 random special abilities card every round
User prompt
Make it so the upgrade cards are more centered because I can't see all of the third one βͺπ‘ Consider importing and using the following plugins: @upit/tween.v1
User prompt
I've killed 100 monsters but i am still on waves 1
User prompt
Make the waves shorter
User prompt
Make they waves start short but progressively get longer
User prompt
Make it so the monsters are easier to defeat
Code edit (1 edits merged)
Please save this source code
User prompt
Arcane Archer: Wave Defense
Initial prompt
Create a game where you are an archer and you have to defend against waves of monsters and every round you get to pick one out of a randomly selected 3 abilities from a pool of 100
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { highscore: 0, totalGamesPlayed: 0 }); /**** * Classes ****/ var Arrow = Container.expand(function () { var self = Container.call(this); self.arrowBody = self.attachAsset('arrow', { anchorX: 0, anchorY: 0.5 }); self.arrowHead = self.attachAsset('arrowHead', { anchorX: 0.5, anchorY: 0.5, x: 50 }); self.speed = 15; self.damage = 10; self.pierce = 0; self.pierceCount = 0; self.hitEnemies = []; self.update = function () { self.x += Math.cos(self.rotation) * self.speed; self.y += Math.sin(self.rotation) * self.speed; // Remove if offscreen if (self.x < -100 || self.x > 2148 || self.y < -100 || self.y > 2832) { self.needsRemoval = true; } }; self.canHit = function (monster) { if (self.hitEnemies.indexOf(monster.id) !== -1) { return false; } return true; }; self.hit = function (monster) { self.hitEnemies.push(monster.id); self.pierceCount++; if (self.pierceCount > self.pierce) { self.needsRemoval = true; } }; return self; }); var Monster = Container.expand(function () { var self = Container.call(this); self.id = Date.now() + Math.floor(Math.random() * 10000); self.body = self.attachAsset('monster', { anchorX: 0.5, anchorY: 0.5 }); self.maxHealth = 20; self.health = self.maxHealth; self.speed = 2; self.damage = 10; self.lastAttackTime = 0; self.attackCooldown = 1000; self.update = function () { if (player && !paused) { var dx = player.x - self.x; var dy = player.y - self.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist > 10) { self.x += dx / dist * self.speed; self.y += dy / dist * self.speed; } // Attack player if (dist < 100) { var now = Date.now(); if (now - self.lastAttackTime > self.attackCooldown) { self.lastAttackTime = now; if (player.takeDamage(self.damage)) { LK.getSound('death').play(); gameOver(); } } } } }; self.takeDamage = function (amount) { self.health -= amount; // Flash red when hit LK.effects.flashObject(self, 0xFF0000, 200); LK.getSound('hit').play(); if (self.health <= 0) { return true; } return false; }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); self.body = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.maxHealth = 100; self.health = self.maxHealth; self.attackSpeed = 2; self.lastAttackTime = 0; self.movementSpeed = 0; self.abilities = []; self.shoot = function (targetX, targetY) { var now = Date.now(); if (now - self.lastAttackTime < 1000 / self.attackSpeed) { return null; } self.lastAttackTime = now; var arrow = new Arrow(); arrow.x = self.x; arrow.y = self.y; var angle = Math.atan2(targetY - self.y, targetX - self.x); arrow.rotation = angle; LK.getSound('shoot').play(); return arrow; }; self.takeDamage = function (amount) { self.health -= amount; if (self.health <= 0) { self.health = 0; return true; } return false; }; self.addAbility = function (ability) { self.abilities.push(ability); // Apply ability effects if (ability.type === "attackSpeed") { self.attackSpeed += ability.value; } else if (ability.type === "health") { self.maxHealth += ability.value; self.health = Math.min(self.health + ability.value, self.maxHealth); } else if (ability.type === "arrowDamage") { arrowDamage += ability.value; } else if (ability.type === "arrowPierce") { arrowPierce += ability.value; } else if (ability.type === "arrowSpeed") { arrowSpeed += ability.value; } }; return self; }); var UpgradeCard = Container.expand(function (ability) { var self = Container.call(this); self.ability = ability; self.background = self.attachAsset('upgradeCard', { anchorX: 0.5, anchorY: 0.5 }); self.icon = self.attachAsset('powerIcon', { anchorX: 0.5, anchorY: 0.5, y: -150 }); // Title self.title = new Text2(ability.name, { size: 40, fill: 0x000000 }); self.title.anchor.set(0.5, 0.5); self.title.y = -50; self.addChild(self.title); // Description self.description = new Text2(ability.description, { size: 30, fill: 0x333333 }); self.description.anchor.set(0.5, 0.5); self.description.y = 50; self.addChild(self.description); self.down = function (x, y, obj) { tween(self, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100 }); }; self.up = function (x, y, obj) { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 100, onFinish: function onFinish() { if (player) { player.addAbility(self.ability); hideUpgradeScreen(); startNextWave(); LK.getSound('levelup').play(); } } }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x222222 }); /**** * Game Code ****/ // Game variables var player; var monsters = []; var arrows = []; var upgradeCards = []; var paused = false; var currentWave = 0; var monstersKilled = 0; var lastSpawnTime = 0; var showingUpgrades = false; // Arrow properties var arrowDamage = 20; var arrowPierce = 1; var arrowSpeed = 18; // Abilities pool var abilitiesPool = [{ name: "Quick Shot", description: "Increase attack speed by 15%", type: "attackSpeed", value: 0.15 }, { name: "Heavy Arrow", description: "Increase arrow damage by 5", type: "arrowDamage", value: 5 }, { name: "Fortify", description: "Increase max health by 20", type: "health", value: 20 }, { name: "Piercing Shot", description: "Arrows pierce through one additional enemy", type: "arrowPierce", value: 1 }, { name: "Swift Arrow", description: "Increase arrow speed by 2", type: "arrowSpeed", value: 2 }]; // UI elements var waveText = new Text2("Wave: 1", { size: 60, fill: 0xFFFFFF }); waveText.anchor.set(0.5, 0); LK.gui.top.addChild(waveText); var scoreText = new Text2("Score: 0", { size: 60, fill: 0xFFFFFF }); scoreText.anchor.set(0, 0); scoreText.x = 150; scoreText.y = 10; LK.gui.topLeft.addChild(scoreText); var healthBarBg = LK.getAsset('healthBarBg', { anchorX: 0.5, anchorY: 0.5 }); var healthBar = LK.getAsset('healthBar', { anchorX: 0, anchorY: 0.5 }); healthBarBg.x = 2048 / 2; healthBarBg.y = 50; healthBar.x = healthBarBg.x - 100; healthBar.y = healthBarBg.y; LK.gui.addChild(healthBarBg); LK.gui.addChild(healthBar); var upgradeContainer = new Container(); upgradeContainer.visible = false; LK.gui.addChild(upgradeContainer); var upgradeTitle = new Text2("Choose an Upgrade", { size: 80, fill: 0xFFFFFF }); upgradeTitle.anchor.set(0.5, 0.5); upgradeTitle.x = 2048 / 2; upgradeTitle.y = 200; upgradeContainer.addChild(upgradeTitle); function initGame() { currentWave = 0; monstersKilled = 0; paused = false; showingUpgrades = false; monsters = []; arrows = []; // Initialize player player = new Player(); player.x = 2048 / 2; player.y = 2732 / 2; game.addChild(player); // Reset arrow properties to stronger defaults arrowDamage = 20; arrowPierce = 1; arrowSpeed = 18; // Update UI waveText.setText("Wave: 1"); scoreText.setText("Score: 0"); // Start first wave startNextWave(); // Play music LK.playMusic('gameMusic'); } function startNextWave() { currentWave++; waveText.setText("Wave: " + currentWave); lastSpawnTime = Date.now(); } function spawnMonster() { var monster = new Monster(); // Scale difficulty with wave, but with reduced health to make monsters easier to defeat monster.maxHealth = 10 + currentWave * 3; monster.health = monster.maxHealth; monster.speed = 1.5 + currentWave * 0.05; monster.damage = 5 + currentWave; // Spawn from random edge of screen var side = Math.floor(Math.random() * 4); switch (side) { case 0: // Top monster.x = Math.random() * 2048; monster.y = -100; break; case 1: // Right monster.x = 2148; monster.y = Math.random() * 2732; break; case 2: // Bottom monster.x = Math.random() * 2048; monster.y = 2832; break; case 3: // Left monster.x = -100; monster.y = Math.random() * 2732; break; } monsters.push(monster); game.addChild(monster); return monster; } function showUpgradeScreen() { paused = true; showingUpgrades = true; upgradeContainer.visible = true; // Clear previous upgrade cards for (var i = 0; i < upgradeCards.length; i++) { upgradeCards[i].parent.removeChild(upgradeCards[i]); } upgradeCards = []; // Pick 3 random abilities var availableAbilities = [].concat(abilitiesPool); for (var i = 0; i < 3; i++) { if (availableAbilities.length === 0) break; var index = Math.floor(Math.random() * availableAbilities.length); var ability = availableAbilities.splice(index, 1)[0]; var card = new UpgradeCard(ability); card.x = 2048 / 2 + (i - 1) * 450; card.y = 2732 / 2; upgradeCards.push(card); upgradeContainer.addChild(card); } } function hideUpgradeScreen() { paused = false; showingUpgrades = false; upgradeContainer.visible = false; } function updateHealthBar() { if (player) { var healthPercent = player.health / player.maxHealth; healthBar.width = 200 * healthPercent; } } function gameOver() { // Update high score in storage if (monstersKilled > storage.highscore) { storage.highscore = monstersKilled; } storage.totalGamesPlayed = (storage.totalGamesPlayed || 0) + 1; LK.showGameOver(); } function handleClick(x, y, obj) { if (paused || !player) return; var arrow = player.shoot(x, y); if (arrow) { arrow.damage = arrowDamage; arrow.pierce = arrowPierce; arrow.speed = arrowSpeed; arrows.push(arrow); game.addChild(arrow); } } game.down = handleClick; game.update = function () { if (paused) return; // Spawn monsters var now = Date.now(); var spawnInterval = Math.max(2000 - currentWave * 100, 500); var monstersPerWave = 3 + Math.floor(currentWave * 1.5); // Start with fewer monsters but increase more aggressively if (now - lastSpawnTime > spawnInterval && monsters.length < monstersPerWave) { spawnMonster(); } // Check if wave is complete if (monsters.length === 0 && now - lastSpawnTime > spawnInterval * monstersPerWave) { if (!showingUpgrades) { showUpgradeScreen(); } } // Update arrows for (var i = arrows.length - 1; i >= 0; i--) { if (arrows[i].needsRemoval) { game.removeChild(arrows[i]); arrows.splice(i, 1); continue; } } // Check for collisions for (var i = arrows.length - 1; i >= 0; i--) { var arrow = arrows[i]; for (var j = monsters.length - 1; j >= 0; j--) { var monster = monsters[j]; if (arrow.canHit(monster) && arrow.intersects(monster)) { arrow.hit(monster); if (monster.takeDamage(arrow.damage)) { game.removeChild(monster); monsters.splice(j, 1); monstersKilled++; scoreText.setText("Score: " + monstersKilled); } if (arrow.needsRemoval) { game.removeChild(arrow); arrows.splice(i, 1); break; } } } } // Update health bar updateHealthBar(); }; // Start the game initGame();
===================================================================
--- original.js
+++ change.js
@@ -415,9 +415,9 @@
if (paused) return;
// Spawn monsters
var now = Date.now();
var spawnInterval = Math.max(2000 - currentWave * 100, 500);
- var monstersPerWave = 5 + currentWave;
+ var monstersPerWave = 3 + Math.floor(currentWave * 1.5); // Start with fewer monsters but increase more aggressively
if (now - lastSpawnTime > spawnInterval && monsters.length < monstersPerWave) {
spawnMonster();
}
// Check if wave is complete