Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'cdCnt')' in or related to this line: 'if (--inst.cdCnt <= 0) {' Line Number: 302
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'cdCnt')' in or related to this line: 'if (--inst.cdCnt <= 0) {' Line Number: 304
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'update')' in or related to this line: 'BrickProj.parent.update.call(b);' Line Number: 680
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'update')' in or related to this line: 'BrickProj.parent.update.call(p);' Line Number: 754
User prompt
Please fix the bug: 'ReferenceError: fireWeapon is not defined' in or related to this line: 'fireWeapon(key, inst, meta);' Line Number: 223
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: meta is not defined' in or related to this line: 'if (e.intersectsCircle(arc.x, arc.y, meta.range * inst.rngMul) && e.takeDamage(arc.dmg)) {' Line Number: 383
User prompt
Please fix the bug: 'spawnWave is not defined' in or related to this line: 'spawnWave();' Line Number: 1076
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: dropExpOrb is not defined' in or related to this line: 'dropExpOrb(en.x, en.y, en.expValue);' Line Number: 593
User prompt
Please fix the bug: 'ReferenceError: meta is not defined' in or related to this line: 'if (e.intersectsCircle(arc.x, arc.y, meta.range * inst.rngMul) && e.takeDamage(arc.dmg)) {' Line Number: 383
User prompt
Please fix the bug: 'spawnWave is not defined' in or related to this line: 'spawnWave();' Line Number: 1076
Code edit (1 edits merged)
Please save this source code
User prompt
So let's start writing the code.
User prompt
Let's change the sword's feature. Now the sword is not swinging in the direction my character is looking, but towards the closest enemy. Also, since its range is currently very small, we need to increase its range. We should also change the sword buffs as follows: Sword buffs: 1. Boost) Targets the 2nd closest enemy and swings an additional sword. (Number of swung swords increases from 1 to 2) (If there is no 2nd enemy, targets the 1st enemy) 2. Boost) Targets the 3rd closest enemy and swings an additional sword. (Number of swung swords increases from 2 to 3) (If there is no 3rd enemy, targets the 1st enemy) 3. Boost) Targets the 4th closest enemy and swings an additional sword. (Number of swung swords increases from 3 to 4) (If there is no 4th enemy, targets the 1st enemy)
User prompt
I don't think my character has a sword right now. The sword should be swung in the direction my character is looking at every 2 seconds and if it hits an enemy it should deal damage.
User prompt
We are going to make a huge update now! Read carefully and try to analyze and understand thoroughly. There will be nine different weapon types in the game. Each weapon will have its own unique enchantments and upgrades. Whenever my character levels up (except on the level-5 milestones), three random choices will appear, each containing an enchantment for the weapon currently in hand. Whenever my character reaches a multiple of five levels, three random weapon choices will appear; if my character already owns the weapon shown, that choice will count as an upgrade for the existing weapon. Weapon upgrades unlock sequentially—first Upgrade 1, then Upgrade 2, then Upgrade 3. If all possible enchantments or upgrades for that weapon have already been acquired, then on level-up the character’s health is restored by 30%. In addition, each time the character levels up, maximum health increases by +10. My character starts the game with the sword. Below is more detailed information about weapons, enchantments, and upgrades. Sword: The character swings the sword in the direction they are facing at specific intervals (once every 2 seconds). It has a short range. Enemies struck by the swinging sword take damage. Sword Enchantments: Option 1) +10% Damage Increase Option 2) +10% Attack Speed Increase Option 3) +10% Range Increase Option 4) +10% Size Increase Sword Upgrades: Upgrade 1) The character also swings the sword behind themselves at the same intervals. Upgrade 2) The character also swings the sword upwards at the same intervals. Upgrade 3) The character also swings the sword downwards at the same intervals. Boomerang: Throws a boomerang at the nearest enemy. The boomerang follows a circular arc and then returns to the character. As it travels, it damages any enemies it hits. It is thrown once every 3 seconds. It has a long range. Boomerang Enchantments: Option 1) +10% Damage Increase Option 2) +10% Attack Speed Increase Option 3) +10% Range Increase Option 4) +10% Size Increase Boomerang Upgrades: Upgrade 1) Throws an additional boomerang targeting the second-closest enemy. (Boomerang count increases from 1 to 2.) (If no second enemy exists, the additional boomerang targets the closest enemy.) Upgrade 2) Throws an additional boomerang targeting the third-closest enemy. (Boomerang count increases from 2 to 3.) (If no third enemy exists, the additional boomerang targets the closest enemy.) Upgrade 3) Throws an additional boomerang targeting the fourth-closest enemy. (Boomerang count increases from 3 to 4.) (If no fourth enemy exists, the additional boomerang targets the closest enemy.) Ball: Every 3 seconds, throws a ball at the nearest enemy within its range. The ball can bounce once and deal damage to an enemy, then disappears once it exits the screen. As it travels, it damages any enemies it collides with. It has a long range. Ball Enchantments: Option 1) +10% Damage Increase Option 2) +10% Attack Speed Increase Option 3) +10% Range Increase Option 4) +10% Size Increase Ball Upgrades: Upgrade 1) Throws an additional ball at the second-closest enemy. (Ball count increases from 1 to 2.) (If no second enemy exists, the additional ball targets the closest enemy.) Upgrade 2) Throws an additional ball at the third-closest enemy. (Ball count increases from 2 to 3.) (If no third enemy exists, the additional ball targets the closest enemy.) Upgrade 3) Throws an additional ball at the fourth-closest enemy. (Ball count increases from 3 to 4.) (If no fourth enemy exists, the additional ball targets the closest enemy.) Rocket: Every 3 seconds, launches a rocket at the nearest enemy within its range. Range is moderate. When the rocket hits its target, it deals area damage in a circular radius around that enemy (i.e., it is an AoE rocket). Rocket Enchantments: Option 1) +10% Damage Increase Option 2) +10% Attack Speed Increase Option 3) +10% Range Increase Option 4) +10% Size Increase Rocket Upgrades: Upgrade 1) Launches an additional rocket at the second-closest enemy. (Rocket count increases from 1 to 2.) (If no second enemy exists, that additional rocket targets the closest enemy.) Upgrade 2) Launches an additional rocket at the third-closest enemy. (Rocket count increases from 2 to 3.) (If no third enemy exists, that additional rocket targets the closest enemy.) Upgrade 3) Launches an additional rocket at the fourth-closest enemy. (Rocket count increases from 3 to 4.) (If no fourth enemy exists, that additional rocket targets the closest enemy.) Brick: Throws a brick at a 75° angle in the direction the character is facing. After the brick is thrown, it falls downward as if affected by gravity, and disappears once it leaves the screen. As it travels, it damages any enemies it collides with. Bricks are thrown once every 3 seconds. Brick Enchantments: Option 1) +10% Damage Increase Option 2) +10% Attack Speed Increase Option 3) +10% Range Increase Option 4) +10% Size Increase Brick Upgrades: Upgrade 1) Also throws a second brick at a 75° angle behind the direction the character is facing. (Total of 2 bricks per throw.) Upgrade 2) Also throws a second brick at a 45° angle in the same direction the character is facing. (Total of 3 bricks per throw.) Upgrade 3) Also throws a second brick at a 45° angle behind the direction the character is facing. (Total of 4 bricks per throw.) Lightning: Summons a lightning strike on a random enemy on the screen. Lightning strikes once every 3 seconds. Lightning Enchantments: Option 1) +10% Damage Increase Option 2) +10% Attack Speed Increase Option 3) +10% Range Increase Option 4) +10% Size Increase Lightning Upgrades: Upgrade 1) Increases the number of lightning strikes from 1 to 2. (Multiple strikes can hit the same enemy.) Upgrade 2) Increases the number of lightning strikes from 2 to 3. (Multiple strikes can hit the same enemy.) Upgrade 3) Increases the number of lightning strikes from 3 to 4. (Multiple strikes can hit the same enemy.) Aura: Creates a small circular aura that constantly surrounds the character. Any enemy that touches this aura takes damage. Aura Enchantments: Option 1) +10% Damage Increase Option 2) +10% Attack Speed Increase Option 3) +10% Range Increase Option 4) +10% Size Increase Aura Upgrades: Upgrade 1) Enemies that enter the aura’s range are slowed by 25%. Upgrade 2) Enemies that enter the aura’s range are slowed by 50%. Upgrade 3) Enemies that enter the aura’s range are slowed by 75%. Molotov: Randomly throws a Molotov cocktail into a circular area. There is a 3-second cooldown. When Molotovs hit the ground, they shatter and ignite a small circular area on fire for 1 second. Any enemy that enters this burning area takes damage. Molotov Enchantments: Option 1) +10% Damage Increase Option 2) +10% Attack Speed Increase Option 3) +10% Range Increase Option 4) +10% Size Increase Molotov Upgrades: Upgrade 1) Increases the number of Molotovs thrown from 1 to 2. Upgrade 2) Increases the number of Molotovs thrown from 2 to 3. Upgrade 3) Increases the number of Molotovs thrown from 3 to 4. Shuriken: Within a short radius around the character, two regular-speed shurikens spin for 3 seconds at a time (each shuriken positioned at equal angular separation—if there are two, they are 180° apart). These shurikens rotate around the character and deal damage to any enemy they hit. Shuriken Enchantments: Option 1) +10% Damage Increase Option 2) +10% Attack Speed Increase Option 3) +10% Range Increase Option 4) +10% Size Increase Shuriken Upgrades: Upgrade 1) Increases the shuriken count from 2 to 3. (Shurikens should be evenly spaced—120° apart when there are three.) Upgrade 2) Increases the shuriken count from 3 to 4. (Shurikens should be evenly spaced—90° apart when there are four.) Upgrade 3) Increases the shuriken count from 4 to 5. (Shurikens should be evenly spaced—72° apart when there are five.) I want you to revise the code according to what I explained above. Think carefully.
User prompt
Currently when I level up and choose a upgrade (while choosing a upgrade) the enemies don't stop and keep moving, so when I choose my buff late the enemies get too close to my character and I die. While my character chooses a buff the enemies shouldn't move and shouldn't attack. After my character chooses his buff the enemies can move and attack. Also the magnet and bomb should be much rarer to be created.
User prompt
There should be a bomb that appears randomly on the map and when my character picks up that bomb, all enemies on the current screen (except bosses) should die by eating them one by one. Also, a magnet should appear randomly on the map and when my character picks up that magnet, it should quickly pull all XPs on the current screen towards itself. Also, right now, the game doesn't stop when my character is choosing a power-up and the enemies continue to advance towards my character. Also, don't allow the same power-up to appear more than once when choosing a power-up, I mean when I'm going to choose one of the three power-ups, sometimes two of the three power-ups are the same and I don't want that, each power-up should be different.
User prompt
Do not allow more than 30 enemies on screen at once. There cannot be more than 30 enemies on screen at once.
User prompt
Enemies are currently spawning very close to my character. Enemies should spawn slightly off screen and come towards me. Also enemies are currently spawning very frequently, enemies should spawn less frequently. Also my joystick button is currently too low, I need to move it up a bit.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Bomb = Container.expand(function () { var self = Container.call(this); self.active = true; var bombGraphics = self.attachAsset('bomb', { anchorX: 0.5, anchorY: 0.5, width: 60, height: 60, tint: 0xff0000 }); self.update = function () { if (!player || !self.active) return; var dx = player.x - self.x; var dy = player.y - self.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist < 80) { self.active = false; // Kill all non-boss enemies on screen for (var i = enemies.length - 1; i >= 0; i--) { var enemy = enemies[i]; if (enemy.type !== 'boss') { var screenDx = Math.abs(enemy.x - player.x); var screenDy = Math.abs(enemy.y - player.y); if (screenDx < 1024 && screenDy < 1366) { dropExpOrb(enemy.x, enemy.y, enemy.expValue); enemy.destroy(); enemies.splice(i, 1); } } } LK.effects.flashScreen(0xff0000, 300); self.destroy(); return true; } }; return self; }); var Bullet = Container.expand(function () { var self = Container.call(this); self.damage = 10; self.speed = 15; self.dirX = 0; self.dirY = 0; self.piercing = 1; self.hitEnemies = []; var bulletGraphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.x += self.dirX * self.speed; self.y += self.dirY * self.speed; }; return self; }); var Enemy = Container.expand(function () { var self = Container.call(this); self.hp = 20; self.maxHp = 20; self.damage = 10; self.speed = 2; self.expValue = 5; self.type = 'normal'; var enemyGraphics = self.attachAsset('zombie', { anchorX: 0.5, anchorY: 0.5 }); self.takeDamage = function (amount) { self.hp -= amount; LK.effects.flashObject(self, 0xffffff, 100); if (self.hp <= 0) { dropExpOrb(self.x, self.y, self.expValue); return true; } return false; }; self.update = function () { if (!player || skillSelectionActive) return; var dx = player.x - self.x; var dy = player.y - self.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist > 0) { self.x += dx / dist * self.speed; self.y += dy / dist * self.speed; } }; return self; }); var TankZombie = Enemy.expand(function () { var self = Enemy.call(this); self.hp = 60; self.maxHp = 60; self.damage = 20; self.speed = 1; self.expValue = 15; self.type = 'tank'; var graphics = self.attachAsset('tankZombie', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var FastZombie = Enemy.expand(function () { var self = Enemy.call(this); self.hp = 15; self.maxHp = 15; self.damage = 8; self.speed = 4; self.expValue = 8; self.type = 'fast'; var graphics = self.attachAsset('fastZombie', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Boss = Enemy.expand(function () { var self = Enemy.call(this); self.hp = 500; self.maxHp = 500; self.damage = 30; self.speed = 1.5; self.expValue = 100; self.type = 'boss'; var graphics = self.attachAsset('boss', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var ExpOrb = Container.expand(function () { var self = Container.call(this); self.value = 5; self.magnetSpeed = 0; var orbGraphics = self.attachAsset('expOrb', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { if (!player || self.magnetSpeed === 0) return; var dx = player.x - self.x; var dy = player.y - self.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist > 0) { self.x += dx / dist * self.magnetSpeed; self.y += dy / dist * self.magnetSpeed; } }; return self; }); var Joystick = Container.expand(function () { var self = Container.call(this); self.active = false; self.dirX = 0; self.dirY = 0; var base = self.attachAsset('joystickBase', { anchorX: 0.5, anchorY: 0.5 }); base.alpha = 0.5; var knob = self.attachAsset('joystickKnob', { anchorX: 0.5, anchorY: 0.5 }); knob.alpha = 0.7; self.setKnobPosition = function (x, y) { var dx = x - base.x; var dy = y - base.y; var dist = Math.sqrt(dx * dx + dy * dy); var maxDist = 60; if (dist > maxDist) { dx = dx / dist * maxDist; dy = dy / dist * maxDist; } knob.x = dx; knob.y = dy; self.dirX = dx / maxDist; self.dirY = dy / maxDist; }; self.reset = function () { knob.x = 0; knob.y = 0; self.dirX = 0; self.dirY = 0; self.active = false; }; return self; }); var Magnet = Container.expand(function () { var self = Container.call(this); self.active = true; var magnetGraphics = self.attachAsset('magnet', { anchorX: 0.5, anchorY: 0.5, width: 60, height: 60, tint: 0x0099ff }); self.update = function () { if (!player || !self.active) return; var dx = player.x - self.x; var dy = player.y - self.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist < 80) { self.active = false; // Magnetize all exp orbs on screen for (var i = 0; i < expOrbs.length; i++) { var orb = expOrbs[i]; var orbDx = Math.abs(orb.x - player.x); var orbDy = Math.abs(orb.y - player.y); if (orbDx < 1024 && orbDy < 1366) { orb.magnetSpeed = 20; } } self.destroy(); return true; } }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); self.level = 1; self.exp = 0; self.expToNext = 10; self.hp = 100; self.maxHp = 100; self.damage = 10; self.fireRate = 30; self.bulletSpeed = 15; self.moveSpeed = 5; self.pickupRange = 100; self.lastFire = 0; var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.takeDamage = function (amount) { self.hp -= amount; LK.effects.flashObject(self, 0xff0000, 300); if (self.hp <= 0) { LK.showGameOver(); } }; self.gainExp = function (amount) { self.exp += amount; if (self.exp >= self.expToNext) { self.levelUp(); } }; self.levelUp = function () { self.level++; self.exp = 0; self.expToNext = self.level * 15; self.maxHp += 10; self.hp = self.maxHp; LK.getSound('levelup').play(); showSkillSelection(); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x111111 }); /**** * Game Code ****/ var player; var enemies = []; var bullets = []; var expOrbs = []; var joystick; var gameTime = 0; var waveNumber = 1; var bossSpawned = false; var selectedSkills = []; var camera = { x: 0, y: 0 }; var gameContainer; var skillSelectionActive = false; var pickups = []; var lastPickupSpawn = 0; // Initialize game world gameContainer = game.addChild(new Container()); // Create player player = gameContainer.addChild(new Player()); player.x = 1024; player.y = 1366; // Create joystick joystick = new Joystick(); joystick.x = 0; joystick.y = -200; LK.gui.bottom.addChild(joystick); // UI Elements var timerText = new Text2('15:00', { size: 80, fill: 0xFFFFFF }); timerText.anchor.set(0.5, 0); LK.gui.top.addChild(timerText); var levelText = new Text2('Level 1', { size: 60, fill: 0xFFFF00 }); levelText.anchor.set(0, 0); levelText.y = 100; LK.gui.top.addChild(levelText); var hpText = new Text2('HP: 100/100', { size: 60, fill: 0xFF0000 }); hpText.anchor.set(1, 0); hpText.y = 100; LK.gui.top.addChild(hpText); // Spawn functions function spawnEnemy(type, x, y) { var enemy; switch (type) { case 'fast': enemy = new FastZombie(); break; case 'tank': enemy = new TankZombie(); break; case 'boss': enemy = new Boss(); break; default: enemy = new Enemy(); } enemy.x = x; enemy.y = y; enemies.push(enemy); gameContainer.addChild(enemy); } function spawnWave() { var spawnCount = 5 + waveNumber * 2; var spawnRadius = 1500; for (var i = 0; i < spawnCount; i++) { // Check if we've reached the enemy limit if (enemies.length >= 30) { break; } var angle = Math.random() * Math.PI * 2; var x = player.x + Math.cos(angle) * spawnRadius; var y = player.y + Math.sin(angle) * spawnRadius; var type = 'normal'; if (waveNumber > 5 && Math.random() < 0.3) type = 'fast'; if (waveNumber > 10 && Math.random() < 0.2) type = 'tank'; spawnEnemy(type, x, y); } } function dropExpOrb(x, y, value) { var orb = new ExpOrb(); orb.x = x; orb.y = y; orb.value = value; expOrbs.push(orb); gameContainer.addChild(orb); } function fireBullet() { if (enemies.length === 0) return; // Find nearest enemy var nearestEnemy = null; var nearestDist = Infinity; for (var i = 0; i < enemies.length; i++) { var enemy = enemies[i]; var dx = enemy.x - player.x; var dy = enemy.y - player.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist < nearestDist) { nearestDist = dist; nearestEnemy = enemy; } } if (nearestEnemy) { var bullet = new Bullet(); bullet.x = player.x; bullet.y = player.y; bullet.damage = player.damage; bullet.speed = player.bulletSpeed; var dx = nearestEnemy.x - player.x; var dy = nearestEnemy.y - player.y; var dist = Math.sqrt(dx * dx + dy * dy); bullet.dirX = dx / dist; bullet.dirY = dy / dist; bullets.push(bullet); gameContainer.addChild(bullet); LK.getSound('shoot').play(); } } function showSkillSelection() { skillSelectionActive = true; var overlay = game.addChild(new Container()); overlay.x = 1024; overlay.y = 1366; var skillOptions = [{ name: "Damage +20%", effect: function effect() { player.damage *= 1.2; } }, { name: "Fire Rate +20%", effect: function effect() { player.fireRate *= 0.8; } }, { name: "Move Speed +20%", effect: function effect() { player.moveSpeed *= 1.2; } }, { name: "Max HP +30", effect: function effect() { player.maxHp += 30; player.hp += 30; } }, { name: "Bullet Speed +30%", effect: function effect() { player.bulletSpeed *= 1.3; } }]; // Shuffle and pick 3 unique skills var shuffled = []; for (var j = 0; j < skillOptions.length; j++) { shuffled.push(skillOptions[j]); } for (var j = shuffled.length - 1; j > 0; j--) { var randomIndex = Math.floor(Math.random() * (j + 1)); var temp = shuffled[j]; shuffled[j] = shuffled[randomIndex]; shuffled[randomIndex] = temp; } for (var i = 0; i < 3 && i < shuffled.length; i++) { var card = overlay.addChild(new Container()); var bg = card.attachAsset('skillCard', { anchorX: 0.5, anchorY: 0.5 }); card.x = (i - 1) * 450; card.y = 0; var selectedSkill = shuffled[i]; var text = new Text2(selectedSkill.name, { size: 40, fill: 0xFFFFFF }); text.anchor.set(0.5, 0.5); card.addChild(text); card.skillEffect = selectedSkill.effect; card.overlay = overlay; card.down = function () { this.skillEffect(); this.overlay.destroy(); skillSelectionActive = false; levelText.setText('Level ' + player.level); }; } } // Input handling game.down = function (x, y, obj) { if (skillSelectionActive) return; var localPos = game.toLocal({ x: x, y: y }); if (localPos.y > 2000) { joystick.active = true; joystick.setKnobPosition(0, 0); } }; game.move = function (x, y, obj) { if (!joystick.active || skillSelectionActive) return; var localPos = LK.gui.bottom.toLocal({ x: x, y: y }); var dx = localPos.x - joystick.x; var dy = localPos.y - joystick.y; joystick.setKnobPosition(dx, dy); }; game.up = function (x, y, obj) { joystick.reset(); }; // Game update game.update = function () { if (skillSelectionActive) return; gameTime++; // Update timer var timeLeft = 900 - Math.floor(gameTime / 60); if (timeLeft <= 0) { LK.showYouWin(); return; } var minutes = Math.floor(timeLeft / 60); var seconds = timeLeft % 60; timerText.setText(minutes + ':' + (seconds < 10 ? '0' : '') + seconds); // Update UI hpText.setText('HP: ' + player.hp + '/' + player.maxHp); // Player movement if (joystick.active) { player.x += joystick.dirX * player.moveSpeed; player.y += joystick.dirY * player.moveSpeed; } // Camera follow player camera.x = player.x - 1024; camera.y = player.y - 1366; gameContainer.x = -camera.x; gameContainer.y = -camera.y; // Spawn waves if (gameTime % 300 === 0) { waveNumber++; spawnWave(); } // Spawn boss every 3 minutes if (gameTime % (180 * 60) === 0 && !bossSpawned && enemies.length < 30) { spawnEnemy('boss', player.x + 400, player.y); bossSpawned = true; } // Auto fire if (gameTime - player.lastFire > player.fireRate) { fireBullet(); player.lastFire = gameTime; } // Update bullets for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; // Check if off screen var dx = Math.abs(bullet.x - player.x); var dy = Math.abs(bullet.y - player.y); if (dx > 1200 || dy > 1600) { bullet.destroy(); bullets.splice(i, 1); continue; } // Check collisions with enemies for (var j = enemies.length - 1; j >= 0; j--) { var enemy = enemies[j]; if (bullet.hitEnemies.indexOf(enemy) === -1 && bullet.intersects(enemy)) { bullet.hitEnemies.push(enemy); if (enemy.takeDamage(bullet.damage)) { enemy.destroy(); enemies.splice(j, 1); LK.getSound('hit').play(); } if (bullet.hitEnemies.length >= bullet.piercing) { bullet.destroy(); bullets.splice(i, 1); break; } } } } // Update enemies for (var i = enemies.length - 1; i >= 0; i--) { var enemy = enemies[i]; if (enemy.intersects(player)) { player.takeDamage(enemy.damage); enemy.destroy(); enemies.splice(i, 1); } } // Update exp orbs for (var i = expOrbs.length - 1; i >= 0; i--) { var orb = expOrbs[i]; var dx = orb.x - player.x; var dy = orb.y - player.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist < player.pickupRange) { orb.magnetSpeed = 10; } if (orb.intersects(player)) { player.gainExp(orb.value); orb.destroy(); expOrbs.splice(i, 1); LK.getSound('pickup').play(); } } // Spawn pickups randomly if (gameTime - lastPickupSpawn > 1800 && Math.random() < 0.1) { lastPickupSpawn = gameTime; var pickup; var angle = Math.random() * Math.PI * 2; var distance = 300 + Math.random() * 500; var pickupX = player.x + Math.cos(angle) * distance; var pickupY = player.y + Math.sin(angle) * distance; if (Math.random() < 0.5) { pickup = new Bomb(); } else { pickup = new Magnet(); } pickup.x = pickupX; pickup.y = pickupY; pickups.push(pickup); gameContainer.addChild(pickup); } // Update pickups for (var i = pickups.length - 1; i >= 0; i--) { var pickup = pickups[i]; if (!pickup.active) { pickups.splice(i, 1); } } }; // Initial spawn spawnWave();
===================================================================
--- original.js
+++ change.js
@@ -83,9 +83,9 @@
}
return false;
};
self.update = function () {
- if (!player) return;
+ if (!player || skillSelectionActive) return;
var dx = player.x - self.x;
var dy = player.y - self.y;
var dist = Math.sqrt(dx * dx + dy * dy);
if (dist > 0) {
@@ -592,9 +592,9 @@
LK.getSound('pickup').play();
}
}
// Spawn pickups randomly
- if (gameTime - lastPickupSpawn > 600 && Math.random() < 0.3) {
+ if (gameTime - lastPickupSpawn > 1800 && Math.random() < 0.1) {
lastPickupSpawn = gameTime;
var pickup;
var angle = Math.random() * Math.PI * 2;
var distance = 300 + Math.random() * 500;
Survivor.io style 2D sword swing effect made by HABBY PTE. LTD.. In-Game asset. 2d. High contrast. No shadows. It should only have a slash effect, no swords. The slash effect should also be in the shape of a half moon.
Survivor.io style 2D round soccer ball made by HABBY PTE. LTD.. In-Game asset. 2d. High contrast. No shadows
A 2D Survivor.io style lightning strike from a cloud in the sky to the ground, made by HABBY PTE. LTD.. In-Game asset. 2d. High contrast. No shadows
A red and blue Survivor.io style 2D U-shaped (with N and S) magnet made by HABBY PTE. LTD.. In-Game asset. 2d. High contrast. No shadows
Survivor.io style 2D shuriken made by HABBY PTE. LTD.. In-Game asset. 2d. High contrast. No shadows
Survivor.io style 2D brick made by HABBY PTE. LTD.. In-Game asset. 2d. High contrast. No shadows
Survivor.io style 2D missile rocket made by HABBY PTE. LTD.
A 2D green radiating circular aura in the Survivor.io style made by HABBY PTE. LTD.. In-Game asset. 2d. High contrast. No shadows
A 2D bomb in the style of Survivor.io, made by HABBY PTE. LTD.. In-Game asset. 2d. High contrast. No shadows
A 2D circular burning effect in Survivor.io style made by HABBY PTE. LTD. (not only the surroundings but also the inside burns) In-Game asset. 2d. High contrast. No shadows
A 2D molotov in the Survivor.io style made by HABBY PTE. LTD.. In-Game asset. 2d. High contrast. No shadows
Survivor.io style 2D greenish exp sphere made by HABBY PTE. LTD. No exp written on it. In-Game asset. 2d. High contrast. No shadows
Survivor.io style 2D half-moon orange boomerang made by HABBY PTE. LTD. In-Game asset. 2d. High contrast. No shadows
Survivor.io style 2D 1 chicken leg.. In-Game asset. 2d. High contrast. No shadows
2D survivor.io game style atomic boom effect front view. No text written on it.
2D. Ranged zombie. attacks with poisonous saliva. In-Game asset. 2d. High contrast. No shadows
2D. Child (small) zombie. He has a small saw in his hand.. In-Game asset. 2d. High contrast. No shadows
2D. Fat zombie. His hands are too big.. In-Game asset. 2d. High contrast. No shadows
Poisonous green circular saliva. 2D. Top View.. In-Game asset. 2d. High contrast. No shadows
Small green claw slash effect. 2D. Top View.. In-Game asset. 2d. High contrast. No shadows
Giant boss angry reddish zombie. 2D.. In-Game asset. 2d. High contrast. No shadows
Small saw slash effect. 2D. Top View.. In-Game asset. 2d. High contrast. No shadows
Big red fist slash effect. 2D. Top View.. In-Game asset. 2d. High contrast. No shadows
Kanlı kemik 2D. Top View.. In-Game asset. 2d. High contrast. No shadows
2D character that looks like a prophet and holds a holy book in his hand.. In-Game asset. 2d. High contrast. No shadows
A background image (wallpaper) representing an old prophet-like man with white hair and beard, wearing a priest's robe (hooded) and holding a holy book (christianity, cross) in his hand, fighting against zombies.. In-Game asset. 2d. High contrast. No shadows
Zombie flesh and bone themed 2D cardboard hollow (without text) horizontal rectangular button.. In-Game asset. 2d. High contrast. No shadows
2D. Healer zombie. Like a female zombie in a healer costume.. In-Game asset. 2d. High contrast. No shadows
2D. Brain illustrated healing potion.. In-Game asset. 2d. High contrast. No shadows
A healing blood pool with circular zombie brain and bone particles. Green + (healing) symbols on top. 2D.. In-Game asset. 2d. High contrast. No shadows
2D. Survivor.io game style skill card. No text written on it. No symbols on it. Just the blank card. Green.. In-Game asset. 2d. High contrast. No shadows
2D. Cartoon. The rise of the zombie ghost spirit from the ground.. In-Game asset. 2d. High contrast. No shadows
levelup
Sound effect
hit
Sound effect
rocketBoom
Sound effect
pickup
Sound effect
backGroundMusic
Music
death
Sound effect
damageTaken
Sound effect
mainMenuMusic
Music
deathScreenMusic
Music
swordSoundEffect
Sound effect
bumerangSoundEffect
Sound effect
brickSoundEffect
Sound effect
lightningSoundEffect
Sound effect
ballSoundEffect
Sound effect
rocketSoundEffect
Sound effect
auraSoundEffect
Sound effect
molotovSoundEffect
Sound effect
molotovBoom
Sound effect
introSpeech
Sound effect
bombBoomSound
Sound effect