User prompt
que los objetos jiren y se muevan ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que el fondo del menu tenga obgetos girando por la pantalla ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'ReferenceError: scoreTxt is not defined' in or related to this line: 'scoreTxt.setText('Score: ' + LK.getScore());' Line Number: 1576
User prompt
Please fix the bug: 'Uncaught ReferenceError: waveTxt is not defined' in or related to this line: 'waveTxt.setText('Wave: ' + currentWave);' Line Number: 1360
User prompt
Please fix the bug: 'LK.setSoundVolume is not a function' in or related to this line: 'LK.setSoundVolume(gameOptions.soundVolume / 100);' Line Number: 606
User prompt
Please fix the bug: 'storage.get is not a function' in or related to this line: 'var savedOptions = storage.get('gameOptions');' Line Number: 583 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
has funsionar las obciones
User prompt
Please fix the bug: 'Uncaught ReferenceError: waveTxt is not defined' in or related to this line: 'waveTxt.setText('Wave: ' + currentWave);' Line Number: 1124
User prompt
crea un menu con las obciones de jugar creditos y obciones
User prompt
que el menu tenga jugar obciones y creditos
User prompt
que haya un menu prinsipal
User prompt
que haya un menu prinsipal con los botones obciones de sonido empesar y creditos.ademas de que el fondo sea de cascos espadas y escudos
User prompt
que cada 5 ordas haya un jefe final que al morir nos de un multiplicador por 5 de daño por 3 rondas ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que la piedra sean ataques infinitos ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que la piedra se dirija al enrmigo apenas se presione el boton ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que haya un ataque que sea lejano que lanse una piedra teledirigida ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que cada 100000 de puntage lanse confeti y le triplique el daño a la foca por 10 segundos ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
y que ademas de curar a la foca le de un escudo que dure 5 segundos y le de imunidad ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
cada fin de una horda se le dara a la foca un pescado para curarse ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
los ataques tienen que ser instantaneos apenas toque el boton ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que al atacar no se aga daño por 3 segundos ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que tengan botones rojos por ataque
User prompt
que cada ataque tenga distintas animaciones ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que cada ataque se actibe con un boton en la pantalla
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of null (reading 'takeDamage')' in or related to this line: 'target.takeDamage(attack.damage);' Line Number: 188
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var HealthBar = Container.expand(function (maxHealth) { var self = Container.call(this); self.maxHealth = maxHealth || 100; self.currentHealth = self.maxHealth; var bgBar = self.attachAsset('healthBarBg', { anchorX: 0.5, anchorY: 0.5 }); var healthBar = self.attachAsset('healthBar', { anchorX: 0, anchorY: 0.5, x: -50 }); self.updateHealth = function (health) { self.currentHealth = Math.max(0, health); var healthPercent = self.currentHealth / self.maxHealth; healthBar.width = 100 * healthPercent; if (healthPercent > 0.6) { healthBar.tint = 0x00FF00; // Green } else if (healthPercent > 0.3) { healthBar.tint = 0xFFFF00; // Yellow } else { healthBar.tint = 0xFF0000; // Red } }; return self; }); var Seal = Container.expand(function (isPlayer) { var self = Container.call(this); self.isPlayer = isPlayer || false; self.maxHealth = 100; self.currentHealth = self.maxHealth; self.attackDamage = 25; self.speed = 3; self.lastAttackTime = 0; self.attackCooldown = 1000; // 1 second self.isInvincible = false; self.invincibilityDuration = 3000; // 3 seconds var sealBody = self.attachAsset(isPlayer ? 'playerSeal' : 'enemySeal', { anchorX: 0.5, anchorY: 0.5 }); self.healthBar = self.addChild(new HealthBar(self.maxHealth)); self.healthBar.y = -80; self.takeDamage = function (damage) { // Check if invincible if (self.isInvincible) { return; // No damage during invincibility } self.currentHealth -= damage; self.healthBar.updateHealth(self.currentHealth); // Flash effect when taking damage LK.effects.flashObject(self, 0xFFFFFF, 200); if (self.currentHealth <= 0) { self.die(); } }; self.die = function () { LK.getSound('defeat').play(); self.isDead = true; // Death animation tween(self, { alpha: 0, scaleX: 0.5, scaleY: 0.5 }, { duration: 500, onFinish: function onFinish() { if (self.parent) { self.destroy(); } } }); }; // Attack system properties self.currentAttack = 0; // 0-4 for different attacks self.isCharging = false; self.chargeStartTime = 0; self.chargingIndicator = null; // Define 5 different attacks with different charge times and effects self.attackTypes = [{ name: 'Quick Strike', chargeTime: 200, // 0.2 seconds damage: 15, color: 0xFFFF00, scale: 1.1 }, { name: 'Power Slam', chargeTime: 800, // 0.8 seconds damage: 35, color: 0xFF4500, scale: 1.3 }, { name: 'Spinning Attack', chargeTime: 1200, // 1.2 seconds damage: 45, color: 0x9932CC, scale: 1.4 }, { name: 'Devastating Blow', chargeTime: 2000, // 2 seconds damage: 60, color: 0xFF0000, scale: 1.6 }, { name: 'Ultimate Strike', chargeTime: 3000, // 3 seconds damage: 80, color: 0x00FFFF, scale: 1.8 }]; self.startCharging = function () { if (self.isCharging) return; self.isCharging = true; self.chargeStartTime = Date.now(); // Create charging indicator if (!self.chargingIndicator) { self.chargingIndicator = self.addChild(LK.getAsset('healthBar', { anchorX: 0.5, anchorY: 0.5, y: -100, width: 0, height: 8 })); } var attack = self.attackTypes[self.currentAttack]; self.chargingIndicator.tint = attack.color; self.chargingIndicator.visible = true; // Animate charging indicator tween(self.chargingIndicator, { width: 120 }, { duration: attack.chargeTime, easing: tween.linear }); // Charging visual effect on seal tween(self, { tint: attack.color }, { duration: attack.chargeTime / 4, easing: tween.easeInOut }); }; self.releaseAttack = function (target) { if (!self.isCharging) return; var currentTime = Date.now(); var chargeTime = currentTime - self.chargeStartTime; var attack = self.attackTypes[self.currentAttack]; // Stop charging self.isCharging = false; if (self.chargingIndicator) { self.chargingIndicator.visible = false; tween.stop(self.chargingIndicator); } // Reset seal color tween.stop(self); tween(self, { tint: 0xFFFFFF }, { duration: 200 }); // Check if we have a valid target before attacking if (!target) return; // Check if charge time was sufficient if (chargeTime >= attack.chargeTime) { // Full power attack target.takeDamage(attack.damage); LK.getSound('hit').play(); // Attack animation based on attack type if (self.currentAttack === 0) { // Quick Strike - Fast dart forward var originalX = self.x; var originalY = self.y; var angle = Math.atan2(target.y - self.y, target.x - self.x); tween(self, { x: self.x + Math.cos(angle) * 30, y: self.y + Math.sin(angle) * 30, scaleX: attack.scale, scaleY: attack.scale }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(self, { x: originalX, y: originalY, scaleX: 1, scaleY: 1 }, { duration: 100, easing: tween.easeIn }); } }); } else if (self.currentAttack === 1) { // Power Slam - Bounce up and down tween(self, { y: self.y - 40, scaleX: attack.scale, scaleY: attack.scale * 1.2 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(self, { y: self.y + 40, scaleX: 1, scaleY: 0.8 }, { duration: 150, easing: tween.bounceOut, onFinish: function onFinish() { tween(self, { scaleY: 1 }, { duration: 100 }); } }); } }); } else if (self.currentAttack === 2) { // Spinning Attack - Full rotation with scale tween(self, { rotation: Math.PI * 2, scaleX: attack.scale, scaleY: attack.scale }, { duration: 300, easing: tween.easeInOut, onFinish: function onFinish() { tween(self, { rotation: 0, scaleX: 1, scaleY: 1 }, { duration: 200 }); } }); } else if (self.currentAttack === 3) { var _doPulse = function doPulse() { tween(self, { scaleX: attack.scale, scaleY: attack.scale, tint: 0xFF4444 }, { duration: 80, easing: tween.easeOut, onFinish: function onFinish() { tween(self, { scaleX: 1.1, scaleY: 1.1, tint: 0xFFFFFF }, { duration: 80, easing: tween.easeIn, onFinish: function onFinish() { pulseCount++; if (pulseCount < maxPulses) { _doPulse(); } else { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 100 }); } } }); } }); }; // Devastating Blow - Multiple quick pulses var pulseCount = 0; var maxPulses = 3; _doPulse(); } else if (self.currentAttack === 4) { var _doShake = function doShake() { var shakeAmount = 15; tween(self, { x: originalX + (Math.random() - 0.5) * shakeAmount, y: originalY + (Math.random() - 0.5) * shakeAmount, scaleX: 1 + shakeCount * 0.1, scaleY: 1 + shakeCount * 0.1 }, { duration: 50, onFinish: function onFinish() { shakeCount++; if (shakeCount < maxShakes) { _doShake(); } else { // Final explosive strike tween(self, { x: originalX, y: originalY, scaleX: attack.scale, scaleY: attack.scale, tint: 0x00FFFF }, { duration: 200, easing: tween.elasticOut, onFinish: function onFinish() { tween(self, { scaleX: 1, scaleY: 1, tint: 0xFFFFFF }, { duration: 300, easing: tween.easeOut }); } }); } } }); }; // Ultimate Strike - Charge up with shake then explosive strike var originalX = self.x; var originalY = self.y; var shakeCount = 0; var maxShakes = 8; _doShake(); } // Flash effect with attack color LK.effects.flashObject(target, attack.color, 300); // Activate invincibility for 3 seconds self.isInvincible = true; // Visual feedback for invincibility - make seal semi-transparent and glow tween(self, { alpha: 0.6, tint: 0x00FFFF }, { duration: 200, onFinish: function onFinish() { // Pulsing effect during invincibility var _pulseEffect = function pulseEffect() { if (self.isInvincible) { tween(self, { alpha: 0.4 }, { duration: 300, onFinish: function onFinish() { if (self.isInvincible) { tween(self, { alpha: 0.6 }, { duration: 300, onFinish: _pulseEffect }); } } }); } }; _pulseEffect(); } }); // End invincibility after duration LK.setTimeout(function () { self.isInvincible = false; // Restore normal appearance tween(self, { alpha: 1, tint: 0xFFFFFF }, { duration: 300 }); }, self.invincibilityDuration); } else { // Partial charge - reduced damage var chargePercent = chargeTime / attack.chargeTime; var reducedDamage = Math.floor(attack.damage * chargePercent * 0.5); if (reducedDamage > 0 && target) { target.takeDamage(reducedDamage); LK.getSound('hit').play(); } // Weak attack animation tween(self, { scaleX: 1.05, scaleY: 1.05 }, { duration: 100, onFinish: function onFinish() { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 100 }); } }); } }; self.cycleAttack = function () { if (!self.isCharging) { self.currentAttack = (self.currentAttack + 1) % 5; } }; self.attack = function (target) { var currentTime = Date.now(); if (currentTime - self.lastAttackTime > self.attackCooldown) { target.takeDamage(self.attackDamage); LK.getSound('hit').play(); self.lastAttackTime = currentTime; // Attack animation tween(self, { scaleX: 1.2, scaleY: 1.2 }, { duration: 100, onFinish: function onFinish() { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 100 }); } }); } }; return self; }); var EnemySeal = Seal.expand(function () { var self = Seal.call(this, false); self.moveDirection = Math.random() * Math.PI * 2; self.directionChangeTime = 0; self.lastPlayerDistance = 1000; self.update = function () { if (self.isDead) return; // Change direction occasionally if (LK.ticks % 120 === 0) { self.moveDirection = Math.random() * Math.PI * 2; } // Move towards player if close enough var distanceToPlayer = Math.sqrt(Math.pow(player.x - self.x, 2) + Math.pow(player.y - self.y, 2)); if (distanceToPlayer < 300) { var angleToPlayer = Math.atan2(player.y - self.y, player.x - self.x); self.moveDirection = angleToPlayer; } // Move self.x += Math.cos(self.moveDirection) * self.speed; self.y += Math.sin(self.moveDirection) * self.speed; // Keep within arena bounds var centerX = 2048 / 2; var centerY = 2732 / 2; var arenaRadius = 700; var distFromCenter = Math.sqrt(Math.pow(self.x - centerX, 2) + Math.pow(self.y - centerY, 2)); if (distFromCenter > arenaRadius) { var angleToCenter = Math.atan2(centerY - self.y, centerX - self.x); self.moveDirection = angleToCenter; } // Attack player if touching if (self.intersects(player) && !player.isDead) { self.attack(player); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2F4F4F }); /**** * Game Code ****/ // Game variables var player; var enemies = []; var currentWave = 1; var enemiesInWave = 3; var waveStartTime = 0; var dragNode = null; var gameState = 'playing'; // 'playing', 'waveComplete', 'gameOver' // Create arena var arenaOuter = game.addChild(LK.getAsset('arena', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 })); var arenaInner = game.addChild(LK.getAsset('arenaFloor', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 })); // Create player player = game.addChild(new Seal(true)); player.x = 2048 / 2; player.y = 2732 / 2 + 200; // UI Elements var scoreTxt = new Text2('Score: 0', { size: 60, fill: 0xFFFFFF }); scoreTxt.anchor.set(0, 0); scoreTxt.x = 120; scoreTxt.y = 50; LK.gui.topLeft.addChild(scoreTxt); var waveTxt = new Text2('Wave: 1', { size: 60, fill: 0xFFFFFF }); waveTxt.anchor.set(1, 0); LK.gui.topRight.addChild(waveTxt); // Attack type display var attackTxt = new Text2('Attack: Quick Strike', { size: 40, fill: 0xFFFF00 }); attackTxt.anchor.set(0.5, 0); attackTxt.y = 50; LK.gui.top.addChild(attackTxt); // Create attack buttons var attackButtons = []; for (var i = 0; i < 5; i++) { var button = new Container(); var buttonBg = button.attachAsset('healthBarBg', { anchorX: 0.5, anchorY: 0.5, width: 160, height: 80 }); // Make button background red buttonBg.tint = 0xFF0000; var buttonText = new Text2(player.attackTypes[i].name, { size: 24, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); button.addChild(buttonText); // Position buttons horizontally across bottom of screen button.x = (i - 2) * 180; button.y = -120; // Store button index for reference button.attackIndex = i; // Button click handler button.down = function (x, y, obj) { if (gameState === 'playing' && !player.isDead) { player.currentAttack = this.attackIndex; attackTxt.setText('Attack: ' + player.attackTypes[player.currentAttack].name); attackTxt.tint = player.attackTypes[player.currentAttack].color; // Find closest enemy and attack instantly var closestEnemy = null; var closestDistance = Infinity; for (var k = 0; k < enemies.length; k++) { var enemy = enemies[k]; if (enemy && !enemy.isDead) { var distance = Math.sqrt(Math.pow(player.x - enemy.x, 2) + Math.pow(player.y - enemy.y, 2)); if (distance < closestDistance && distance < 200) { // Attack range closestDistance = distance; closestEnemy = enemy; } } } // Execute instant attack if enemy in range if (closestEnemy) { var attack = player.attackTypes[player.currentAttack]; closestEnemy.takeDamage(attack.damage); LK.getSound('hit').play(); // Execute attack animation instantly if (player.currentAttack === 0) { // Quick Strike - Fast dart forward var originalX = player.x; var originalY = player.y; var angle = Math.atan2(closestEnemy.y - player.y, closestEnemy.x - player.x); tween(player, { x: player.x + Math.cos(angle) * 30, y: player.y + Math.sin(angle) * 30, scaleX: attack.scale, scaleY: attack.scale }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(player, { x: originalX, y: originalY, scaleX: 1, scaleY: 1 }, { duration: 100, easing: tween.easeIn }); } }); } else if (player.currentAttack === 1) { // Power Slam - Bounce up and down tween(player, { y: player.y - 40, scaleX: attack.scale, scaleY: attack.scale * 1.2 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(player, { y: player.y + 40, scaleX: 1, scaleY: 0.8 }, { duration: 150, easing: tween.bounceOut, onFinish: function onFinish() { tween(player, { scaleY: 1 }, { duration: 100 }); } }); } }); } else if (player.currentAttack === 2) { // Spinning Attack - Full rotation with scale tween(player, { rotation: Math.PI * 2, scaleX: attack.scale, scaleY: attack.scale }, { duration: 300, easing: tween.easeInOut, onFinish: function onFinish() { tween(player, { rotation: 0, scaleX: 1, scaleY: 1 }, { duration: 200 }); } }); } else if (player.currentAttack === 3) { // Devastating Blow - Multiple quick pulses var pulseCount = 0; var maxPulses = 3; var _doPulse2 = function doPulse() { tween(player, { scaleX: attack.scale, scaleY: attack.scale, tint: 0xFF4444 }, { duration: 80, easing: tween.easeOut, onFinish: function onFinish() { tween(player, { scaleX: 1.1, scaleY: 1.1, tint: 0xFFFFFF }, { duration: 80, easing: tween.easeIn, onFinish: function onFinish() { pulseCount++; if (pulseCount < maxPulses) { _doPulse2(); } else { tween(player, { scaleX: 1, scaleY: 1 }, { duration: 100 }); } } }); } }); }; _doPulse2(); } else if (player.currentAttack === 4) { // Ultimate Strike - Charge up with shake then explosive strike var originalX = player.x; var originalY = player.y; var shakeCount = 0; var maxShakes = 8; var _doShake2 = function doShake() { var shakeAmount = 15; tween(player, { x: originalX + (Math.random() - 0.5) * shakeAmount, y: originalY + (Math.random() - 0.5) * shakeAmount, scaleX: 1 + shakeCount * 0.1, scaleY: 1 + shakeCount * 0.1 }, { duration: 50, onFinish: function onFinish() { shakeCount++; if (shakeCount < maxShakes) { _doShake2(); } else { // Final explosive strike tween(player, { x: originalX, y: originalY, scaleX: attack.scale, scaleY: attack.scale, tint: 0x00FFFF }, { duration: 200, easing: tween.elasticOut, onFinish: function onFinish() { tween(player, { scaleX: 1, scaleY: 1, tint: 0xFFFFFF }, { duration: 300, easing: tween.easeOut }); } }); } } }); }; _doShake2(); } // Flash effect with attack color LK.effects.flashObject(closestEnemy, attack.color, 300); // Activate invincibility for 3 seconds player.isInvincible = true; // Visual feedback for invincibility - make seal semi-transparent and glow tween(player, { alpha: 0.6, tint: 0x00FFFF }, { duration: 200, onFinish: function onFinish() { // Pulsing effect during invincibility var _pulseEffect2 = function pulseEffect() { if (player.isInvincible) { tween(player, { alpha: 0.4 }, { duration: 300, onFinish: function onFinish() { if (player.isInvincible) { tween(player, { alpha: 0.6 }, { duration: 300, onFinish: _pulseEffect2 }); } } }); } }; _pulseEffect2(); } }); // End invincibility after duration LK.setTimeout(function () { player.isInvincible = false; // Restore normal appearance tween(player, { alpha: 1, tint: 0xFFFFFF }, { duration: 300 }); }, player.invincibilityDuration); LK.setScore(LK.getScore() + 100); scoreTxt.setText('Score: ' + LK.getScore()); } // Update button visual states for (var j = 0; j < attackButtons.length; j++) { if (j === player.currentAttack) { attackButtons[j].children[0].tint = 0xFFAAAA; // Lighter red for selected attackButtons[j].children[1].tint = 0x000000; } else { attackButtons[j].children[0].tint = 0xFF0000; // Red for unselected attackButtons[j].children[1].tint = 0xFFFFFF; } } } }; attackButtons.push(button); LK.gui.bottom.addChild(button); } // Set initial button states attackButtons[0].children[0].tint = 0xFFAAAA; // Lighter red for selected attackButtons[0].children[1].tint = 0x000000; for (var i = 1; i < attackButtons.length; i++) { attackButtons[i].children[0].tint = 0xFF0000; // Red for unselected attackButtons[i].children[1].tint = 0xFFFFFF; } // Instructions var instructionTxt = new Text2('Select attack with buttons | Touch buttons to attack nearby enemies', { size: 30, fill: 0xCCCCCC }); instructionTxt.anchor.set(0.5, 1); instructionTxt.y = -40; LK.gui.bottom.addChild(instructionTxt); // Functions function spawnWave() { enemies = []; waveStartTime = Date.now(); for (var i = 0; i < enemiesInWave; i++) { var enemy = game.addChild(new EnemySeal()); // Spawn enemies around the arena edge var angle = i / enemiesInWave * Math.PI * 2; var spawnRadius = 500; enemy.x = 2048 / 2 + Math.cos(angle) * spawnRadius; enemy.y = 2732 / 2 + Math.sin(angle) * spawnRadius; enemies.push(enemy); } waveTxt.setText('Wave: ' + currentWave); gameState = 'playing'; } function nextWave() { currentWave++; enemiesInWave += 2; // Increase difficulty // Heal player slightly between waves player.currentHealth = Math.min(player.maxHealth, player.currentHealth + 25); player.healthBar.updateHealth(player.currentHealth); LK.setTimeout(function () { spawnWave(); }, 2000); gameState = 'waveComplete'; } function checkWaveComplete() { var aliveEnemies = 0; for (var i = 0; i < enemies.length; i++) { if (enemies[i] && !enemies[i].isDead) { aliveEnemies++; } } if (aliveEnemies === 0 && gameState === 'playing') { // Wave complete bonus var timeBonus = Math.max(0, 10000 - (Date.now() - waveStartTime)) / 100; LK.setScore(LK.getScore() + 500 + Math.floor(timeBonus)); scoreTxt.setText('Score: ' + LK.getScore()); if (currentWave >= 5) { // Victory condition LK.showYouWin(); } else { nextWave(); } } } // Input handling game.down = function (x, y, obj) { if (gameState === 'playing' && !player.isDead) { // Start dragging for positioning dragNode = player; } }; game.move = function (x, y, obj) { if (dragNode && gameState === 'playing' && !player.isDead) { dragNode.x = x; dragNode.y = y; // Keep player within arena bounds var centerX = 2048 / 2; var centerY = 2732 / 2; var arenaRadius = 700; var distFromCenter = Math.sqrt(Math.pow(dragNode.x - centerX, 2) + Math.pow(dragNode.y - centerY, 2)); if (distFromCenter > arenaRadius) { var angle = Math.atan2(dragNode.y - centerY, dragNode.x - centerX); dragNode.x = centerX + Math.cos(angle) * arenaRadius; dragNode.y = centerY + Math.sin(angle) * arenaRadius; } } }; game.up = function (x, y, obj) { dragNode = null; }; // Main game loop game.update = function () { if (gameState === 'playing') { // Remove dead enemies from array and handle enemy updates for (var i = enemies.length - 1; i >= 0; i--) { var enemy = enemies[i]; if (enemy && enemy.isDead) { enemies.splice(i, 1); } } // Check if player is dead if (player.isDead) { gameState = 'gameOver'; LK.setTimeout(function () { LK.showGameOver(); }, 1000); } // Check wave completion checkWaveComplete(); } }; // Start first wave spawnWave();
===================================================================
--- original.js
+++ change.js
@@ -555,12 +555,236 @@
// Store button index for reference
button.attackIndex = i;
// Button click handler
button.down = function (x, y, obj) {
- if (gameState === 'playing' && !player.isDead && !player.isCharging) {
+ if (gameState === 'playing' && !player.isDead) {
player.currentAttack = this.attackIndex;
attackTxt.setText('Attack: ' + player.attackTypes[player.currentAttack].name);
attackTxt.tint = player.attackTypes[player.currentAttack].color;
+ // Find closest enemy and attack instantly
+ var closestEnemy = null;
+ var closestDistance = Infinity;
+ for (var k = 0; k < enemies.length; k++) {
+ var enemy = enemies[k];
+ if (enemy && !enemy.isDead) {
+ var distance = Math.sqrt(Math.pow(player.x - enemy.x, 2) + Math.pow(player.y - enemy.y, 2));
+ if (distance < closestDistance && distance < 200) {
+ // Attack range
+ closestDistance = distance;
+ closestEnemy = enemy;
+ }
+ }
+ }
+ // Execute instant attack if enemy in range
+ if (closestEnemy) {
+ var attack = player.attackTypes[player.currentAttack];
+ closestEnemy.takeDamage(attack.damage);
+ LK.getSound('hit').play();
+ // Execute attack animation instantly
+ if (player.currentAttack === 0) {
+ // Quick Strike - Fast dart forward
+ var originalX = player.x;
+ var originalY = player.y;
+ var angle = Math.atan2(closestEnemy.y - player.y, closestEnemy.x - player.x);
+ tween(player, {
+ x: player.x + Math.cos(angle) * 30,
+ y: player.y + Math.sin(angle) * 30,
+ scaleX: attack.scale,
+ scaleY: attack.scale
+ }, {
+ duration: 100,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ tween(player, {
+ x: originalX,
+ y: originalY,
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 100,
+ easing: tween.easeIn
+ });
+ }
+ });
+ } else if (player.currentAttack === 1) {
+ // Power Slam - Bounce up and down
+ tween(player, {
+ y: player.y - 40,
+ scaleX: attack.scale,
+ scaleY: attack.scale * 1.2
+ }, {
+ duration: 200,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ tween(player, {
+ y: player.y + 40,
+ scaleX: 1,
+ scaleY: 0.8
+ }, {
+ duration: 150,
+ easing: tween.bounceOut,
+ onFinish: function onFinish() {
+ tween(player, {
+ scaleY: 1
+ }, {
+ duration: 100
+ });
+ }
+ });
+ }
+ });
+ } else if (player.currentAttack === 2) {
+ // Spinning Attack - Full rotation with scale
+ tween(player, {
+ rotation: Math.PI * 2,
+ scaleX: attack.scale,
+ scaleY: attack.scale
+ }, {
+ duration: 300,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ tween(player, {
+ rotation: 0,
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 200
+ });
+ }
+ });
+ } else if (player.currentAttack === 3) {
+ // Devastating Blow - Multiple quick pulses
+ var pulseCount = 0;
+ var maxPulses = 3;
+ var _doPulse2 = function doPulse() {
+ tween(player, {
+ scaleX: attack.scale,
+ scaleY: attack.scale,
+ tint: 0xFF4444
+ }, {
+ duration: 80,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ tween(player, {
+ scaleX: 1.1,
+ scaleY: 1.1,
+ tint: 0xFFFFFF
+ }, {
+ duration: 80,
+ easing: tween.easeIn,
+ onFinish: function onFinish() {
+ pulseCount++;
+ if (pulseCount < maxPulses) {
+ _doPulse2();
+ } else {
+ tween(player, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 100
+ });
+ }
+ }
+ });
+ }
+ });
+ };
+ _doPulse2();
+ } else if (player.currentAttack === 4) {
+ // Ultimate Strike - Charge up with shake then explosive strike
+ var originalX = player.x;
+ var originalY = player.y;
+ var shakeCount = 0;
+ var maxShakes = 8;
+ var _doShake2 = function doShake() {
+ var shakeAmount = 15;
+ tween(player, {
+ x: originalX + (Math.random() - 0.5) * shakeAmount,
+ y: originalY + (Math.random() - 0.5) * shakeAmount,
+ scaleX: 1 + shakeCount * 0.1,
+ scaleY: 1 + shakeCount * 0.1
+ }, {
+ duration: 50,
+ onFinish: function onFinish() {
+ shakeCount++;
+ if (shakeCount < maxShakes) {
+ _doShake2();
+ } else {
+ // Final explosive strike
+ tween(player, {
+ x: originalX,
+ y: originalY,
+ scaleX: attack.scale,
+ scaleY: attack.scale,
+ tint: 0x00FFFF
+ }, {
+ duration: 200,
+ easing: tween.elasticOut,
+ onFinish: function onFinish() {
+ tween(player, {
+ scaleX: 1,
+ scaleY: 1,
+ tint: 0xFFFFFF
+ }, {
+ duration: 300,
+ easing: tween.easeOut
+ });
+ }
+ });
+ }
+ }
+ });
+ };
+ _doShake2();
+ }
+ // Flash effect with attack color
+ LK.effects.flashObject(closestEnemy, attack.color, 300);
+ // Activate invincibility for 3 seconds
+ player.isInvincible = true;
+ // Visual feedback for invincibility - make seal semi-transparent and glow
+ tween(player, {
+ alpha: 0.6,
+ tint: 0x00FFFF
+ }, {
+ duration: 200,
+ onFinish: function onFinish() {
+ // Pulsing effect during invincibility
+ var _pulseEffect2 = function pulseEffect() {
+ if (player.isInvincible) {
+ tween(player, {
+ alpha: 0.4
+ }, {
+ duration: 300,
+ onFinish: function onFinish() {
+ if (player.isInvincible) {
+ tween(player, {
+ alpha: 0.6
+ }, {
+ duration: 300,
+ onFinish: _pulseEffect2
+ });
+ }
+ }
+ });
+ }
+ };
+ _pulseEffect2();
+ }
+ });
+ // End invincibility after duration
+ LK.setTimeout(function () {
+ player.isInvincible = false;
+ // Restore normal appearance
+ tween(player, {
+ alpha: 1,
+ tint: 0xFFFFFF
+ }, {
+ duration: 300
+ });
+ }, player.invincibilityDuration);
+ LK.setScore(LK.getScore() + 100);
+ scoreTxt.setText('Score: ' + LK.getScore());
+ }
// Update button visual states
for (var j = 0; j < attackButtons.length; j++) {
if (j === player.currentAttack) {
attackButtons[j].children[0].tint = 0xFFAAAA; // Lighter red for selected
@@ -582,9 +806,9 @@
attackButtons[i].children[0].tint = 0xFF0000; // Red for unselected
attackButtons[i].children[1].tint = 0xFFFFFF;
}
// Instructions
-var instructionTxt = new Text2('Select attack with buttons | Hold on enemy: Charge attack', {
+var instructionTxt = new Text2('Select attack with buttons | Touch buttons to attack nearby enemies', {
size: 30,
fill: 0xCCCCCC
});
instructionTxt.anchor.set(0.5, 1);
@@ -639,29 +863,10 @@
}
// Input handling
game.down = function (x, y, obj) {
if (gameState === 'playing' && !player.isDead) {
- // Check if touching an enemy to start charging attack
- var touchingEnemy = false;
- for (var i = 0; i < enemies.length; i++) {
- var enemy = enemies[i];
- if (enemy && !enemy.isDead) {
- var distance = Math.sqrt(Math.pow(x - enemy.x, 2) + Math.pow(y - enemy.y, 2));
- if (distance < 100) {
- // Close enough to enemy
- touchingEnemy = true;
- player.startCharging();
- break;
- }
- }
- }
- if (!touchingEnemy) {
- // Start dragging for positioning
- dragNode = player;
- } else {
- // Start dragging for positioning while charging
- dragNode = player;
- }
+ // Start dragging for positioning
+ dragNode = player;
}
};
game.move = function (x, y, obj) {
if (dragNode && gameState === 'playing' && !player.isDead) {
@@ -680,24 +885,8 @@
}
};
game.up = function (x, y, obj) {
dragNode = null;
- if (gameState === 'playing' && !player.isDead && player.isCharging) {
- // Find enemy to attack
- for (var i = 0; i < enemies.length; i++) {
- var enemy = enemies[i];
- if (enemy && !enemy.isDead && player.intersects(enemy)) {
- player.releaseAttack(enemy);
- LK.setScore(LK.getScore() + 100);
- scoreTxt.setText('Score: ' + LK.getScore());
- break;
- }
- }
- // Release attack even if no target (to stop charging)
- if (player.isCharging) {
- player.releaseAttack(null);
- }
- }
};
// Main game loop
game.update = function () {
if (gameState === 'playing') {
arena de sumo de pixeles. In-Game asset. 2d. High contrast. No shadows
una foca de pixeles con armadura de gladiador. In-Game asset. 2d. High contrast. No shadows
pes de pixeles. In-Game asset. 2d. High contrast. No shadows
piedra de pixeles. In-Game asset. 2d. High contrast. No shadows
casco de gladiador de pixeles. In-Game asset. 2d. High contrast. No shadows
peto de pixeles. In-Game asset. 2d. High contrast. No shadows
espada de pixeles orizontal. In-Game asset. 2d. High contrast. No shadows
boton azul de pixeles. In-Game asset. 2d. High contrast. No shadows