User prompt
Ajustarlo que no falle en iPhone
User prompt
sigue el problema de las musicas dobles en los niveles, aruina por completo la experiencia de juego eso
User prompt
hasta que no aparezca el boton no puede iniciar el juego
User prompt
que el boton haga zoom lento y suave ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que el boton iniciar aparezca luego de 3 segundos en zoom
User prompt
forza a detenerse la musica anterior
User prompt
prohibe, evita el dar play a dos musica, si una esta sonando la proxima se dara stop
User prompt
Musicainicio solo debe sonar en la pantalla de inicio, no en los niveles
User prompt
si musicainicio y musica mais screen no ha iniciado y el juego inicia y el nivel1, la musica inicio no debe sonar ni dar play
User prompt
optimiza la musica de main screen
User prompt
siempre se debe detener la musica anterior
User prompt
obliga la musicainicio a detenerse , que si se presiona inicio se detenga, stop musicainicion al iniciar
User prompt
varia el color del tinte en cad nivel en todas las variante posibles desde amarillo, rojo, morado, azul, verde, amarillo naranja, iniciando por purpura
User prompt
tine de color bg lines
User prompt
eliminalo
User prompt
quita el cambio de color
User prompt
quita el efecto de color lk
User prompt
use 0% white, 25% palette color
User prompt
usa 0 blanco en el modo blending
User prompt
Please fix the bug: 'TypeError: r is undefined' in or related to this line: 'self.y = 1366 + self.orbitRadius * Math.sin(self.orbitAngle);' Line Number: 138
User prompt
Please fix the bug: 'TypeError: r is undefined' in or related to this line: 'self.y = 1366 + self.orbitRadius * Math.sin(self.orbitAngle);' Line Number: 148
User prompt
Please fix the bug: 'TypeError: r is undefined' in or related to this line: 'self.y = 1366 + self.orbitRadius * Math.sin(self.orbitAngle);' Line Number: 138
User prompt
ok aplica overlay al efecto de color
User prompt
baja la intensidad y del blanco mucho mas
User prompt
bajale al tinte o color de gblines un 50%
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ // Define Bonus class var Bonus = Container.expand(function () { var self = Container.call(this); // Attach a bonus asset (use a star-like color and ellipse shape for visibility) var bonusGraphics = self.attachAsset('bonus', { anchorX: 0.5, anchorY: 0.5 }); // Orbit parameters self.orbitRadius = 170; // Default closer to center, will be overridden in Game Code self.orbitAngle = Math.random() * Math.PI * 2; // Random start // self.orbitSpeed will be set per instance in Game Code // Update method for orbiting self.update = function () { // Store previous position for smooth interpolation if (self._lastX === undefined) self._lastX = self.x; if (self._lastY === undefined) self._lastY = self.y; // Aumenta la velocidad de la órbita self.orbitAngle += self.orbitSpeed * 1.7; // Suaviza aún más la interpolación (lerp factor más alto para mayor suavidad) var targetX = 1024 + self.orbitRadius * Math.cos(self.orbitAngle); var targetY = 1366 + self.orbitRadius * Math.sin(self.orbitAngle); self.x = self._lastX + (targetX - self._lastX) * 0.65; self.y = self._lastY + (targetY - self._lastY) * 0.65; self._lastX = self.x; self._lastY = self.y; }; return self; }); // Define Deco class var Deco = Container.expand(function () { var self = Container.call(this); // Use the 'deco' asset from Assets section var decoGraphics = self.attachAsset('deco', { anchorX: 0.5, anchorY: 0.5 }); // Optionally, scale for visual distinction decoGraphics.scaleX = 1.5; decoGraphics.scaleY = 1.5; // Deco does not move or update by default, but you can add animation here if needed self.orbitRadius = 170; // Default to match average bonus orbit, will be overridden in Game Code self.orbitAngle = Math.random() * Math.PI * 2; self.orbitSpeed = -0.03; // Slower by default, will be overridden in Game Code if needed self.update = function () { self.orbitAngle += self.orbitSpeed; self.x = 1024 + self.orbitRadius * Math.cos(self.orbitAngle); self.y = 1366 + self.orbitRadius * Math.sin(self.orbitAngle); }; return self; }); // Position near the top // Define Enemy class var Enemy = Container.expand(function () { var self = Container.call(this); // Attach default 'enemy' asset (restored to default color and shape) var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); // Orbit parameters (will be set per instance in Game Code) self.orbitRadius = 400; // Default, will be overridden self.orbitAngle = Math.random() * Math.PI * 2; self.orbitSpeed = -0.03; // Default, will be overridden // Elliptical orbit support (optional, set in Game Code) self.isElliptical = false; self.ellipseA = undefined; self.ellipseB = undefined; // Update method for orbiting and rotation (like Deco) self.update = function () { self.orbitAngle += self.orbitSpeed; if (self.isElliptical && typeof self.ellipseA === "number" && typeof self.ellipseB === "number") { self.x = 1024 + self.ellipseA * Math.cos(self.orbitAngle); self.y = 1366 + self.ellipseB * Math.sin(self.orbitAngle); } else { self.x = 1024 + self.orbitRadius * Math.cos(self.orbitAngle); self.y = 1366 + self.orbitRadius * Math.sin(self.orbitAngle); } }; return self; }); // Define Player class var Player = Container.expand(function () { var self = Container.call(this); // Attach player asset var playerGraphics = self.attachAsset('Ballplayer', { anchorX: 0.5, anchorY: 0.5 }); // Set initial position and movement properties self.speed = 2.5; // Lowered for better perception // Update method for player movement self.update = function () { // Freeze player if gameplay is not enabled if (typeof gameplayEnabled !== "undefined" && !gameplayEnabled) { return; } // Movement handled by keyboard events }; }); /**** * Initialize Game ****/ // Reset Assets section to initial state // Reset Asteroid class definition //<Assets used in the game will automatically appear here> // Reset Planet class definition // Reset Star class definition // Reset Initialize Game section to initial state // Reset Game Code section to initial state var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // musica1 will only play when gameplay starts, never on main screen // (musica1 is never played on main screen. Only MusicaInicio is played here.) // State variable: true if main screen is active, false if gameplay is active // (Removed 'COSMIC ORBITS' title text from main screen) var mainScreenActive = true; // Main screen container (cover all game area) var mainScreenContainer = new Container(); mainScreenContainer.x = 0; mainScreenContainer.y = 0; // Add a background image for the main screen (Titulo-rectangulo) var portadaBg = LK.getAsset('Titulo-rectangulo', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, scaleX: 2048 / 1800, scaleY: 2732 / 1062 }); mainScreenContainer.addChild(portadaBg); // Floating animation for portadaBg (Titulo-rectangulo) function animatePortadaBgFloat() { // Animate y up by 32px, then down by 32px, loop tween(portadaBg, { y: portadaBg.y - 32 }, { duration: 1200, easing: tween.sineInOut, onFinish: function onFinish() { tween(portadaBg, { y: portadaBg.y + 32 }, { duration: 1200, easing: tween.sineInOut, onFinish: animatePortadaBgFloat }); } }); } animatePortadaBgFloat(); // Move portadaBg to the very front of the entire game (above all objects/enemies/UI except LK.gui overlays) if (portadaBg.parent) { portadaBg.parent.removeChild(portadaBg); } game.addChild(portadaBg); // (Removed static decorative 'deco' asset from main screen) // (Removed 'COSMIC ORBITS' title text from main screen) // Nueva frase arriba del título principal (actualizada) var portadaSubtitle = new Text2('Eres un punto en la tormenta... todo lo demás te aplastará.', { size: 74, fill: 0xA020F0, font: "'Impact','Arial Black',Tahoma" }); portadaSubtitle.anchor.set(0.5, 0.5); portadaSubtitle.x = 1024; // Coloca la frase aún más arriba del título principal (portadaBg está centrado en y:1366, altura 500) portadaSubtitle.y = 1366 - 520; // 520px arriba del centro del título (más arriba) mainScreenContainer.addChild(portadaSubtitle); // Circular START button (purple, lower position, and larger) var startBtn = LK.getAsset('home', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 2000, // moved further down width: 480, // enlarged height: 480, // enlarged color: 0xA020F0 // purple }); if (typeof startBtn.tint !== "undefined") { startBtn.tint = 0xA020F0; } mainScreenContainer.addChild(startBtn); // "INICIAR" text on button, a bit larger font size var startBtnText = new Text2('INICIAR', { size: 110, // a bit larger text for the button fill: 0xFFFFFF, font: "'Impact','Arial Black',Tahoma" }); startBtnText.anchor.set(0.5, 0.5); startBtnText.x = 1024; startBtnText.y = 2000; // match button position mainScreenContainer.addChild(startBtnText); // Add Info1 asset to the main splash screen (mainScreenContainer) for animation start var infoIcon = LK.getAsset('Info', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 2035 // Moved up by 5px }); // Insert infoIcon as the first child so it is rendered behind startBtn and startBtnText mainScreenContainer.addChildAt(infoIcon, 0); // --- RECORD NUMBER ON MAIN SPLASH --- // Calculate record value from storage (same logic as in main game) var splashRecord = 0; var splashStoredRecord = storage.record; if (splashStoredRecord !== null && splashStoredRecord !== undefined) { splashStoredRecord = parseInt(splashStoredRecord); if (!isNaN(splashStoredRecord)) { splashRecord = splashStoredRecord; } } // Add 'Record' label above the record number var splashRecordLabel = new Text2('Record', { size: 120, fill: 0xA020F0, font: "'Impact','Arial Black',Tahoma" }); splashRecordLabel.anchor.set(0.5, 0); splashRecordLabel.x = 1024; splashRecordLabel.y = 340; // 80px above the number (adjust as needed) mainScreenContainer.addChild(splashRecordLabel); // Create a larger Text2 for the record number (no label, just the number) var splashRecordText = new Text2('' + splashRecord, { size: 320, // Increased size for more prominence fill: 0xA020F0, font: "'Impact','Arial Black',Tahoma" }); splashRecordText.anchor.set(0.5, 0); // Position: at the very top center, leaving a margin for the platform menu (100px) // Move it down by 300px (was 120px from the top) splashRecordText.x = 1024; splashRecordText.y = 420; // 120 + 300 = 420px from the top mainScreenContainer.addChild(splashRecordText); // Animate infoIcon from Info1 to Info2 using tween plugin, and loop the animation // Helper function to loop the Info <-> Info2 animation function loopInfoIconAnimation() { // Remove any previous infoIcon2 if present if (typeof infoIcon2 !== "undefined" && infoIcon2 && infoIcon2.parent) { infoIcon2.parent.removeChild(infoIcon2); } // Create Info2 asset at the same position, but invisible infoIcon2 = LK.getAsset('Info2', { anchorX: 0.5, anchorY: 0.5, x: infoIcon.x, y: infoIcon.y, alpha: 0 }); mainScreenContainer.addChildAt(infoIcon2, 0); // Animate crossfade: Info1 alpha 1->0, Info2 alpha 0->1 tween(infoIcon, { alpha: 0 }, { duration: 700, easing: tween.cubicInOut }); tween(infoIcon2, { alpha: 1 }, { duration: 700, easing: tween.cubicInOut, onFinish: function onFinish() { // After a short delay, crossfade back to Info1 LK.setTimeout(function () { // Animate crossfade: Info2 alpha 1->0, Info1 alpha 0->1 // Re-add infoIcon if it was removed if (!infoIcon.parent) { mainScreenContainer.addChildAt(infoIcon, 0); } tween(infoIcon2, { alpha: 0 }, { duration: 700, easing: tween.cubicInOut }); tween(infoIcon, { alpha: 1 }, { duration: 700, easing: tween.cubicInOut, onFinish: function onFinish() { // Remove Info2 after animation, keep Info1 if (infoIcon2.parent) infoIcon2.parent.removeChild(infoIcon2); // Loop again after a short delay LK.setTimeout(loopInfoIconAnimation, 600); } }); }, 600); } }); } // Start the animation loop after a short delay var infoIcon2; LK.setTimeout(loopInfoIconAnimation, 600); // Add main screen container to the game (on top of everything) game.addChild(mainScreenContainer); // Optimización: Detén cualquier música previa antes de reproducir MusicaInicio, y usa fade-in para mejor experiencia // Solo reproducir MusicaInicio si el juego NO ha iniciado y no se ha presionado INICIAR if ((typeof mainScreenActive === "undefined" || mainScreenActive) && (typeof gameplayEnabled === "undefined" || gameplayEnabled === false)) { LK.stopMusic(); LK.playMusic('MusicaInicio', { loop: true, volume: 1, fade: { start: 0, end: 1, duration: 600 } }); } // musica1 will only play when gameplay starts, never on main screen // (musica1 is never played on main screen. Only MusicaInicio is played here.) // musica1 will only play when gameplay starts, never on main screen // (musica1 is never played on main screen. Only MusicaInicio is played here.) // Block gameplay until start is pressed var gameplayEnabled = false; // Helper to enable gameplay and remove main screen function startGameFromMainScreen() { if (!mainScreenActive) { return; } mainScreenActive = false; gameplayEnabled = true; // Set currentLevel to 1 and currentSubLevel to 1 when gameplay starts (main is not a level) currentLevel = 1; currentSubLevel = 1; // Hide the title, subtitle, and Titulo-rectangulo when starting the game if (typeof portadaSubtitle !== "undefined" && portadaSubtitle && portadaSubtitle.parent) { portadaSubtitle.parent.removeChild(portadaSubtitle); } if (typeof startBtnText !== "undefined" && startBtnText && startBtnText.parent) { startBtnText.parent.removeChild(startBtnText); } if (typeof portadaBg !== "undefined" && portadaBg && portadaBg.parent) { portadaBg.parent.removeChild(portadaBg); } if (mainScreenContainer && mainScreenContainer.parent) { mainScreenContainer.parent.removeChild(mainScreenContainer); } // Ensure only one music track plays at a time and prevent overlap when starting gameplay // Stop MusicaInicio immediately when clicking the start button LK.stopMusic(); LK.stopMusic('MusicaInicio'); // Obligatorio: detiene MusicaInicio si está sonando // Prevent MusicaInicio from playing again after gameplay has started mainScreenActive = false; // When gameplay starts, always stop MusicaInicio and play musica1 for level 1 if (typeof currentLevel !== "undefined" && currentLevel === 1) { // Aplica el tinte inicial de bgLines al iniciar el juego updateBgLinesTintForLevel(currentLevel); LK.playMusic('musica1', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica1'; game._lastMusicLevel = 1; } // (musica1 is only played here, never on main screen) // Move player to starting position at the bottom of the screen player.x = 1024; player.y = 2632; player.radius = Math.sqrt((player.x - centerX) * (player.x - centerX) + (player.y - centerY) * (player.y - centerY)); player.angle = Math.atan2(player.y - centerY, player.x - centerX); // Reset all gameplay variables to initial state // (Handled by LK/game reset, but you can reset here if needed) game._gameOverTriggered = false; } // Touch/click handler for main screen mainScreenContainer.down = function (x, y, obj) { // Only respond if tap/click is inside the start button area var dx = x - startBtn.x; var dy = y - startBtn.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist <= startBtn.width * 0.5) { startGameFromMainScreen(); } }; // Block all gameplay input until gameplayEnabled is true var originalGameDown = game.down; game.down = function (x, y, obj) { if (!gameplayEnabled) { return; } if (typeof originalGameDown === "function") { originalGameDown(x, y, obj); } }; var originalGameUp = game.up; game.up = function (x, y, obj) { if (!gameplayEnabled) { return; } if (typeof originalGameUp === "function") { originalGameUp(x, y, obj); } }; var originalGameUpdate = game.update; game.update = function () { if (!gameplayEnabled) { return; } if (typeof originalGameUpdate === "function") { originalGameUpdate(); } }; // Helper to generate a random pastel color // Add 'lines' asset as a background image, scaled to cover the game area function randomPastelColor() { var r = 180 + Math.floor(Math.random() * 75); var g = 180 + Math.floor(Math.random() * 75); var b = 180 + Math.floor(Math.random() * 75); return r << 16 | g << 8 | b; } // Store background asset and color for per-level colorization // Elimina la paleta de colores y la función de cambio de color de fondo por nivel/subnivel var bgLinesColor = 0x000000; // Color de fondo fijo (negro) var bgLines = LK.getAsset('lines', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, scaleX: 2048 / 573.44, scaleY: 2732 / 1019.45 }); // Set blend mode to additive if supported if (typeof bgLines.setBlendMode === "function") { bgLines.setBlendMode("add"); } else if (typeof bgLines.blendMode !== "undefined") { // 1 is usually ADD in Pixi v3/v4, fallback for older engines bgLines.blendMode = 1; } // Add a method to bgLines for additive blend mode bgLines.setAddBlendMode = function () { if (typeof this.setBlendMode === "function") { this.setBlendMode("add"); } else if (typeof this.blendMode !== "undefined") { // 1 is usually ADD in Pixi v3/v4 this.blendMode = 1; } }; // Add a method to bgLines for multiply blend mode bgLines.setMultiplyBlendMode = function () { if (typeof this.setBlendMode === "function") { this.setBlendMode("multiply"); } else if (typeof this.blendMode !== "undefined") { // 2 is usually MULTIPLY in Pixi v3/v4 this.blendMode = 2; } }; // Add a method to bgLines for darken blend mode bgLines.setDarkenBlendMode = function () { if (typeof this.setBlendMode === "function") { this.setBlendMode("darken"); } else if (typeof this.blendMode !== "undefined") { // 3 is usually DARKEN in Pixi v3/v4 this.blendMode = 3; } }; // Add a method to bgLines for overlay blend mode bgLines.setOverlayBlendMode = function () { if (typeof this.setBlendMode === "function") { this.setBlendMode("overlay"); } else if (typeof this.blendMode !== "undefined") { // 4 is usually OVERLAY in Pixi v3/v4 this.blendMode = 4; } }; // Add a method to bgLines for color blend mode bgLines.setColorBlendMode = function () { if (typeof this.setBlendMode === "function") { this.setBlendMode("color"); } else if (typeof this.blendMode !== "undefined") { // 5 is usually COLOR in Pixi v3/v4 this.blendMode = 5; } }; // Paleta de colores para el tinte de bgLines, cubriendo todas las variantes posibles var bgLinesTints = [0xA020F0, // Púrpura (inicio) 0xFF0000, // Rojo 0xFFA500, // Naranja 0xFFFF00, // Amarillo 0x00FF00, // Verde 0x00FFFF, // Cian 0x0000FF, // Azul 0x4B0082, // Índigo 0xFF5EF7, // Rosa 0x7FFF4F, // Verde lima 0xFFF200, // Amarillo fuerte 0xC54CE4, // Morado claro 0xFF3B3B, // Rojo fuerte 0x00E0FF, // Azul claro 0x3B6CFF // Azul medio ]; // Función para actualizar el tinte de bgLines según el nivel actual function updateBgLinesTintForLevel(level) { if (typeof bgLines.tint !== "undefined") { // Elige el color de la paleta según el nivel, ciclando si hay más niveles que colores var tintIdx = (level - 1) % bgLinesTints.length; bgLines.tint = bgLinesTints[tintIdx]; } } // Aplica el tinte inicial (púrpura) updateBgLinesTintForLevel(1); game.addChildAt(bgLines, 0); // Add as the very first child (background) // Elimina cualquier cambio de color o animación de color en bgLines // (No se aplica tint ni tween de color, se mantiene el color original del asset) // Import tween plugin for color cycling // Reduced collision function: returns true if a and b are within a reduced collision range (scale < 1 for smaller hitbox) function reducedCollision(a, b, scale) { if (!a || !b || !a.children || !b.children || !a.children[0] || !b.children[0]) { return false; } var aw = a.children[0].width * scale, ah = a.children[0].height * scale; var bw = b.children[0].width * scale, bh = b.children[0].height * scale; var dx = a.x - b.x, dy = a.y - b.y; var dist = Math.sqrt(dx * dx + dy * dy); var minDist = (Math.max(aw, ah) + Math.max(bw, bh)) * 0.5 * 0.5; return dist < minDist; } // Stages configuration object var stages = {}; // --- Create 11 stage objects, each on its own outward orbit --- var stages = []; var stageCount = 11; var baseStageRadius = 200; var stageRadiusStep = 80; // Each stage is 80px further out for (var i = 0; i < stageCount; i++) { var stage = new Container(); var stageGraphics = stage.attachAsset('stage', { anchorX: 0.5, anchorY: 0.5 }); stage.orbitRadius = baseStageRadius + i * stageRadiusStep; stage.orbitSpeed = -3.5 * (0.24 + i * 0.024); // Increased speed: rotate opposite to bonuses stage.orbitAngle = Math.random() * Math.PI * 2; stage.isStage = true; // Mark for clarity // --- Multicolor cycling effect using tween --- (function (stageGraphics, i) { // Define a set of bright, vivid colors to cycle through var colorCycle = [0x7fff4f, // apple green 0xffa500, // orange 0xff5ef7, // pink 0xff3b3b, // red 0x00e0ff, // light blue 0x3b6cff, // blue 0xc54ce4, // purple 0xfff200 // yellow ]; var colorIndex = i % colorCycle.length; var nextColorIndex = (colorIndex + 1) % colorCycle.length; var tweenDuration = 900 + Math.floor(Math.random() * 600); // Vary duration for each stage function tweenToNextColor() { var fromColor = colorCycle[colorIndex]; var toColor = colorCycle[nextColorIndex]; // Animate color property using tween (correct API) tween(stageGraphics, { color: toColor }, { duration: tweenDuration, easing: tween.linear, onFinish: function onFinish() { colorIndex = nextColorIndex; nextColorIndex = (colorIndex + 1) % colorCycle.length; tweenToNextColor(); } }); } // Set initial color and start cycling stageGraphics.color = colorCycle[colorIndex]; if (typeof stageGraphics.tint !== "undefined") { stageGraphics.tint = stageGraphics.color; } tweenToNextColor(); })(stageGraphics, i); // --- End multicolor cycling effect --- stage.update = function () { this.orbitAngle += this.orbitSpeed; this.x = 1024 + this.orbitRadius * Math.cos(this.orbitAngle); this.y = 1366 + this.orbitRadius * Math.sin(this.orbitAngle); }; stage.setSize = function (newSize) { // Defensive: Only allow positive numbers if (typeof newSize === "number" && newSize > 0) { // The asset is always the first child if (this.children && this.children.length > 0 && this.children[0]) { var asset = this.children[0]; // Set both width and height to newSize (ellipse remains circular) asset.width = newSize; asset.height = newSize; } } }; game.addChild(stage); stages.push(stage); } // Add a player to the game var player = game.addChild(new Player()); // Add 12 deco objects, all sharing the same orbit (same radius, speed, and direction) var decos = []; var decoCount = 12; var sharedDecoOrbitRadius = 800; // Increased: All decos on a wider orbit var sharedDecoOrbitSpeed = -0.9; // Reduced deco orbit speed (was -1.2) for (var i = 0; i < decoCount; i++) { var deco = game.addChild(new Deco()); // Assign a random light color to the deco's graphics if (deco.children && deco.children.length > 0 && deco.children[0]) { var r = 200 + Math.floor(Math.random() * 56); var g = 200 + Math.floor(Math.random() * 56); var b = 200 + Math.floor(Math.random() * 56); var lightColor = r << 16 | g << 8 | b; deco.children[0].color = lightColor; if (typeof deco.children[0].tint !== "undefined") { deco.children[0].tint = lightColor; } } deco.orbitRadius = sharedDecoOrbitRadius; deco.orbitAngle = Math.PI * 2 / decoCount * i; deco.orbitSpeed = sharedDecoOrbitSpeed; decos.push(deco); } // Duplicate the outer deco orbit: add a second set of 12 decos on the same outer orbit, offset for visual separation var decosOuter2 = []; for (var i = 0; i < decoCount; i++) { var deco2 = game.addChild(new Deco()); // Assign a random light color to the deco's graphics if (deco2.children && deco2.children.length > 0 && deco2.children[0]) { var r = 200 + Math.floor(Math.random() * 56); var g = 200 + Math.floor(Math.random() * 56); var b = 200 + Math.floor(Math.random() * 56); var lightColor = r << 16 | g << 8 | b; deco2.children[0].color = lightColor; if (typeof deco2.children[0].tint !== "undefined") { deco2.children[0].tint = lightColor; } } deco2.orbitRadius = sharedDecoOrbitRadius; deco2.orbitAngle = Math.PI * 2 / decoCount * i + Math.PI / decoCount; // offset for separation deco2.orbitSpeed = sharedDecoOrbitSpeed; decosOuter2.push(deco2); } // Add a third deco orbit, now with a larger radius for a bigger outer deco ring var decosOuter3 = []; var sharedDecoOuter3OrbitRadius = sharedDecoOrbitRadius + 200; // Increased: much larger than outer orbits var sharedDecoOuter3OrbitSpeed = sharedDecoOrbitSpeed; // Same speed as other outer orbits for (var i = 0; i < decoCount; i++) { var deco3 = game.addChild(new Deco()); // Assign a random light color to the deco's graphics if (deco3.children && deco3.children.length > 0 && deco3.children[0]) { var r = 200 + Math.floor(Math.random() * 56); var g = 200 + Math.floor(Math.random() * 56); var b = 200 + Math.floor(Math.random() * 56); var lightColor = r << 16 | g << 8 | b; deco3.children[0].color = lightColor; if (typeof deco3.children[0].tint !== "undefined") { deco3.children[0].tint = lightColor; } } deco3.orbitRadius = sharedDecoOuter3OrbitRadius; deco3.orbitAngle = Math.PI * 2 / decoCount * i + Math.PI / (decoCount * 2); // offset for visual separation deco3.orbitSpeed = sharedDecoOuter3OrbitSpeed; decosOuter3.push(deco3); } // Duplicate the largest deco orbit: add a second set of 12 decos on the same largest orbit, offset for visual separation var decosOuter3b = []; for (var i = 0; i < decoCount; i++) { var deco3b = game.addChild(new Deco()); // Assign a random light color to the deco's graphics if (deco3b.children && deco3b.children.length > 0 && deco3b.children[0]) { var r = 200 + Math.floor(Math.random() * 56); var g = 200 + Math.floor(Math.random() * 56); var b = 200 + Math.floor(Math.random() * 56); var lightColor = r << 16 | g << 8 | b; deco3b.children[0].color = lightColor; if (typeof deco3b.children[0].tint !== "undefined") { deco3b.children[0].tint = lightColor; } } deco3b.orbitRadius = sharedDecoOuter3OrbitRadius; deco3b.orbitAngle = Math.PI * 2 / decoCount * i + Math.PI / decoCount; // further offset for separation deco3b.orbitSpeed = sharedDecoOuter3OrbitSpeed; decosOuter3b.push(deco3b); } // Add a second deco orbit with half the radius and same count var decosInner = []; var sharedDecoInnerOrbitRadius = sharedDecoOrbitRadius / 2; for (var i = 0; i < decoCount; i++) { var decoInner = game.addChild(new Deco()); // Assign a random light color to the deco's graphics if (decoInner.children && decoInner.children.length > 0 && decoInner.children[0]) { var r = 200 + Math.floor(Math.random() * 56); var g = 200 + Math.floor(Math.random() * 56); var b = 200 + Math.floor(Math.random() * 56); var lightColor = r << 16 | g << 8 | b; decoInner.children[0].color = lightColor; if (typeof decoInner.children[0].tint !== "undefined") { decoInner.children[0].tint = lightColor; } decoInner.children[0].scaleX = 0.7; decoInner.children[0].scaleY = 0.7; } decoInner.orbitRadius = sharedDecoInnerOrbitRadius; decoInner.orbitAngle = Math.PI * 2 / decoCount * i + Math.PI / decoCount; // offset for visual separation decoInner.orbitSpeed = sharedDecoOrbitSpeed; decosInner.push(decoInner); } // Add 6 new enemies in a close orbit near the center var closeEnemyCount = 6; var closeEnemyOrbitRadius = 400; // Ampliado: más lejos del centro, pero aún dentro de la órbita de deco var closeEnemyOrbitSpeed = -0.003; // Reduced to 25% speed for enemy2 (slower) var closeEnemies = []; // Use the original first colors for close enemies, and assign each a unique color // Cambia el color rojo (0xe60000) por un verde brillante (0x00ff90) var originalColors = [0x00ff90, // bright green (antes era rojo) // strong red (reemplazado) // blue 0x484de8, // magenta 0xf30cdc, // cyan 0x00e0ff, // yellow 0xffeb5e, // blueish 0x4c7fb9]; var usedColors = []; var _loop = function _loop() { closeEnemy = game.addChild(new Enemy()); // Assign a random multicolor to the close enemy's graphics if (closeEnemy.children && closeEnemy.children.length > 0 && closeEnemy.children[0]) { var _tweenToNextColorEnemy2 = function tweenToNextColorEnemy2() { var fromColor = colorCycle[colorIndex]; var toColor = colorCycle[nextColorIndex]; tween(enemyGraphics, { color: toColor }, { duration: tweenDuration, easing: tween.linear, onFinish: function onFinish() { colorIndex = nextColorIndex; nextColorIndex = (colorIndex + 1) % colorCycle.length; _tweenToNextColorEnemy2(); } }); }; // Multicolor cycling effect for close enemies (enemy2) colorCycle = [0x7fff4f, // apple green 0xffa500, // orange 0xff5ef7, // pink 0xff3b3b, // red 0x00e0ff, // light blue 0x3b6cff, // blue 0xc54ce4, // purple 0xfff200 // yellow ]; colorIndex = Math.floor(Math.random() * colorCycle.length); nextColorIndex = (colorIndex + 1) % colorCycle.length; tweenDuration = 900 + Math.floor(Math.random() * 600); enemyGraphics = closeEnemy.children[0]; enemyGraphics.color = colorCycle[colorIndex]; if (typeof enemyGraphics.tint !== "undefined") { enemyGraphics.tint = enemyGraphics.color; } _tweenToNextColorEnemy2(); } closeEnemy.orbitRadius = closeEnemyOrbitRadius; closeEnemy.orbitAngle = Math.PI * 2 / closeEnemyCount * i; closeEnemy.orbitSpeed = closeEnemyOrbitSpeed; closeEnemies.push(closeEnemy); }, closeEnemy, colorCycle, colorIndex, nextColorIndex, tweenDuration, enemyGraphics; for (var i = 0; i < closeEnemyCount; i++) { _loop(); } // Removed orbitingEnemy from the deco orbit var orbitingEnemy = undefined; // Define orbits so that all 3 are separated by at least 600px (radius difference) // Minimum separation between orbits: 600px var orbits = [170, 470, 770]; // Reduced the outermost bonus orbit radius (was [170, 770, 1100]) // Create more bonus objects, each occupying a unique orbit and distributed evenly var bonuses = []; var numBonuses = 8; // Increased from 3 to 8 for 'mas' // Los 4 bonos del centro deben orbitar en la órbita más interna (orbits[0]) for (var i = 0; i < numBonuses; i++) { var b = game.addChild(new Bonus()); b.orbitIndex = i; var orbitIdx; // Los primeros 4 bonos van en la órbita más interna (orbits[0]) if (i < 4) { orbitIdx = 0; b.orbitRadius = orbits[0]; // Distribuirlos equidistantes en la órbita b.orbitAngle = Math.PI * 2 / 4 * i; // Velocidad base aumentada para todos los bonos internos var bonusSpeedIncrease = typeof currentLevel !== "undefined" ? (currentLevel - 1) * 0.003 : 0; // Si es el bono de la parte superior del centro (i==0), hazlo aún más rápido if (i === 0) { b.orbitSpeed = 0.075 + Math.random() * 0.012 + bonusSpeedIncrease * 0.7; } else { // Asegura que la velocidad nunca sea cero ni demasiado baja b.orbitSpeed = 0.025 + Math.random() * 0.008 + bonusSpeedIncrease * 0.5; if (b.orbitSpeed < 0.015) b.orbitSpeed = 0.015 + Math.random() * 0.005; // nunca cero } } else { // Los demás bonos se distribuyen en las otras órbitas orbitIdx = (i - 4) % (orbits.length - 1) + 1; // solo orbits[1] y orbits[2] b.orbitRadius = orbits[orbitIdx]; // Distribute bonuses evenly around the circle for outer orbits b.orbitAngle = Math.PI * 2 / (numBonuses - 4) * (i - 4); var bonusSpeedIncrease = typeof currentLevel !== "undefined" ? (currentLevel - 1) * 0.003 : 0; var baseSpeed = 0.065; var minSpeed = 0.025; var t = orbitIdx / (orbits.length - 1); var speed = baseSpeed * (1 - t) + minSpeed * t; // If this is the bonus in the second row from outside (i.e. second largest orbit), make it rápido y suave if (orbitIdx === orbits.length - 2) { b.orbitSpeed = 0.13 + Math.random() * 0.025 + bonusSpeedIncrease * 0.9; } else { b.orbitSpeed = speed + Math.random() * 0.012 + bonusSpeedIncrease * (0.7 + 0.3 * (1 - t)); } } // Defensa extra: nunca dejar velocidad en cero if (b.orbitSpeed === 0) b.orbitSpeed = 0.02 + Math.random() * 0.01; bonuses.push(b); } // Add a new fast-orbiting object (superBonus) that orbits faster than all bonuses var superBonus = game.addChild(new Bonus()); superBonus.orbitIndex = 3; // Not on the same orbits as bonuses, but can use a new or existing radius superBonus.orbitRadius = 320; // Reduced radius to keep inside screen // Increase superBonus speed a little per level var superBonusSpeedIncrease = typeof currentLevel !== "undefined" ? (currentLevel - 1) * 0.003 : 0; // 0.003 per level (was 0.006) superBonus.orbitSpeed = 0.32 + Math.random() * 0.07 + superBonusSpeedIncrease; // Mucho más rápido que los bonos normales superBonus.orbitAngle = Math.random() * Math.PI * 2; // (Removed unnecessary update of deco.orbitRadius) // Add level number display at the top center of the screen var levelText = new Text2('Nivel 1', { size: 100, fill: 0xFFFFFF, font: "'Impact','Arial Black',Tahoma" }); levelText.anchor.set(0.5, 0); // Center horizontally, top edge LK.gui.top.addChild(levelText); // Add record display below the level display at the top center, with "Record" label smaller and number larger, stacked vertically and centered var recordLabelText = new Text2('Record', { size: 90, fill: 0xA020F0, font: "'Impact','Arial Black',Tahoma" }); recordLabelText.anchor.set(0.5, 0); // Center horizontally, top edge recordLabelText.y = levelText.height + 10; // 10px below levelText recordLabelText.visible = false; recordLabelText.alpha = 0.75; LK.gui.top.addChild(recordLabelText); var recordTopText = new Text2('0', { size: 260, fill: 0xA020F0, font: "'Impact','Arial Black',Tahoma" }); recordTopText.anchor.set(0.5, 0); // Center horizontally, top edge recordTopText.y = recordLabelText.y + recordLabelText.height - 10; // Stack number below label, slight overlap for tightness recordTopText.visible = false; recordTopText.alpha = 0.75; LK.gui.top.addChild(recordTopText); // Hide record display by default (already set above), will show on game over // Update levelText to show the current level at game start if (typeof currentLevel !== "undefined" && typeof levelText !== "undefined" && levelText.setText) { levelText.setText('Nivel ' + currentLevel); } // Update recordTopText to show the current record at game start if (typeof record !== "undefined" && typeof recordTopText !== "undefined" && recordTopText.setText) { recordTopText.setText('' + record); } // Add score display at the bottom center in purple, only the number and centered var score = 0; var scoreText = new Text2('0', { size: 100, fill: 0xA020F0, // purple font: "'Impact','Arial Black',Tahoma" }); scoreText.anchor.set(0.5, 1); // Centered horizontally, bottom edge LK.gui.bottom.addChild(scoreText); // Record is persisted using storage plugin var record = 0; var storedRecord = storage.record; if (storedRecord !== null && storedRecord !== undefined) { storedRecord = parseInt(storedRecord); if (!isNaN(storedRecord)) { record = storedRecord; } } // --- LIVES SYSTEM --- // Number of lives (default 9) var lives = 9; var maxLives = 9; // Display lives (hearts) below the 'Nivel' text at the top center (GUI coordinates) var livesHearts = []; var heartSpacing = 70; // px between hearts var heartSize = 64; // asset size // Remove old livesText if present if (typeof livesText !== "undefined" && livesText && livesText.parent) { livesText.parent.removeChild(livesText); } var livesText = undefined; // Create a container for hearts and add to LK.gui.top var livesContainer = new Container(); LK.gui.top.addChild(livesContainer); // Position livesContainer below the levelText // levelText is anchored at (0.5, 0), so its y is 0 livesContainer.x = 0; // Will be centered by anchor livesContainer.y = levelText.height + 90; // Much further below 'Nivel' (was 10) // Center the container horizontally at the top center livesContainer.anchorX = 0.5; livesContainer.anchorY = 0; // Create and add heart assets for each life, positioned in the container for (var i = 0; i < maxLives; i++) { var heart = LK.getAsset('heart8bit', { anchorX: 0.5, anchorY: 0.5, x: (i - (maxLives - 1) / 2) * heartSpacing, y: 0, width: heartSize, height: heartSize }); livesContainer.addChild(heart); livesHearts.push(heart); } // Helper to update lives display (show/hide hearts) function updateLivesText() { for (var i = 0; i < maxLives; i++) { if (livesHearts[i]) { livesHearts[i].visible = i < lives; // Optionally, fade out lost hearts livesHearts[i].alpha = i < lives ? 1 : 0.25; } } } updateLivesText(); // Hide record display at the start of the game if (typeof recordTopText !== "undefined") { recordTopText.visible = false; } if (typeof recordLabelText !== "undefined") { recordLabelText.visible = false; } // Set initial position of the player // If main screen is active, retain player below the screen until start if (mainScreenActive) { player.x = 1024; // Center horizontally player.y = 2832; // 200px below the bottom edge (off screen) } else { player.x = 1024; // Center horizontally player.y = 2632; // Always at the bottom (100px from bottom edge) } // Store the center of the screen for easy reference var centerX = 1024; var centerY = 1366; // Define orbits var orbits = [110, 170, 230]; // Track the player's current angle and radius from the center player.angle = Math.atan2(player.y - centerY, player.x - centerX); player.radius = Math.sqrt((player.x - centerX) * (player.x - centerX) + (player.y - centerY) * (player.y - centerY)); // Keyboard controls removed for compatibility; player movement is now handled by other means. // Function to find the next closest orbit function getNextOrbit(currentY) { var currentOrbit = 2732 - currentY; for (var i = 0; i < orbits.length; i++) { if (orbits[i] > currentOrbit) { return 2732 - orbits[i]; } ; // --- Super Bonus object update and collision (fastest orbiting object) --- if (typeof superBonus !== "undefined" && superBonus) { superBonus.update(); if (superBonus.lastWasIntersecting === undefined) { superBonus.lastWasIntersecting = false; } var sbIntersecting = reducedCollision(superBonus, player, 1.0); if (!superBonus.lastWasIntersecting && sbIntersecting) { // Player just collected the super bonus! score += 200; if (typeof scoreText !== "undefined" && scoreText.setText) { scoreText.setText('' + score); } // Update record if needed if (score > record) { record = score; storage.record = record; } if (typeof pointsText !== "undefined" && pointsText.setText) { pointsText.setText('Record: ' + record); } // Update recordTopText at the top center as well if (typeof recordTopText !== "undefined" && recordTopText.setText) { recordTopText.setText('' + record); } // Move superBonus to a new random angle and randomize its speed (always fast) superBonus.orbitAngle = Math.random() * Math.PI * 2; var superBonusSpeedIncrease = typeof currentLevel !== "undefined" ? (currentLevel - 1) * 0.003 : 0; // 0.003 per level (was 0.006) superBonus.orbitSpeed = 0.18 + Math.random() * 0.04 + superBonusSpeedIncrease; } superBonus.lastWasIntersecting = sbIntersecting; } ; // --- Deco fast counter-orbit update for all decos --- if (typeof decos !== "undefined" && decos.length) { for (var i = 0; i < decos.length; i++) { var deco = decos[i]; deco.orbitAngle += deco.orbitSpeed; deco.x = centerX + deco.orbitRadius * Math.cos(deco.orbitAngle); deco.y = centerY + deco.orbitRadius * Math.sin(deco.orbitAngle); // --- Collision detection: player initiates collision with deco --- if (player.lastWasIntersectingDeco === undefined) { player.lastWasIntersectingDeco = []; } if (player.lastWasIntersectingDeco[i] === undefined) { player.lastWasIntersectingDeco[i] = false; } var playerHitsDeco = reducedCollision(player, deco, 1.0); if (!player.lastWasIntersectingDeco[i] && playerHitsDeco) { // Player collides with deco: flash blue and handle lives/game over LK.effects.flashScreen(0x00e0ff, 1000); LK.getSound('Dead').play(); lives--; updateLivesText(); if (lives <= 0) { if (!game._gameOverTriggered) { game._gameOverTriggered = true; if (typeof recordTopText !== "undefined") { recordTopText.visible = true; } if (typeof recordLabelText !== "undefined") { recordLabelText.visible = true; } // Show score on game over if (typeof scoreText !== "undefined") { scoreText.visible = true; } LK.stopMusic(); // Delay game over to allow player to see the record LK.setTimeout(function () { LK.showGameOver(); }, 1500); } } else { // Respawn player at start position, restore visibility, reset radius/angle player.x = 1024; player.y = 2632; player.radius = Math.sqrt((player.x - centerX) * (player.x - centerX) + (player.y - centerY) * (player.y - centerY)); player.angle = Math.atan2(player.y - centerY, player.x - centerX); player.visible = true; } } player.lastWasIntersectingDeco[i] = playerHitsDeco; // --- Deco's own collision detection for legacy/compatibility --- if (deco.lastWasIntersecting === undefined) { deco.lastWasIntersecting = false; } var decoIntersecting = reducedCollision(deco, player, 1.0); if (!deco.lastWasIntersecting && decoIntersecting) { // Deco kills the player: flash blue and trigger game over LK.effects.flashScreen(0x00e0ff, 1000); // Play dead sound LK.getSound('Dead').play(); if (typeof recordTopText !== "undefined") { recordTopText.visible = true; } if (typeof recordLabelText !== "undefined") { recordLabelText.visible = true; } // Show score on game over if (typeof scoreText !== "undefined") { scoreText.visible = true; } // Delay game over to allow player to see the record LK.setTimeout(function () { LK.showGameOver(); }, 1500); } deco.lastWasIntersecting = decoIntersecting; // --- Deco kills playerball as well (if playerball is a different object) --- if (typeof playerball !== "undefined" && playerball) { if (deco.lastWasIntersectingPlayerball === undefined) { deco.lastWasIntersectingPlayerball = false; } var decoHitsPlayerball = reducedCollision(deco, playerball, 1.0); if (!deco.lastWasIntersectingPlayerball && decoHitsPlayerball) { LK.effects.flashScreen(0x00e0ff, 1000); // Play dead sound LK.getSound('Dead').play(); if (typeof recordTopText !== "undefined") { recordTopText.visible = true; } if (typeof recordLabelText !== "undefined") { recordLabelText.visible = true; } // Show score on game over if (typeof scoreText !== "undefined") { scoreText.visible = true; } // Delay game over to allow player to see the record LK.setTimeout(function () { LK.showGameOver(); }, 1500); } deco.lastWasIntersectingPlayerball = decoHitsPlayerball; } // --- Deco collides with playerball or player (combined logic) --- if (typeof playerball !== "undefined" && playerball) { if (deco.lastWasIntersectingPlayerOrBall === undefined) { deco.lastWasIntersectingPlayerOrBall = false; } var decoHitsPlayerOrBall = reducedCollision(deco, player, 1.0) || reducedCollision(deco, playerball, 1.0); if (!deco.lastWasIntersectingPlayerOrBall && decoHitsPlayerOrBall) { LK.effects.flashScreen(0x00e0ff, 1000); // Play dead sound LK.getSound('Dead').play(); if (typeof recordTopText !== "undefined") { recordTopText.visible = true; } if (typeof recordLabelText !== "undefined") { recordLabelText.visible = true; } // Show score on game over if (typeof scoreText !== "undefined") { scoreText.visible = true; } // Delay game over to allow player to see the record LK.setTimeout(function () { LK.showGameOver(); }, 1500); } deco.lastWasIntersectingPlayerOrBall = decoHitsPlayerOrBall; } else { // Only player exists if (deco.lastWasIntersectingPlayerOrBall === undefined) { deco.lastWasIntersectingPlayerOrBall = false; } var decoHitsPlayer = reducedCollision(deco, player, 1.0); if (!deco.lastWasIntersectingPlayerOrBall && decoHitsPlayer) { LK.effects.flashScreen(0x00e0ff, 1000); // Play dead sound LK.getSound('Dead').play(); if (typeof recordTopText !== "undefined") { recordTopText.visible = true; } if (typeof recordLabelText !== "undefined") { recordLabelText.visible = true; } // Show score on game over if (typeof scoreText !== "undefined") { scoreText.visible = true; } // Delay game over to allow player to see the record LK.setTimeout(function () { LK.showGameOver(); }, 1500); } deco.lastWasIntersectingPlayerOrBall = decoHitsPlayer; } } } } ; ; // Add a new orbit to the end of the array to create an infinite loop var newOrbit = orbits[orbits.length - 1] + 400; orbits.push(newOrbit); return 2732 - newOrbit; } // Track if right mouse button is held down var rightMouseDown = false; // Track if left mouse button is held down var leftMouseDown = false; // Track which direction the player should move: -1 for left, 1 for right, 0 for none var playerMoveDirection = 0; // Add event listener for mouse/touch down game.down = function (x, y, obj) { // x is in game coordinates (0 to 2048) if (x < 1024) { // Pressed on left half: move player right (clockwise) playerMoveDirection = 1; } else { // Pressed on right half: move player left (counterclockwise) playerMoveDirection = -1; } }; // Add event listener for mouse/touch up to stop moving game.up = function (x, y, obj) { playerMoveDirection = 0; }; // Set initial number of enemies for level 1 (3 enemies), and increase by 1 per level up to 30 levels // currentLevel is only set when gameplay starts, not on main screen if (typeof currentLevel === "undefined" || currentLevel === null) { var currentLevel = null; // Not set until gameplay starts } var maxLevels = 30; var enemies = []; function spawnEnemiesForLevel(level) { // Remove existing enemies from game for (var i = 0; i < enemies.length; i++) { if (enemies[i].parent) { enemies[i].parent.removeChild(enemies[i]); } } enemies = []; // Number of enemies increases by 1 per level, starting at 3, max 32 at level 30 var numEnemies = Math.min(3 + (level - 1), 3 + (maxLevels - 1)); // Amplified enemy orbits: increase all base radii for even wider orbits // Limit max enemy orbit to the outermost deco orbit var maxEnemyOrbitRadius = sharedDecoOuter3OrbitRadius; var baseRadii = [370, 540, 710, 880, 1050, 1220, 1390, 1560]; var _loop2 = function _loop2() { enemy = game.addChild(new Enemy()); // Assign a random multicolor to the enemy's graphics if (enemy.children && enemy.children.length > 0 && enemy.children[0]) { var _tweenToNextColorEnemy = function tweenToNextColorEnemy() { var fromColor = colorCycle[colorIndex]; var toColor = colorCycle[nextColorIndex]; tween(enemyGraphics, { color: toColor }, { duration: tweenDuration, easing: tween.linear, onFinish: function onFinish() { colorIndex = nextColorIndex; nextColorIndex = (colorIndex + 1) % colorCycle.length; _tweenToNextColorEnemy(); } }); }; // Multicolor cycling effect for main enemies (enemy) colorCycle = [0x7fff4f, // apple green 0xffa500, // orange 0xff5ef7, // pink 0xff3b3b, // red 0x00e0ff, // light blue 0x3b6cff, // blue 0xc54ce4, // purple 0xfff200 // yellow ]; colorIndex = Math.floor(Math.random() * colorCycle.length); nextColorIndex = (colorIndex + 1) % colorCycle.length; tweenDuration = 900 + Math.floor(Math.random() * 600); enemyGraphics = enemy.children[0]; enemyGraphics.color = colorCycle[colorIndex]; if (typeof enemyGraphics.tint !== "undefined") { enemyGraphics.tint = enemyGraphics.color; } _tweenToNextColorEnemy(); } enemy.x = 1024; enemy.y = 1366; // Distribute orbits and angles for variety baseRadius = baseRadii[i % baseRadii.length]; enemy.orbitRadius = baseRadius + Math.floor(Math.random() * 120); // Clamp to max deco orbit radius if (enemy.orbitRadius > maxEnemyOrbitRadius) { enemy.orbitRadius = maxEnemyOrbitRadius; } enemy.orbitAngle = Math.random() * Math.PI * 2; // Increase base orbit speed a little per level, but with much less noticeable increment (0.002% per level) var baseSpeed = 0.004 + Math.random() * 0.003; // New: 0.002% increment per level (0.00002 per level) var speedIncrease = typeof level !== "undefined" ? (level - 1) * 0.00002 : 0; enemy.orbitSpeed = baseSpeed + speedIncrease; // Alternate direction: odd = counterclockwise, even = clockwise if (i % 2 === 1) { enemy.orbitSpeed *= -1; enemy.isCounterClockwise = true; } else { enemy.isCounterClockwise = false; } enemy.speed = 1.2 + Math.random() * 1.5; // Add random direction change timer for some enemies enemy.canChangeDirection = Math.random() < 0.5; // 50% chance if (enemy.canChangeDirection) { enemy.directionChangeInterval = 60 + Math.floor(Math.random() * 120); // 1-3 seconds enemy.directionChangeTick = 0; } enemies.push(enemy); }, enemy, colorCycle, colorIndex, nextColorIndex, tweenDuration, enemyGraphics, baseRadius; for (var i = 0; i < numEnemies; i++) { _loop2(); } } // Spawn initial enemies for level 1 spawnEnemiesForLevel(currentLevel); // musica1 will play only when gameplay starts, never on main screen // (Removed Vertigo music at the start of the game, music stopped) if (typeof LK !== "undefined" && typeof LK.on === "function") { LK.on('gameover', function () { game._gameOverTriggered = false; }); } // Update method for orbiting game.update = function () { // Gravity: each frame, pull the player a bit toward the center if (typeof gameplayEnabled !== "undefined" && !gameplayEnabled) { // Gravity is paralyzed if the game has not started } else { if (typeof currentLevel === "undefined") { var gravityStrength = 2.2; } else { // Incrementa la gravedad de manera equitativa entre niveles (del 1 al 12, por ejemplo) var minGravity = 2.2; var maxGravity = 4.0; var totalLevels = 12; var levelClamped = Math.max(1, Math.min(currentLevel, totalLevels)); var gravityStrength = minGravity + (maxGravity - minGravity) * (levelClamped - 1) / (totalLevels - 1); } // Calculate vector from player to center var dx = centerX - player.x; var dy = centerY - player.y; var dist = Math.sqrt(dx * dx + dy * dy); // Only apply gravity if not already at center if (dist > 0.1) { // Normalize direction var nx = dx / dist; var ny = dy / dist; // Move player toward center by gravityStrength, but don't overshoot var moveDist = Math.min(gravityStrength, dist); player.x += nx * moveDist; player.y += ny * moveDist; // Update angle and radius for consistency with orbit logic player.angle = Math.atan2(player.y - centerY, player.x - centerX); player.radius = Math.sqrt((player.x - centerX) * (player.x - centerX) + (player.y - centerY) * (player.y - centerY)); } else { // Snap to center if extremely close player.x = centerX; player.y = centerY; player.angle = 0; player.radius = 0; } // --- Reduce player size by 30% as it approaches the center (70% at center) --- if (player && player.children && player.children.length > 0 && player.children[0]) { // At the outermost, player is 100% size; at the center, 70% size var minScale = 0.7; // 70% at the very center var maxScale = 1.0; // 100% at the outermost var maxRadius = 1200; // Approximate outermost orbit var minRadius = 0; // Center var r = Math.max(minRadius, Math.min(maxRadius, player.radius)); var scale = minScale + (maxScale - minScale) * (r / maxRadius); player.children[0].scaleX = scale; player.children[0].scaleY = scale; } } // Smooth and continuous player movement (rotation/orbit) if (typeof playerMoveDirection !== "undefined" && playerMoveDirection !== 0) { // Player rotation speed increases with level, similar to enemy speed scaling // Base moveSpeed is 0.012, increase by 0.0007 per level (same as enemy speedIncrease) var moveSpeed = 0.012 + (typeof currentLevel !== "undefined" ? currentLevel - 1 : 0) * 0.0007; player.angle += playerMoveDirection * moveSpeed; // Recalculate position based on new angle, keep radius player.x = centerX + player.radius * Math.cos(player.angle); player.y = centerY + player.radius * Math.sin(player.angle); } // --- LEVEL SYSTEM: Track and progress levels up to 30, with 5 sub-levels per level --- if (typeof currentLevel === "undefined" || currentLevel === null) { currentLevel = 1; var maxLevels = 30; } if (typeof currentSubLevel === "undefined" || currentSubLevel === null) { currentSubLevel = 1; } var maxSubLevels = 8; // Ensure only the correct stage music plays per main level, stopping all others and preventing overlap // Play musicaN for each main level N, but only for the levels listed in the goal if (typeof game._lastMusicLevel === "undefined") { game._lastMusicLevel = currentLevel; } if (typeof game._lastMusicPlayed === "undefined") { game._lastMusicPlayed = null; } // Play musicaN for each level, using the level number directly (e.g. level 2 = musica2, level 3 = musica3, etc.) if (game._lastMusicLevel !== currentLevel) { // Always stop any previous music before playing new one LK.stopMusic(); game._lastMusicPlayed = null; // Compose music id for this level var musicToPlay = "musica" + currentLevel; // Only play if the asset exists (defensive: check LK.assets.music) if (LK.assets && LK.assets.music && LK.assets.music[musicToPlay]) { // Prohibit two music tracks: always stop before play LK.stopMusic(); LK.playMusic(musicToPlay, { loop: true, volume: 1 }); game._lastMusicPlayed = musicToPlay; game._lastMusicLevel = currentLevel; } } // Special case: play musica2 when currentLevel is 2 if (currentLevel === 2 && game._lastMusicLevel !== 2) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica2', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica2'; game._lastMusicLevel = 2; } // Special case: play musica3 when currentLevel is 3 if (currentLevel === 3 && game._lastMusicLevel !== 3) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica3', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica3'; game._lastMusicLevel = 3; } // Special case: play musica4 when currentLevel is 4 if (currentLevel === 4 && game._lastMusicLevel !== 4) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica4', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica4'; game._lastMusicLevel = 4; } // Special case: play musica5 when currentLevel is 5 if (currentLevel === 5 && game._lastMusicLevel !== 5) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica5', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica5'; game._lastMusicLevel = 5; } // Special case: play musica6 when currentLevel is 6 if (currentLevel === 6 && game._lastMusicLevel !== 6) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica6', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica6'; game._lastMusicLevel = 6; } // Special case: play musica7 when currentLevel is 7 if (currentLevel === 7 && game._lastMusicLevel !== 7) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica7', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica7'; game._lastMusicLevel = 7; } // Special case: play musica8 when currentLevel is 8 if (currentLevel === 8 && game._lastMusicLevel !== 8) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica8', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica8'; game._lastMusicLevel = 8; } // Special case: play musica9 when currentLevel is 9 if (currentLevel === 9 && game._lastMusicLevel !== 9) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica9', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica9'; game._lastMusicLevel = 9; } // Special case: play musica10 when currentLevel is 10 if (currentLevel === 10 && game._lastMusicLevel !== 10) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica10', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica10'; game._lastMusicLevel = 10; } // Special case: play musica11 when currentLevel is 11 if (currentLevel === 11 && game._lastMusicLevel !== 11) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica11', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica11'; game._lastMusicLevel = 11; } // Special case: play musica12 when currentLevel is 12 if (currentLevel === 12 && game._lastMusicLevel !== 12) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica12', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica12'; game._lastMusicLevel = 12; } // Special case: play musica13 when currentLevel is 13 if (currentLevel === 13 && game._lastMusicLevel !== 13) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica13', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica13'; game._lastMusicLevel = 13; } // Special case: play musica14 when currentLevel is 14 if (currentLevel === 14 && game._lastMusicLevel !== 14) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica14', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica14'; game._lastMusicLevel = 14; } // Special case: play musica15 when currentLevel is 15 if (currentLevel === 15 && game._lastMusicLevel !== 15) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica15', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica15'; game._lastMusicLevel = 15; } // Special case: play musica16 when currentLevel is 16 if (currentLevel === 16 && game._lastMusicLevel !== 16) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica16', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica16'; game._lastMusicLevel = 16; } // Special case: play musica17 when currentLevel is 17 if (currentLevel === 17 && game._lastMusicLevel !== 17) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica17', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica17'; game._lastMusicLevel = 17; } // Special case: play musica18 when currentLevel is 18 if (currentLevel === 18 && game._lastMusicLevel !== 18) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica18', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica18'; game._lastMusicLevel = 18; } // Special case: play musica19 when currentLevel is 19 if (currentLevel === 19 && game._lastMusicLevel !== 19) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica19', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica19'; game._lastMusicLevel = 19; } // Special case: play musica20 when currentLevel is 20 if (currentLevel === 20 && game._lastMusicLevel !== 20) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica20', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica20'; game._lastMusicLevel = 20; } // Special case: play musica21 when currentLevel is 21 if (currentLevel === 21 && game._lastMusicLevel !== 21) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica21', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica21'; game._lastMusicLevel = 21; } // Special case: play musica22 when currentLevel is 22 if (currentLevel === 22 && game._lastMusicLevel !== 22) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica22', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica22'; game._lastMusicLevel = 22; } // Special case: play musica23 when currentLevel is 23 if (currentLevel === 23 && game._lastMusicLevel !== 23) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica23', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica23'; game._lastMusicLevel = 23; } // Special case: play musica24 when currentLevel is 24 if (currentLevel === 24 && game._lastMusicLevel !== 24) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica24', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica24'; game._lastMusicLevel = 24; } // Special case: play musica25 when currentLevel is 25 if (currentLevel === 25 && game._lastMusicLevel !== 25) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica25', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica25'; game._lastMusicLevel = 25; } // Special case: play musica26 when currentLevel is 26 if (currentLevel === 26 && game._lastMusicLevel !== 26) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica26', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica26'; game._lastMusicLevel = 26; } // Special case: play musica27 when currentLevel is 27 if (currentLevel === 27 && game._lastMusicLevel !== 27) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica27', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica27'; game._lastMusicLevel = 27; } // Special case: play musica28 when currentLevel is 28 if (currentLevel === 28 && game._lastMusicLevel !== 28) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica28', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica28'; game._lastMusicLevel = 28; } // Special case: play musica29 when currentLevel is 29 if (currentLevel === 29 && game._lastMusicLevel !== 29) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica29', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica29'; game._lastMusicLevel = 29; } // Special case: play musica30 when currentLevel is 30 if (currentLevel === 30 && game._lastMusicLevel !== 30) { LK.stopMusic(); game._lastMusicPlayed = null; LK.stopMusic(); LK.playMusic('musica30', { loop: true, volume: 1 }); game._lastMusicPlayed = 'musica30'; game._lastMusicLevel = 30; } if (typeof levelText !== "undefined" && levelText.setText) { if (currentSubLevel === 1) { levelText.setText('Nivel ' + currentLevel); } else { levelText.setText('Nivel ' + currentLevel + '-' + (currentSubLevel - 1)); } } if (player.lastRadius === undefined) { player.lastRadius = player.radius; } // Check if player is within the center range (radius <= 30) and only advance when crossing into the center (from outside to inside) if (player.lastRadius === undefined) { player.lastRadius = player.radius; } if (!game._alreadyAdvancedLevel && player.lastRadius > 30 && player.radius <= 30) { // Player just reached the center! // Award 200 points if entering from above (descending), else 100 points if from below if (player.lastY !== undefined && player.lastY < centerY && player.y >= centerY) { score += 200; } else if (player.lastY !== undefined && player.lastY > centerY && player.y <= centerY) { score += 100; } else { score += 100; } if (typeof scoreText !== "undefined" && scoreText.setText) { scoreText.setText('' + score); } // Update record if needed if (score > record) { record = score; storage.record = record; } if (typeof pointsText !== "undefined" && pointsText.setText) { pointsText.setText('Record: ' + record); } // Update recordTopText at the top center as well if (typeof recordTopText !== "undefined" && recordTopText.setText) { recordTopText.setText('' + record); } // Player just reached the center, advance sub-level or main level game._alreadyAdvancedLevel = true; if (currentSubLevel < maxSubLevels) { currentSubLevel++; } else { // Advance main level if (currentLevel < 30) { // Elimina el cambio de color de fondo al avanzar de nivel principal (main level) currentLevel++; currentSubLevel = 1; // Do NOT reset lives on new level updateLivesText(); // Hide record display at the start of a new level if (typeof recordTopText !== "undefined") { recordTopText.visible = false; } if (typeof recordLabelText !== "undefined") { recordLabelText.visible = false; } // Update level number display if (typeof levelText !== "undefined" && levelText.setText) { levelText.setText('Nivel ' + currentLevel + '-' + currentSubLevel); } // Always set number of enemies to 3 + (currentLevel - 1), up to 22 at level 30 spawnEnemiesForLevel(currentLevel); // Add rotation/orbit variants: some reverse, some elliptical for (var k = 0; k < enemies.length; k++) { // Every 3rd enemy or at higher levels, make elliptical orbits if ((k + currentLevel) % 3 === 0 && currentLevel > 4) { enemies[k].ellipseA = enemies[k].orbitRadius; enemies[k].ellipseB = Math.max(120, enemies[k].orbitRadius - 60 - Math.random() * 80); enemies[k].isElliptical = true; } else { enemies[k].isElliptical = false; } // Alternate direction for more chaos if (currentLevel > 6 && k % 2 === 0) { enemies[k].orbitSpeed = -Math.abs(enemies[k].orbitSpeed); } else { enemies[k].orbitSpeed = Math.abs(enemies[k].orbitSpeed); } // Apply much less noticeable increment to enemy speed on level up as well (0.002% per level) var baseSpeed = Math.abs(enemies[k].orbitSpeed); var speedIncrease = (currentLevel - 1) * 0.00002; enemies[k].orbitSpeed = (enemies[k].orbitSpeed < 0 ? -1 : 1) * (baseSpeed + speedIncrease); } // Reset player to starting position for next level (center bottom of the screen) player.x = 1024; // Center horizontally player.y = 2632; // 100px from bottom edge player.radius = Math.sqrt((player.x - centerX) * (player.x - centerX) + (player.y - centerY) * (player.y - centerY)); player.angle = Math.atan2(player.y - centerY, player.x - centerX); // Optionally, randomize enemy orbits a bit for variety for (var j = 0; j < enemies.length; j++) { enemies[j].orbitAngle = Math.random() * Math.PI * 2; } // --- Update bonuses and superBonus speed for new level --- for (var i = 0; i < bonuses.length; i++) { var bonusSpeedIncrease = (currentLevel - 1) * 0.005; // Make outer bonuses orbit more slowly, inner ones faster // AUMENTA LA VELOCIDAD BASE DE LOS BONOS AL SUBIR DE NIVEL var baseSpeed = 0.065; // mucho más rápido para el más interno var minSpeed = 0.025; // más rápido para el más externo var t = i / (bonuses.length - 1); // 0 for center, 0.5 for extra inner, 1 for outermost var speed = baseSpeed * (1 - t) + minSpeed * t; bonuses[i].orbitSpeed = speed + Math.random() * 0.012 + bonusSpeedIncrease * (0.7 + 0.3 * (1 - t)); // random range aumentado y más rápido } var superBonusSpeedIncrease = (currentLevel - 1) * 0.007; // aún más rápido por nivel superBonus.orbitSpeed = 0.45 + Math.random() * 0.12 + superBonusSpeedIncrease; // --- End update bonuses and superBonus speed --- if (currentLevel === 30) { LK.showYouWin(); } } } // Always update levelText if (typeof levelText !== "undefined" && levelText.setText) { if (currentSubLevel === 1) { levelText.setText('Nivel ' + currentLevel); } else { levelText.setText('Nivel ' + currentLevel + '-' + (currentSubLevel - 1)); } } // Always set number of enemies to 3 + (currentLevel - 1), up to 22 at level 30 spawnEnemiesForLevel(currentLevel); // Reset player to starting position for next sub-level (center bottom of the screen) player.x = 1024; player.y = 2632; player.radius = Math.sqrt((player.x - centerX) * (player.x - centerX) + (player.y - centerY) * (player.y - centerY)); player.angle = Math.atan2(player.y - centerY, player.x - centerX); // Always update levelText for new sub-level if (typeof levelText !== "undefined" && levelText.setText) { if (currentSubLevel === 1) { levelText.setText('Nivel ' + currentLevel); } else { levelText.setText('Nivel ' + currentLevel + '-' + (currentSubLevel - 1)); } } // Actualiza el tinte de bgLines al avanzar de nivel o subnivel updateBgLinesTintForLevel(currentLevel); // Elimina el cambio de color de fondo al avanzar de nivel/subnivel } // Allow level advance again only after player leaves the center if (player.radius > 30) { game._alreadyAdvancedLevel = false; } player.lastRadius = player.radius; // Move player towards the center if right mouse button is held down (extra boost) if (typeof rightMouseDown !== "undefined" && rightMouseDown) { // Each frame, move the player 3.5px closer to the center, but not below a minimum radius of 80 player.radius = Math.max(80, player.radius - 3.5); player.x = centerX + player.radius * Math.cos(player.angle); player.y = centerY + player.radius * Math.sin(player.angle); } // Rotate player if left mouse button is held down if (typeof leftMouseDown !== "undefined" && leftMouseDown) { player.angle += 0.035; // Slower, smoother rotation for perception // When rotating, accelerate gravity (move faster to center) player.radius = Math.max(80, player.radius - gravityStrength * 2.5); player.x = centerX + player.radius * Math.cos(player.angle); player.y = centerY + player.radius * Math.sin(player.angle); } // Update all miniparticles (if any) if (game.children && game.children.length) { for (var i = game.children.length - 1; i >= 0; i--) { var c = game.children[i]; if (c && typeof c.update === "function" && c.vx !== undefined && c.vy !== undefined && c.life !== undefined) { c.update(); } } } enemies.forEach(function (enemy) { // Randomly change direction if enabled, but only after 3 full orbits in one direction if (enemy.canChangeDirection) { if (enemy.directionChangeTick === undefined) { enemy.directionChangeTick = 0; } if (enemy.orbitDirectionStartAngle === undefined) { enemy.orbitDirectionStartAngle = enemy.orbitAngle; } if (enemy.orbitsInCurrentDirection === undefined) { enemy.orbitsInCurrentDirection = 0; } enemy.directionChangeTick++; // Calculate how many full orbits have been completed in the current direction var angleDiff = enemy.orbitAngle - enemy.orbitDirectionStartAngle; // Normalize to [0, 2PI) var fullOrbits = Math.abs(angleDiff) / (Math.PI * 2); // Only increment if we passed a full orbit since last check if (enemy.lastFullOrbits === undefined) { enemy.lastFullOrbits = 0; } if (Math.floor(fullOrbits) > enemy.lastFullOrbits) { enemy.orbitsInCurrentDirection += Math.floor(fullOrbits) - enemy.lastFullOrbits; enemy.lastFullOrbits = Math.floor(fullOrbits); } if (enemy.directionChangeTick >= enemy.directionChangeInterval && enemy.orbitsInCurrentDirection >= 3) { // Flip direction enemy.orbitSpeed *= -1; enemy.directionChangeTick = 0; // Reset orbit tracking for new direction enemy.orbitDirectionStartAngle = enemy.orbitAngle; enemy.orbitsInCurrentDirection = 0; enemy.lastFullOrbits = 0; // Optionally, randomize next interval enemy.directionChangeInterval = 60 + Math.floor(Math.random() * 120); } } enemy.orbitAngle += enemy.orbitSpeed; if (enemy.isElliptical) { // Elliptical orbit var a = enemy.ellipseA || enemy.orbitRadius; var b = enemy.ellipseB || enemy.orbitRadius - 60; enemy.x = centerX + a * Math.cos(enemy.orbitAngle); enemy.y = centerY + b * Math.sin(enemy.orbitAngle); } else { // Circular orbit enemy.x = centerX + enemy.orbitRadius * Math.cos(enemy.orbitAngle); enemy.y = centerY + enemy.orbitRadius * Math.sin(enemy.orbitAngle); } // --- Collision detection with player --- if (enemy.lastWasIntersecting === undefined) { enemy.lastWasIntersecting = false; } // Custom collision: reduce hitbox to 70% of asset size // Defined globally so it is available everywhere // This function is now defined globally at the top of Game Code for universal access function reducedCollision(a, b, scale) { if (!a || !b || !a.children || !b.children || !a.children[0] || !b.children[0]) { return false; } var aw = a.children[0].width * scale, ah = a.children[0].height * scale; var bw = b.children[0].width * scale, bh = b.children[0].height * scale; var dx = a.x - b.x, dy = a.y - b.y; var dist = Math.sqrt(dx * dx + dy * dy); var minDist = (Math.max(aw, ah) + Math.max(bw, bh)) * 0.5 * 0.5; return dist < minDist; } var isIntersecting = reducedCollision(enemy, player, 1.0); if (!enemy.lastWasIntersecting && isIntersecting) { // Collision just started, trigger miniparticle explosion and then handle lives/game over LK.effects.flashScreen(0xff0000, 1000); LK.getSound('Dead').play(); // Miniparticle explosion effect if (player && player.parent) { var miniparticleCount = 18; var miniparticleSpeed = 12; var miniparticleLifetime = 700; for (var mp = 0; mp < miniparticleCount; mp++) { var angle = Math.PI * 2 / miniparticleCount * mp + Math.random() * 0.2; var p = new Container(); var g = p.attachAsset('Ballplayer', { anchorX: 0.5, anchorY: 0.5 }); g.width = player.children[0].width * 0.22; g.height = player.children[0].height * 0.22; g.alpha = 0.85; p.x = player.x; p.y = player.y; p.vx = Math.cos(angle) * (miniparticleSpeed + Math.random() * 2); p.vy = Math.sin(angle) * (miniparticleSpeed + Math.random() * 2); p.life = miniparticleLifetime; p.update = function () { this.x += this.vx; this.y += this.vy; this.vx *= 0.96; this.vy *= 0.96; this.life -= 16; if (this.children[0]) { this.children[0].alpha = Math.max(0, this.children[0].alpha - 0.045); } if (this.life <= 0 && this.parent) { this.parent.removeChild(this); } }; game.addChild(p); } // Hide player immediately player.visible = false; // After miniparticleLifetime, handle lives/game over LK.setTimeout(function () { lives--; updateLivesText(); if (lives <= 0) { if (!game._gameOverTriggered) { game._gameOverTriggered = true; if (typeof recordTopText !== "undefined") { recordTopText.visible = true; } if (typeof recordLabelText !== "undefined") { recordLabelText.visible = true; } // Show score on game over if (typeof scoreText !== "undefined") { scoreText.visible = true; } // Delay game over to allow player to see the record LK.setTimeout(function () { LK.showGameOver(); }, 1500); } } else { // Respawn player at start position, restore visibility, reset radius/angle player.x = 1024; player.y = 2632; player.radius = Math.sqrt((player.x - centerX) * (player.x - centerX) + (player.y - centerY) * (player.y - centerY)); player.angle = Math.atan2(player.y - centerY, player.x - centerX); player.visible = true; } }, miniparticleLifetime); } else { lives--; updateLivesText(); if (lives <= 0) { if (!game._gameOverTriggered) { game._gameOverTriggered = true; if (typeof recordTopText !== "undefined") { recordTopText.visible = true; } if (typeof recordLabelText !== "undefined") { recordLabelText.visible = true; } // Show score on game over if (typeof scoreText !== "undefined") { scoreText.visible = true; } // Delay game over to allow player to see the record LK.setTimeout(function () { LK.showGameOver(); }, 1500); } } else { // Respawn player at start position, restore visibility, reset radius/angle player.x = 1024; player.y = 2632; player.radius = Math.sqrt((player.x - centerX) * (player.x - centerX) + (player.y - centerY) * (player.y - centerY)); player.angle = Math.atan2(player.y - centerY, player.x - centerX); player.visible = true; } } } enemy.lastWasIntersecting = isIntersecting; }); // --- enemy2 (closeEnemies and orbitingEnemy) kill the player on collision --- if (typeof closeEnemies !== "undefined" && closeEnemies.length) { for (var i = 0; i < closeEnemies.length; i++) { var cEnemy = closeEnemies[i]; if (cEnemy.lastWasIntersecting === undefined) { cEnemy.lastWasIntersecting = false; } var cEnemyIntersecting = reducedCollision(cEnemy, player, 1.0); if (!cEnemy.lastWasIntersecting && cEnemyIntersecting) { // enemy2 kills the player: flash red and handle lives/game over LK.effects.flashScreen(0xff0000, 1000); LK.getSound('Dead').play(); lives--; updateLivesText(); if (lives <= 0) { if (typeof recordTopText !== "undefined") { recordTopText.visible = true; } if (typeof recordLabelText !== "undefined") { recordLabelText.visible = true; } // Show score on game over if (typeof scoreText !== "undefined") { scoreText.visible = true; } // Delay game over to allow player to see the record LK.setTimeout(function () { LK.showGameOver(); }, 1500); } else { // Respawn player at start position, restore visibility, reset radius/angle player.x = 1024; player.y = 2632; player.radius = Math.sqrt((player.x - centerX) * (player.x - centerX) + (player.y - centerY) * (player.y - centerY)); player.angle = Math.atan2(player.y - centerY, player.x - centerX); player.visible = true; } } cEnemy.lastWasIntersecting = cEnemyIntersecting; } } if (typeof orbitingEnemy !== "undefined" && orbitingEnemy) { if (orbitingEnemy.lastWasIntersecting === undefined) { orbitingEnemy.lastWasIntersecting = false; } var oEnemyIntersecting = reducedCollision(orbitingEnemy, player, 1.0); if (!orbitingEnemy.lastWasIntersecting && oEnemyIntersecting) { LK.effects.flashScreen(0xff0000, 1000); LK.getSound('Dead').play(); lives--; updateLivesText(); if (lives <= 0) { if (typeof recordTopText !== "undefined") { recordTopText.visible = true; } if (typeof recordLabelText !== "undefined") { recordLabelText.visible = true; } // Show score on game over if (typeof scoreText !== "undefined") { scoreText.visible = true; } // Delay game over to allow player to see the record LK.setTimeout(function () { LK.showGameOver(); }, 1500); } else { // Respawn player at start position, restore visibility, reset radius/angle player.x = 1024; player.y = 2632; player.radius = Math.sqrt((player.x - centerX) * (player.x - centerX) + (player.y - centerY) * (player.y - centerY)); player.angle = Math.atan2(player.y - centerY, player.x - centerX); player.visible = true; } } orbitingEnemy.lastWasIntersecting = oEnemyIntersecting; } // --- Stage object update (orbiting) --- if (typeof stage !== "undefined" && stage) { stage.update(); } // --- Bonus objects update and collision (four bonuses, including superBonus) --- // Track player's lastY for entry direction detection if (player.lastY === undefined) player.lastY = player.y; if (bonuses && bonuses.length) { for (var i = 0; i < bonuses.length; i++) { var bonus = bonuses[i]; // Ensure every bonus orbits every frame, including the innermost (none are static) if (typeof bonus.update === "function") { bonus.update(); } else { // Defensive: forcibly move bonus in orbit if update is missing if (typeof bonus.orbitAngle === "number" && typeof bonus.orbitSpeed === "number" && typeof bonus.orbitRadius === "number") { bonus.orbitAngle += 0.012; // fallback speed bonus.x = centerX + bonus.orbitRadius * Math.cos(bonus.orbitAngle); bonus.y = centerY + bonus.orbitRadius * Math.sin(bonus.orbitAngle); } } if (bonus.lastWasIntersecting === undefined) { bonus.lastWasIntersecting = false; } var bIntersecting = reducedCollision(bonus, player, 1.0); // --- Give 10 points each time the player enters/intersects the bonus (not continuously) --- if (!bonus.lastWasIntersecting && bIntersecting) { // Player just collided with a bonus: award 10 points score += 10; if (typeof scoreText !== "undefined" && scoreText.setText) { scoreText.setText('' + score); } // Update record if needed if (score > record) { record = score; storage.record = record; } if (typeof pointsText !== "undefined" && pointsText.setText) { pointsText.setText('Record: ' + record); } // Update recordTopText at the top center as well if (typeof recordTopText !== "undefined" && recordTopText.setText) { recordTopText.setText('' + record); } // Do NOT remove or respawn the bonus; let it keep orbiting as before // No removal from bonuses array, so no i-- or continue } // --- End entry points --- // --- Always keep bonuses moving at higher speed --- // Prevent bonus from ever drifting into the center: forcibly keep in orbit if radius is too small if (bonus.orbitRadius < 60) { // Find a valid orbit (never center) var safeOrbitIdx = 1; for (var oi = 0; oi < orbits.length; oi++) { if (orbits[oi] >= 60) { safeOrbitIdx = oi; break; } } bonus.orbitRadius = orbits[safeOrbitIdx]; bonus.orbitIndex = safeOrbitIdx; } // Extra: NEVER allow a bonus to be placed at the center (orbitRadius == 0) if (bonus.orbitRadius === 0) { // Move to the first safe orbit (never center) bonus.orbitRadius = orbits[1]; bonus.orbitIndex = 1; } var bonusSpeedIncrease = typeof currentLevel !== "undefined" ? (currentLevel - 1) * 0.006 : 0; // aún más rápido por nivel var baseSpeed = 0.035; // mucho más rápido para el más interno var minSpeed = 0.012; // más rápido para el más externo var t = bonus.orbitIndex / 2; // 0 for center, 0.5 for extra inner, 1 for outermost var speed = baseSpeed * (1 - t) + minSpeed * t; bonus.orbitSpeed = speed + Math.random() * 0.006 + bonusSpeedIncrease * (0.7 + 0.3 * (1 - t)); // random range aumentado bonus.lastWasIntersecting = bIntersecting; } } // Update player's lastY for next frame player.lastY = player.y; // --- Super Bonus (4th orbit) update and collision --- if (typeof superBonus !== "undefined" && superBonus) { superBonus.update(); if (superBonus.lastWasIntersecting === undefined) { superBonus.lastWasIntersecting = false; } var sbIntersecting = reducedCollision(superBonus, player, 1.0); // --- Give points CONTINUOUSLY while player is in superBonus area --- if (sbIntersecting) { score += 30; // Give 30 points per frame while in area (adjust as needed) if (typeof scoreText !== "undefined" && scoreText.setText) { scoreText.setText('' + score); } // Update record if needed if (score > record) { record = score; storage.record = record; } if (typeof pointsText !== "undefined" && pointsText.setText) { pointsText.setText('Record: ' + record); } // Update recordTopText at the top center as well if (typeof recordTopText !== "undefined" && recordTopText.setText) { recordTopText.setText('' + record); } } // --- End continuous points --- // --- Always keep superBonus moving at much higher speed --- var superBonusSpeedIncrease = typeof currentLevel !== "undefined" ? (currentLevel - 1) * 0.005 : 0; // aún más rápido por nivel superBonus.orbitSpeed = 0.45 + Math.random() * 0.12 + superBonusSpeedIncrease; // mucho más rápido que antes superBonus.lastWasIntersecting = sbIntersecting; } // --- Heart-in-orbit for extra life, more frequent and in different orbits, only one at a time --- if (typeof heartOrbits === "undefined") { heartOrbits = []; } if (typeof lastHeartScore === "undefined") { lastHeartScore = 0; } if (typeof heartInOrbitActive === "undefined") { heartInOrbitActive = false; } if (typeof heartInOrbitObj === "undefined") { heartInOrbitObj = null; } if (typeof heartInOrbitTimeout === "undefined") { heartInOrbitTimeout = null; } if (typeof heartInOrbitNextScore === "undefined") { heartInOrbitNextScore = 250; // Start at 250 for first heart } // Appear every 250 points, but only one at a time if (!heartInOrbitActive && score >= heartInOrbitNextScore) { // Pick a random orbit from a wider set, including inner, mid, and outer deco orbits var possibleHeartOrbits = [sharedDecoInnerOrbitRadius, // inner deco sharedDecoInnerOrbitRadius + 60, sharedDecoInnerOrbitRadius - 30, sharedDecoOrbitRadius, // main deco sharedDecoOrbitRadius + 60, sharedDecoOrbitRadius - 30, sharedDecoOuter3OrbitRadius, // outermost deco sharedDecoOuter3OrbitRadius - 60]; // Only one heart at a time var heartOrbitRadius = possibleHeartOrbits[Math.floor(Math.random() * possibleHeartOrbits.length)]; // Randomize speed and direction var heartOrbitSpeed = (0.018 + Math.random() * 0.022) * (Math.random() < 0.5 ? 1 : -1); var heartOrbitAngle = Math.random() * Math.PI * 2; heartInOrbitObj = new Container(); var heartAsset = heartInOrbitObj.attachAsset('heart8bit', { anchorX: 0.5, anchorY: 0.5, width: 64, height: 64 }); heartInOrbitObj.orbitRadius = heartOrbitRadius; heartInOrbitObj.orbitSpeed = heartOrbitSpeed; heartInOrbitObj.orbitAngle = heartOrbitAngle; heartInOrbitObj.update = function () { this.orbitAngle += this.orbitSpeed; this.x = centerX + this.orbitRadius * Math.cos(this.orbitAngle); this.y = centerY + this.orbitRadius * Math.sin(this.orbitAngle); }; game.addChild(heartInOrbitObj); heartInOrbitActive = true; lastHeartScore = score; // Next heart at next 250 points heartInOrbitNextScore = score + 250; // Set a timeout to remove the heart after 10 seconds if not collected if (heartInOrbitTimeout) { LK.clearTimeout(heartInOrbitTimeout); heartInOrbitTimeout = null; } heartInOrbitTimeout = LK.setTimeout(function () { if (heartInOrbitActive && heartInOrbitObj) { if (heartInOrbitObj.parent) { heartInOrbitObj.parent.removeChild(heartInOrbitObj); } heartInOrbitActive = false; heartInOrbitObj = null; } heartInOrbitTimeout = null; }, 10000); } // If heart is active, update and check collision if (heartInOrbitActive && heartInOrbitObj) { heartInOrbitObj.update(); if (heartInOrbitObj.lastWasIntersecting === undefined) { heartInOrbitObj.lastWasIntersecting = false; } var heartIntersecting = reducedCollision(heartInOrbitObj, player, 1.0); if (!heartInOrbitObj.lastWasIntersecting && heartIntersecting) { // Player collects the heart: gain a life (up to max) if (lives < maxLives) { lives++; updateLivesText(); } // Remove heart from game if (heartInOrbitObj.parent) { heartInOrbitObj.parent.removeChild(heartInOrbitObj); } heartInOrbitActive = false; heartInOrbitObj = null; // Cancel the timeout if still pending if (heartInOrbitTimeout) { LK.clearTimeout(heartInOrbitTimeout); heartInOrbitTimeout = null; } } if (heartInOrbitObj) { heartInOrbitObj.lastWasIntersecting = heartIntersecting; } } // Remove heart if player dies (game over handled elsewhere) if (heartInOrbitActive && lives <= 0 && heartInOrbitObj) { if (heartInOrbitObj.parent) { heartInOrbitObj.parent.removeChild(heartInOrbitObj); } heartInOrbitActive = false; heartInOrbitObj = null; // Cancel the timeout if still pending if (heartInOrbitTimeout) { LK.clearTimeout(heartInOrbitTimeout); heartInOrbitTimeout = null; } } };
===================================================================
--- original.js
+++ change.js
@@ -1448,8 +1448,10 @@
// Compose music id for this level
var musicToPlay = "musica" + currentLevel;
// Only play if the asset exists (defensive: check LK.assets.music)
if (LK.assets && LK.assets.music && LK.assets.music[musicToPlay]) {
+ // Prohibit two music tracks: always stop before play
+ LK.stopMusic();
LK.playMusic(musicToPlay, {
loop: true,
volume: 1
});
@@ -1460,8 +1462,9 @@
// Special case: play musica2 when currentLevel is 2
if (currentLevel === 2 && game._lastMusicLevel !== 2) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica2', {
loop: true,
volume: 1
});
@@ -1471,8 +1474,9 @@
// Special case: play musica3 when currentLevel is 3
if (currentLevel === 3 && game._lastMusicLevel !== 3) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica3', {
loop: true,
volume: 1
});
@@ -1482,8 +1486,9 @@
// Special case: play musica4 when currentLevel is 4
if (currentLevel === 4 && game._lastMusicLevel !== 4) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica4', {
loop: true,
volume: 1
});
@@ -1493,8 +1498,9 @@
// Special case: play musica5 when currentLevel is 5
if (currentLevel === 5 && game._lastMusicLevel !== 5) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica5', {
loop: true,
volume: 1
});
@@ -1504,8 +1510,9 @@
// Special case: play musica6 when currentLevel is 6
if (currentLevel === 6 && game._lastMusicLevel !== 6) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica6', {
loop: true,
volume: 1
});
@@ -1515,8 +1522,9 @@
// Special case: play musica7 when currentLevel is 7
if (currentLevel === 7 && game._lastMusicLevel !== 7) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica7', {
loop: true,
volume: 1
});
@@ -1526,8 +1534,9 @@
// Special case: play musica8 when currentLevel is 8
if (currentLevel === 8 && game._lastMusicLevel !== 8) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica8', {
loop: true,
volume: 1
});
@@ -1537,8 +1546,9 @@
// Special case: play musica9 when currentLevel is 9
if (currentLevel === 9 && game._lastMusicLevel !== 9) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica9', {
loop: true,
volume: 1
});
@@ -1548,8 +1558,9 @@
// Special case: play musica10 when currentLevel is 10
if (currentLevel === 10 && game._lastMusicLevel !== 10) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica10', {
loop: true,
volume: 1
});
@@ -1559,8 +1570,9 @@
// Special case: play musica11 when currentLevel is 11
if (currentLevel === 11 && game._lastMusicLevel !== 11) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica11', {
loop: true,
volume: 1
});
@@ -1570,8 +1582,9 @@
// Special case: play musica12 when currentLevel is 12
if (currentLevel === 12 && game._lastMusicLevel !== 12) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica12', {
loop: true,
volume: 1
});
@@ -1581,8 +1594,9 @@
// Special case: play musica13 when currentLevel is 13
if (currentLevel === 13 && game._lastMusicLevel !== 13) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica13', {
loop: true,
volume: 1
});
@@ -1592,8 +1606,9 @@
// Special case: play musica14 when currentLevel is 14
if (currentLevel === 14 && game._lastMusicLevel !== 14) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica14', {
loop: true,
volume: 1
});
@@ -1603,8 +1618,9 @@
// Special case: play musica15 when currentLevel is 15
if (currentLevel === 15 && game._lastMusicLevel !== 15) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica15', {
loop: true,
volume: 1
});
@@ -1614,8 +1630,9 @@
// Special case: play musica16 when currentLevel is 16
if (currentLevel === 16 && game._lastMusicLevel !== 16) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica16', {
loop: true,
volume: 1
});
@@ -1625,8 +1642,9 @@
// Special case: play musica17 when currentLevel is 17
if (currentLevel === 17 && game._lastMusicLevel !== 17) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica17', {
loop: true,
volume: 1
});
@@ -1636,8 +1654,9 @@
// Special case: play musica18 when currentLevel is 18
if (currentLevel === 18 && game._lastMusicLevel !== 18) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica18', {
loop: true,
volume: 1
});
@@ -1647,8 +1666,9 @@
// Special case: play musica19 when currentLevel is 19
if (currentLevel === 19 && game._lastMusicLevel !== 19) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica19', {
loop: true,
volume: 1
});
@@ -1658,8 +1678,9 @@
// Special case: play musica20 when currentLevel is 20
if (currentLevel === 20 && game._lastMusicLevel !== 20) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica20', {
loop: true,
volume: 1
});
@@ -1669,8 +1690,9 @@
// Special case: play musica21 when currentLevel is 21
if (currentLevel === 21 && game._lastMusicLevel !== 21) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica21', {
loop: true,
volume: 1
});
@@ -1680,8 +1702,9 @@
// Special case: play musica22 when currentLevel is 22
if (currentLevel === 22 && game._lastMusicLevel !== 22) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica22', {
loop: true,
volume: 1
});
@@ -1691,8 +1714,9 @@
// Special case: play musica23 when currentLevel is 23
if (currentLevel === 23 && game._lastMusicLevel !== 23) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica23', {
loop: true,
volume: 1
});
@@ -1702,8 +1726,9 @@
// Special case: play musica24 when currentLevel is 24
if (currentLevel === 24 && game._lastMusicLevel !== 24) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica24', {
loop: true,
volume: 1
});
@@ -1713,8 +1738,9 @@
// Special case: play musica25 when currentLevel is 25
if (currentLevel === 25 && game._lastMusicLevel !== 25) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica25', {
loop: true,
volume: 1
});
@@ -1724,8 +1750,9 @@
// Special case: play musica26 when currentLevel is 26
if (currentLevel === 26 && game._lastMusicLevel !== 26) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica26', {
loop: true,
volume: 1
});
@@ -1735,8 +1762,9 @@
// Special case: play musica27 when currentLevel is 27
if (currentLevel === 27 && game._lastMusicLevel !== 27) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica27', {
loop: true,
volume: 1
});
@@ -1746,8 +1774,9 @@
// Special case: play musica28 when currentLevel is 28
if (currentLevel === 28 && game._lastMusicLevel !== 28) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica28', {
loop: true,
volume: 1
});
@@ -1757,8 +1786,9 @@
// Special case: play musica29 when currentLevel is 29
if (currentLevel === 29 && game._lastMusicLevel !== 29) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica29', {
loop: true,
volume: 1
});
@@ -1768,8 +1798,9 @@
// Special case: play musica30 when currentLevel is 30
if (currentLevel === 30 && game._lastMusicLevel !== 30) {
LK.stopMusic();
game._lastMusicPlayed = null;
+ LK.stopMusic();
LK.playMusic('musica30', {
loop: true,
volume: 1
});
Dead
Sound effect
MusicaInicio
Music
musica4
Music
musica1
Music
musica7
Music
musica10
Music
musica13
Music
musica16
Music
musica19
Music
musica22
Music
musica25
Music
musica28
Music
musica2
Music
musica3
Music
musica5
Music
musica6
Music
musica8
Music
musica9
Music
musica11
Music
musica12
Music
musica14
Music
musica15
Music
musica17
Music
musica18
Music
musica20
Music
musica21
Music
musica23
Music
musica24
Music
musica26
Music
musica27
Music
musica29
Music
musica30
Music