User prompt
haz que los botones 1, 2 y 3, ademas del elemento WoodenBoard no se vean en el menu de inicio, solo en el juego
User prompt
haz que al precionar el boton 1 debajo del frasco, puedas seleccionar 2 circulos que esten dentro del frasco, cuando selecciones 2 estos que has seleccionado se eliminaran de el frasco
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of null (reading 'x')' in or related to this line: 'var button1Bounds = {' Line Number: 828
User prompt
haz que cuando precionas el boton 1, puedas eliminar 2 circulos de el frasco
User prompt
haz que abajo del frasco haya como una madera en la que hayan 3 botones
User prompt
haz que al tocar la luna, y se reproduzca su sonido, tambien salga en pantalla por 1,5 segundos una imagen ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
haz que al hacer click en la luna, se reproduzca un sonido
User prompt
elimina a el sol, que solo este la luna, y haz que se mueva un poquito mas lento, pero no mucho ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
haz que el fondo se vaya iluminando a medida que el sol aparece ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
haz que a medida que el sol aparece y sube, el fondo se vaya iluminando de a poco, y que cuando el sol se vaya, el fondo se vaya oscureciendo denuevo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
haz que el sol no se vea hasta que la luna se vaya, tambien haz que el escenario se vuelva de dia mientras el sol aparece ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
haz que cuando la luna llega a la derecha y desaparece, por la izquierda aparezca un sol, un poquito mas grande ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
haz que la luna empieze desde mas abajo, y que no tarde tanto tiempo en ir de un lado a otro ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
haz que la luna aparezca un poco mas abajo, y a medida que avanze hacia la mitad de la pantalla se eleve de a poco, y cuando llegue a la mitad, que se empieze a bajar hasta el punto en el que empezo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que haya una Luna, que se pasee de el lado izquierdo de la pantalla a el lado derecho de la pantalla en el fondo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
elimina este elemento: Window. y el fondo, detras de los edificios pon una noche estrellada
User prompt
haz que el fondo sea una ciudad
User prompt
Please fix the bug: 'TypeError: Cannot set properties of undefined (setting 'spawnImmunity')' in or related to this line: 'circle.mergeInto.spawnImmunity = false;' Line Number: 784
User prompt
haz que el cooldown de 3 segundos se aplique a cada circulo que spawnee, no para el inicio del juego, sino para toda la partida
User prompt
haz que los circulos al tocar la linea roja hagan que pierdas, pero haz que cuando spawnees un circulo tenga un tiempo de 3 segundos que mientras esté este cooldown, no puedas perder por contacto con la linea roja ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
haz que los circulos spawneen un poco mas arriba de la linea roja, y que al caer no pierdas, solo puedas perder si las frutas suben hasta la linea roja, no al caer
User prompt
agrega una caja de colision de arriba de el frasco, en el que si un circulo lo llega a tocar pierdes
User prompt
haz que solo se puedan spawnear con el mouse los primeros 3 circulos, los demas solo sean por fusionar
User prompt
mejora la caja de colision de todos los circulos para que no se bugee
User prompt
agrega dos circulos superiores mas
/**** * Plugins ****/ var storage = LK.import("@upit/storage.v1"); var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Circle = Container.expand(function (circleType) { var self = Container.call(this); var circleGraphics = self.attachAsset('circle' + circleType, { anchorX: 0.5, anchorY: 0.5 }); self.circleType = circleType; self.size = circleType; self.velocityX = 0; self.velocityY = 0; self.radius = [90, 120, 150, 180, 210, 240, 270, 320, 370][circleType - 1]; self.lastY = 0; self.lastIntersecting = false; self.spawnImmunity = false; self.spawnTime = 0; self.isSelected = false; self.originalTint = 0xFFFFFF; // Add selection handler self.down = function (x, y, obj) { if (selectionMode && gameState === 'playing') { if (self.isSelected) { // Deselect circle self.isSelected = false; circleGraphics.tint = self.originalTint; var index = selectedCircles.indexOf(self); if (index > -1) { selectedCircles.splice(index, 1); } } else if (selectedCircles.length < maxSelectableCircles) { // Select circle self.isSelected = true; circleGraphics.tint = 0xFF0000; // Red tint for selection selectedCircles.push(self); // If we have selected enough circles, remove them if (selectedCircles.length >= maxSelectableCircles) { // Remove selected circles for (var i = selectedCircles.length - 1; i >= 0; i--) { var circle = selectedCircles[i]; game.removeChild(circle); var circleIndex = circles.indexOf(circle); if (circleIndex > -1) { circles.splice(circleIndex, 1); } } // Reset selection state selectedCircles = []; selectionMode = false; } } } }; self.update = function () { // Apply gravity with slight variation based on size (heavier objects fall slightly faster) var gravityForce = 0.4 + self.radius / 1000; // Larger circles have slightly more gravity self.velocityY += gravityForce; // Apply velocity self.x += self.velocityX; self.y += self.velocityY; // Apply air resistance (less friction for more realistic movement) self.velocityX *= 0.995; // Very slight air resistance self.velocityY *= 0.999; // Even less resistance on Y axis // Add rotation based on horizontal velocity to make circles look more natural circleGraphics.rotation += self.velocityX * 0.01; // Container collision detection var containerLeft = containerX + 20; var containerRight = containerX + containerWidth - 20; var containerBottom = containerY + containerHeight - 20; var containerTop = containerY; // Side walls collision with improved bouncing if (self.x - self.radius < containerLeft) { self.x = containerLeft + self.radius; self.velocityX = Math.abs(self.velocityX) * 0.7; // More bounce } if (self.x + self.radius > containerRight) { self.x = containerRight - self.radius; self.velocityX = -Math.abs(self.velocityX) * 0.7; // More bounce } // Allow circles to move above the container when spawning, no collision with top // Bottom collision with better restitution if (self.y + self.radius > containerBottom) { self.y = containerBottom - self.radius; // Add some bounce to vertical velocity instead of stopping completely self.velocityY = -Math.abs(self.velocityY) * 0.3; // Small bounce self.velocityX *= 0.85; // Less friction loss } // Circle-to-circle collision with other circles for (var i = 0; i < circles.length; i++) { var other = circles[i]; if (other !== self) { var dx = self.x - other.x; var dy = self.y - other.y; var distance = Math.sqrt(dx * dx + dy * dy); // Use consistent radius for collision detection var minDistance = self.radius + other.radius; if (distance < minDistance && distance > 0) { // Same size circles merge if (self.circleType === other.circleType && self.circleType < 9) { // Prevent multiple merges of the same circles if (self.shouldMerge || other.shouldMerge) { return; } // Create new larger circle var newCircle = new Circle(self.circleType + 1); newCircle.x = (self.x + other.x) / 2; newCircle.y = (self.y + other.y) / 2; newCircle.velocityX = (self.velocityX + other.velocityX) / 2; newCircle.velocityY = (self.velocityY + other.velocityY) / 2; // Start small and animate to full size newCircle.scaleX = 0.3; newCircle.scaleY = 0.3; tween(newCircle, { scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.bounceOut }); // Mark both circles for merging into the same new circle self.shouldMerge = true; other.shouldMerge = true; self.mergeInto = newCircle; other.mergeInto = newCircle; score += self.circleType * 10; scoreText.setText('Score: ' + score); return; } // Simple and consistent collision response var overlap = minDistance - distance; var normalX = dx / distance; var normalY = dy / distance; // Calculate mass based on radius var mass1 = self.radius; var mass2 = other.radius; var totalMass = mass1 + mass2; // Separate circles proportionally to their masses var pushForce = overlap * 0.5; // Split the overlap correction var ratio1 = mass2 / totalMass; // Lighter objects move more var ratio2 = mass1 / totalMass; // Apply position correction with small buffer var buffer = 2; // Small buffer to prevent immediate re-collision var correctionX = normalX * (pushForce + buffer); var correctionY = normalY * (pushForce + buffer); self.x += correctionX * ratio1; self.y += correctionY * ratio1; other.x -= correctionX * ratio2; other.y -= correctionY * ratio2; // Keep circles within container bounds after collision var containerLeft = containerX + 20; var containerRight = containerX + containerWidth - 20; var containerBottom = containerY + containerHeight - 20; if (self.x - self.radius < containerLeft) { self.x = containerLeft + self.radius; } if (self.x + self.radius > containerRight) { self.x = containerRight - self.radius; } if (self.y + self.radius > containerBottom) { self.y = containerBottom - self.radius; } if (other.x - other.radius < containerLeft) { other.x = containerLeft + other.radius; } if (other.x + other.radius > containerRight) { other.x = containerRight - other.radius; } if (other.y + other.radius > containerBottom) { other.y = containerBottom - other.radius; } // Simple velocity exchange for realistic bouncing var relativeVelocityX = self.velocityX - other.velocityX; var relativeVelocityY = self.velocityY - other.velocityY; var separatingVelocity = relativeVelocityX * normalX + relativeVelocityY * normalY; // Only resolve if objects are moving towards each other if (separatingVelocity < 0) { var restitution = 0.6; // Moderate bounciness var impulse = -(1 + restitution) * separatingVelocity / (1 / mass1 + 1 / mass2); var impulseX = impulse * normalX; var impulseY = impulse * normalY; self.velocityX += impulseX / mass1; self.velocityY += impulseY / mass1; other.velocityX -= impulseX / mass2; other.velocityY -= impulseY / mass2; } } } } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000011 }); /**** * Game Code ****/ // Keep menu assets // Suika Game assets // Game state management var gameState = 'menu'; // 'menu', 'playing', 'paused', or 'settings' var sensitivity = storage.sensitivity || 0.5; // Default sensitivity // Suika Game variables var containerX = (2048 - 1600) / 2; var containerY = 200; var containerWidth = 1600; var containerHeight = 2000; var circles = []; var score = 0; var nextCircleType = 1; var currentCircle = null; var dropLine = null; var gameStarted = false; // Individual circle immunity will be handled per circle // Create container walls var leftWall = LK.getAsset('containerWall', { anchorX: 0, anchorY: 0 }); leftWall.x = containerX; leftWall.y = containerY; var rightWall = LK.getAsset('containerWall', { anchorX: 0, anchorY: 0 }); rightWall.x = containerX + containerWidth - 20; rightWall.y = containerY; var bottomWall = LK.getAsset('containerBottom', { anchorX: 0, anchorY: 0 }); bottomWall.x = containerX; bottomWall.y = containerY + containerHeight - 20; var topWall = LK.getAsset('containerTop', { anchorX: 0, anchorY: 0 }); topWall.x = containerX; topWall.y = containerY - 20; // Score display var scoreText = new Text2('Score: 0', { size: 60, fill: 0x000000 }); scoreText.anchor.set(0.5, 0); scoreText.x = containerX + containerWidth / 2; scoreText.y = 200; // Next circle preview var nextCirclePreview = LK.getAsset('nextCirclePreview', { anchorX: 0.5, anchorY: 0.5 }); nextCirclePreview.x = containerX + containerWidth + 100; nextCirclePreview.y = 400; var nextCircleText = new Text2('Next:', { size: 40, fill: 0x000000 }); nextCircleText.anchor.set(0.5, 0.5); nextCircleText.x = nextCirclePreview.x; nextCircleText.y = nextCirclePreview.y - 60; // Create city background elements var cityElements = []; // Create starry night background for (var i = 0; i < 100; i++) { var star = LK.getAsset('nextCirclePreview', { anchorX: 0.5, anchorY: 0.5 }); star.x = Math.random() * 2048; star.y = Math.random() * 1500; // Only in upper portion of screen star.scaleX = 0.05 + Math.random() * 0.1; star.scaleY = star.scaleX; star.tint = 0xffffff; star.alpha = 0.3 + Math.random() * 0.7; game.addChild(star); cityElements.push(star); } // Create buildings for (var i = 0; i < 8; i++) { var building = LK.getAsset('building', { anchorX: 0.5, anchorY: 1 }); building.x = i * 280 + 140; building.y = 2732; building.scaleX = 1 + Math.random() * 0.5; building.scaleY = 1 + Math.random() * 1.2; building.tint = 0x333333 + Math.random() * 0x333333; // Random dark colors game.addChild(building); cityElements.push(building); } // Create city fog/smog effects var fogElements = []; for (var i = 0; i < 6; i++) { var fog = LK.getAsset('cityFog', { anchorX: 0.5, anchorY: 0.5 }); fog.x = Math.random() * 2048; fog.y = 1800 + Math.random() * 400; fog.tint = 0x666666; // Gray city smog fog.alpha = 0.15 + Math.random() * 0.25; fog.scaleX = 1 + Math.random() * 2; fog.scaleY = 0.6 + Math.random() * 0.8; fog.fogSpeed = 0.3 + Math.random() * 0.7; fog.fogDirection = Math.random() * Math.PI * 2; game.addChild(fog); fogElements.push(fog); } // Create moon var moon = LK.getAsset('moon', { anchorX: 0.5, anchorY: 0.5 }); moon.x = -100; // Start off-screen left moon.y = 400; // Upper portion of screen moon.scaleX = 1.2; moon.scaleY = 1.2; moon.alpha = 0.9; moon.tint = 0xFFFFDD; // Slight cream color // Add click handler to moon moon.down = function (x, y, obj) { LK.getSound('moonClick').play(); // Create and display moon click image var moonClickImage = LK.getAsset('moonClickImage', { anchorX: 0.5, anchorY: 0.5 }); moonClickImage.x = moon.x; moonClickImage.y = moon.y; moonClickImage.alpha = 0.8; game.addChild(moonClickImage); // Animate image to fade out and remove after 1.5 seconds tween(moonClickImage, { alpha: 0, scaleX: 1.5, scaleY: 1.5 }, { duration: 1500, easing: tween.easeOut, onFinish: function onFinish() { game.removeChild(moonClickImage); } }); }; game.addChild(moon); cityElements.push(moon); // Animate moon movement across screen with arc trajectory moon.y = 800; // Start much lower var moonStartY = 800; var moonMidY = 250; // Higher point at middle var moonEndY = 800; // End at same height as start // Function to create complete moon cycle function startMoonCycle() { // First half: move right and up to middle tween(moon, { x: 1024, // Middle of screen (2048/2) y: moonMidY }, { duration: 18000, // 18 seconds to reach middle (slower) easing: tween.easeOut, onFinish: function onFinish() { // Second half: move right and down to end tween(moon, { x: 2148, y: moonEndY }, { duration: 18000, // 18 seconds to reach end (slower) easing: tween.easeIn, onFinish: function onFinish() { // Reset moon and start cycle again moon.x = -100; moon.y = moonStartY; startMoonCycle(); } }); } }); } // Start the moon cycle startMoonCycle(); // Create start screen elements var titleText = new Text2('The amazing digital chaos!', { size: 120, fill: 0xFFD700 }); titleText.anchor.set(0.5, 0.5); titleText.x = 2048 / 2; titleText.y = 2732 / 3; var playButton = LK.getAsset('furniture', { anchorX: 0.5, anchorY: 0.5 }); playButton.x = 2048 / 2; playButton.y = 2732 / 2 - 100; // Move play button up playButton.scaleX = 2.5; // Much larger playButton.scaleY = 1.8; // Taller // Add border effect with second button behind var playButtonBorder = LK.getAsset('furniture', { anchorX: 0.5, anchorY: 0.5 }); playButtonBorder.x = playButton.x; playButtonBorder.y = playButton.y; playButtonBorder.tint = 0x000000; // Black border playButtonBorder.scaleX = 2.6; // Slightly larger for border playButtonBorder.scaleY = 1.9; game.addChild(playButtonBorder); game.addChild(playButton); // Add main button after border var playButtonText = new Text2('JUGAR', { size: 100, // Larger text fill: 0x000000 // Black color }); playButtonText.anchor.set(0.5, 0.5); playButtonText.x = playButton.x; playButtonText.y = playButton.y; // Add start screen elements game.addChild(titleText); game.addChild(playButton); game.addChild(playButtonText); // Store references for easy removal (including city elements) var menuElements = [titleText, playButtonBorder, playButton, playButtonText].concat(cityElements).concat(fogElements); // Create pause button (only visible during gameplay) var pauseButton = LK.getAsset('furniture', { anchorX: 0.5, anchorY: 0.5 }); pauseButton.x = 2048 - 100; pauseButton.y = 150; pauseButton.tint = 0x666666; pauseButton.scaleX = 0.8; pauseButton.scaleY = 0.8; var pauseButtonText = new Text2('||', { size: 60, fill: 0xFFFFFF }); pauseButtonText.anchor.set(0.5, 0.5); pauseButtonText.x = pauseButton.x; pauseButtonText.y = pauseButton.y; // Pause menu elements var pauseMenuElements = []; var pauseTitle = new Text2('PAUSA', { size: 120, fill: 0xFFD700 }); pauseTitle.anchor.set(0.5, 0.5); pauseTitle.x = 2048 / 2; pauseTitle.y = 800; var resumeButton = LK.getAsset('continueButton', { anchorX: 0.5, anchorY: 0.5 }); resumeButton.x = 2048 / 2; resumeButton.y = 1200; resumeButton.scaleX = 2; resumeButton.scaleY = 1.2; var resumeButtonText = new Text2('CONTINUAR', { size: 80, fill: 0x000000 }); resumeButtonText.anchor.set(0.5, 0.5); resumeButtonText.x = resumeButton.x; resumeButtonText.y = resumeButton.y; var menuButton = LK.getAsset('mainMenuButton', { anchorX: 0.5, anchorY: 0.5 }); menuButton.x = 2048 / 2; menuButton.y = 1400; menuButton.scaleX = 2; menuButton.scaleY = 1.2; var menuButtonText = new Text2('MENU PRINCIPAL', { size: 70, fill: 0x000000 }); menuButtonText.anchor.set(0.5, 0.5); menuButtonText.x = menuButton.x; menuButtonText.y = menuButton.y; var restartButton = LK.getAsset('sensitivityButton', { anchorX: 0.5, anchorY: 0.5 }); restartButton.x = 2048 / 2; restartButton.y = 1600; restartButton.scaleX = 2; restartButton.scaleY = 1.2; var restartButtonText = new Text2('REINICIAR', { size: 70, fill: 0x000000 }); restartButtonText.anchor.set(0.5, 0.5); restartButtonText.x = restartButton.x; restartButtonText.y = restartButton.y; pauseMenuElements = [pauseTitle, resumeButton, resumeButtonText, menuButton, menuButtonText, restartButton, restartButtonText]; // Settings screen elements var settingsScreenElements = []; var settingsTitle = new Text2('AJUSTAR SENSIBILIDAD', { size: 100, fill: 0xFFD700 }); settingsTitle.anchor.set(0.5, 0.5); settingsTitle.x = 2048 / 2; settingsTitle.y = 800; var sensitivityText = new Text2('Sensibilidad: ' + Math.round(sensitivity * 100) + '%', { size: 80, fill: 0xFFFFFF }); sensitivityText.anchor.set(0.5, 0.5); sensitivityText.x = 2048 / 2; sensitivityText.y = 1200; var decreaseButton = LK.getAsset('furniture', { anchorX: 0.5, anchorY: 0.5 }); decreaseButton.x = 2048 / 2 - 200; decreaseButton.y = 1400; decreaseButton.tint = 0xFF4444; decreaseButton.scaleX = 1.5; decreaseButton.scaleY = 1.2; var decreaseButtonText = new Text2('-', { size: 100, fill: 0xFFFFFF }); decreaseButtonText.anchor.set(0.5, 0.5); decreaseButtonText.x = decreaseButton.x; decreaseButtonText.y = decreaseButton.y; var increaseButton = LK.getAsset('furniture', { anchorX: 0.5, anchorY: 0.5 }); increaseButton.x = 2048 / 2 + 200; increaseButton.y = 1400; increaseButton.tint = 0x44FF44; increaseButton.scaleX = 1.5; increaseButton.scaleY = 1.2; var increaseButtonText = new Text2('+', { size: 100, fill: 0xFFFFFF }); increaseButtonText.anchor.set(0.5, 0.5); increaseButtonText.x = increaseButton.x; increaseButtonText.y = increaseButton.y; var backFromSettingsButton = LK.getAsset('furniture', { anchorX: 0.5, anchorY: 0.5 }); backFromSettingsButton.x = 2048 / 2; backFromSettingsButton.y = 1700; backFromSettingsButton.tint = 0x888888; backFromSettingsButton.scaleX = 1.8; backFromSettingsButton.scaleY = 1.2; var backFromSettingsButtonText = new Text2('VOLVER', { size: 70, fill: 0xFFFFFF }); backFromSettingsButtonText.anchor.set(0.5, 0.5); backFromSettingsButtonText.x = backFromSettingsButton.x; backFromSettingsButtonText.y = backFromSettingsButton.y; settingsScreenElements = [settingsTitle, sensitivityText, decreaseButton, decreaseButtonText, increaseButton, increaseButtonText, backFromSettingsButton, backFromSettingsButtonText]; // Function to start the game function startGame() { gameState = 'playing'; // Remove menu elements for (var i = 0; i < menuElements.length; i++) { game.removeChild(menuElements[i]); } // Add game elements game.addChild(leftWall); game.addChild(rightWall); game.addChild(bottomWall); game.addChild(topWall); game.addChild(scoreText); game.addChild(nextCirclePreview); game.addChild(nextCircleText); // Add pause button game.addChild(pauseButton); game.addChild(pauseButtonText); // Create wooden board below container woodenBoard = LK.getAsset('woodenBoard', { anchorX: 0.5, anchorY: 0 }); woodenBoard.x = containerX + containerWidth / 2; woodenBoard.y = containerY + containerHeight + 50; game.addChild(woodenBoard); // Create 3 buttons on the wooden board button1 = LK.getAsset('button1', { anchorX: 0.5, anchorY: 0.5 }); button1.x = woodenBoard.x - 300; button1.y = woodenBoard.y + 100; game.addChild(button1); button1Text = new Text2('BOTON 1', { size: 30, fill: 0xFFFFFF }); button1Text.anchor.set(0.5, 0.5); button1Text.x = button1.x; button1Text.y = button1.y; game.addChild(button1Text); button2 = LK.getAsset('button2', { anchorX: 0.5, anchorY: 0.5 }); button2.x = woodenBoard.x; button2.y = woodenBoard.y + 100; game.addChild(button2); button2Text = new Text2('BOTON 2', { size: 30, fill: 0xFFFFFF }); button2Text.anchor.set(0.5, 0.5); button2Text.x = button2.x; button2Text.y = button2.y; game.addChild(button2Text); button3 = LK.getAsset('button3', { anchorX: 0.5, anchorY: 0.5 }); button3.x = woodenBoard.x + 300; button3.y = woodenBoard.y + 100; game.addChild(button3); button3Text = new Text2('BOTON 3', { size: 30, fill: 0xFFFFFF }); button3Text.anchor.set(0.5, 0.5); button3Text.x = button3.x; button3Text.y = button3.y; game.addChild(button3Text); // Initialize first circle generateNextCircle(); gameStarted = true; } // Function to show pause menu function showPauseMenu() { gameState = 'paused'; // Add pause menu elements for (var i = 0; i < pauseMenuElements.length; i++) { game.addChild(pauseMenuElements[i]); } } // Function to resume game function resumeGame() { gameState = 'playing'; // Remove pause menu elements for (var i = 0; i < pauseMenuElements.length; i++) { game.removeChild(pauseMenuElements[i]); } } // Function to show settings screen function showSettings() { gameState = 'settings'; // Remove pause menu elements for (var i = 0; i < pauseMenuElements.length; i++) { game.removeChild(pauseMenuElements[i]); } // Add settings elements for (var i = 0; i < settingsScreenElements.length; i++) { game.addChild(settingsScreenElements[i]); } } // Function to go back to pause menu from settings function backToPauseMenu() { gameState = 'paused'; // Remove settings elements for (var i = 0; i < settingsScreenElements.length; i++) { game.removeChild(settingsScreenElements[i]); } // Add pause menu elements for (var i = 0; i < pauseMenuElements.length; i++) { game.addChild(pauseMenuElements[i]); } } // Function to restart game function restartGame() { gameState = 'playing'; // Remove pause menu elements for (var i = 0; i < pauseMenuElements.length; i++) { game.removeChild(pauseMenuElements[i]); } // Remove all circles for (var i = 0; i < circles.length; i++) { game.removeChild(circles[i]); } circles = []; if (currentCircle) { game.removeChild(currentCircle); currentCircle = null; } if (dropLine) { game.removeChild(dropLine); dropLine = null; } // Reset game state score = 0; nextCircleType = 1; scoreText.setText('Score: 0'); // Generate new next circle generateNextCircle(); gameStarted = true; } // Function to return to main menu from pause function returnToMainMenu() { gameState = 'menu'; // Remove pause menu elements for (var i = 0; i < pauseMenuElements.length; i++) { game.removeChild(pauseMenuElements[i]); } // Remove game elements game.removeChild(leftWall); game.removeChild(rightWall); game.removeChild(bottomWall); game.removeChild(topWall); game.removeChild(scoreText); game.removeChild(nextCirclePreview); game.removeChild(nextCircleText); if (currentCircle) { game.removeChild(currentCircle); currentCircle = null; } if (dropLine) { game.removeChild(dropLine); dropLine = null; } // Remove all circles for (var i = 0; i < circles.length; i++) { game.removeChild(circles[i]); } circles = []; game.removeChild(pauseButton); game.removeChild(pauseButtonText); // Remove wooden board and buttons if (woodenBoard) { game.removeChild(woodenBoard); } if (button1) { game.removeChild(button1); game.removeChild(button1Text); } if (button2) { game.removeChild(button2); game.removeChild(button2Text); } if (button3) { game.removeChild(button3); game.removeChild(button3Text); } // Reset game state score = 0; nextCircleType = 1; gameStarted = false; // Add menu elements back for (var i = 0; i < menuElements.length; i++) { game.addChild(menuElements[i]); } } // Movement controls var keys = { up: false, down: false, left: false, right: false }; // Touch/mouse controls var isDragging = false; var lastTouchX = 0; var lastTouchY = 0; // Wooden board and buttons var woodenBoard = null; var button1 = null; var button1Text = null; var button2 = null; var button2Text = null; var button3 = null; var button3Text = null; // Circle selection system var selectionMode = false; var selectedCircles = []; var maxSelectableCircles = 2; function generateNextCircle() { nextCircleType = Math.floor(Math.random() * 3) + 1; // Random circle type 1-3 only // Update preview game.removeChild(nextCirclePreview); nextCirclePreview = LK.getAsset('circle' + nextCircleType, { anchorX: 0.5, anchorY: 0.5 }); nextCirclePreview.x = containerX + containerWidth + 100; nextCirclePreview.y = 400; nextCirclePreview.scaleX = 0.6; nextCirclePreview.scaleY = 0.6; game.addChild(nextCirclePreview); } game.down = function (x, y, obj) { if (gameState === 'menu') { // Check if play button was clicked var playButtonBounds = { left: playButton.x - playButton.width * playButton.scaleX / 2, right: playButton.x + playButton.width * playButton.scaleX / 2, top: playButton.y - playButton.height * playButton.scaleY / 2, bottom: playButton.y + playButton.height * playButton.scaleY / 2 }; if (x >= playButtonBounds.left && x <= playButtonBounds.right && y >= playButtonBounds.top && y <= playButtonBounds.bottom) { startGame(); } } else if (gameState === 'playing') { // Check if pause button was clicked var pauseButtonBounds = { left: pauseButton.x - pauseButton.width * pauseButton.scaleX / 2, right: pauseButton.x + pauseButton.width * pauseButton.scaleX / 2, top: pauseButton.y - pauseButton.height * pauseButton.scaleY / 2, bottom: pauseButton.y + pauseButton.height * pauseButton.scaleY / 2 }; if (x >= pauseButtonBounds.left && x <= pauseButtonBounds.right && y >= pauseButtonBounds.top && y <= pauseButtonBounds.bottom) { showPauseMenu(); } else { // Check if button1 was clicked (only if button1 exists) if (button1) { var button1Bounds = { left: button1.x - button1.width * button1.scaleX / 2, right: button1.x + button1.width * button1.scaleX / 2, top: button1.y - button1.height * button1.scaleY / 2, bottom: button1.y + button1.height * button1.scaleY / 2 }; if (x >= button1Bounds.left && x <= button1Bounds.right && y >= button1Bounds.top && y <= button1Bounds.bottom) { // Enable selection mode if (!selectionMode) { selectionMode = true; selectedCircles = []; // Change button text to indicate selection mode button1Text.setText('SELECCIONA 2'); } else { // Cancel selection mode selectionMode = false; // Reset all selected circles for (var i = 0; i < selectedCircles.length; i++) { var circle = selectedCircles[i]; circle.isSelected = false; var circleGraphics = circle.children[0]; if (circleGraphics) { circleGraphics.tint = circle.originalTint; } } selectedCircles = []; button1Text.setText('BOTON 1'); } } } if (x >= containerX + 20 && x <= containerX + containerWidth - 20) { // Create and drop a circle var newCircle = new Circle(nextCircleType); newCircle.x = Math.max(containerX + 50, Math.min(x, containerX + containerWidth - 50)); newCircle.y = containerY - 100; // Spawn above the red line newCircle.velocityY = 2; newCircle.velocityX = 0; newCircle.lastY = newCircle.y; newCircle.lastIntersecting = false; // Set individual spawn immunity for this circle newCircle.spawnImmunity = true; newCircle.spawnTime = LK.ticks; game.addChild(newCircle); circles.push(newCircle); // Use tween to disable immunity after 3 seconds for this specific circle var immunityObj = { immunity: 1 }; tween(immunityObj, { immunity: 0 }, { duration: 3000, onFinish: function onFinish() { newCircle.spawnImmunity = false; } }); generateNextCircle(); } } } else if (gameState === 'paused') { // Handle pause menu interactions var resumeButtonBounds = { left: resumeButton.x - resumeButton.width * resumeButton.scaleX / 2, right: resumeButton.x + resumeButton.width * resumeButton.scaleX / 2, top: resumeButton.y - resumeButton.height * resumeButton.scaleY / 2, bottom: resumeButton.y + resumeButton.height * resumeButton.scaleY / 2 }; var menuButtonBounds = { left: menuButton.x - menuButton.width * menuButton.scaleX / 2, right: menuButton.x + menuButton.width * menuButton.scaleX / 2, top: menuButton.y - menuButton.height * menuButton.scaleY / 2, bottom: menuButton.y + menuButton.height * menuButton.scaleY / 2 }; var restartButtonBounds = { left: restartButton.x - restartButton.width * restartButton.scaleX / 2, right: restartButton.x + restartButton.width * restartButton.scaleX / 2, top: restartButton.y - restartButton.height * restartButton.scaleY / 2, bottom: restartButton.y + restartButton.height * restartButton.scaleY / 2 }; if (x >= resumeButtonBounds.left && x <= resumeButtonBounds.right && y >= resumeButtonBounds.top && y <= resumeButtonBounds.bottom) { resumeGame(); } else if (x >= menuButtonBounds.left && x <= menuButtonBounds.right && y >= menuButtonBounds.top && y <= menuButtonBounds.bottom) { returnToMainMenu(); } else if (x >= restartButtonBounds.left && x <= restartButtonBounds.right && y >= restartButtonBounds.top && y <= restartButtonBounds.bottom) { restartGame(); } } else if (gameState === 'settings') { // Handle settings interactions var decreaseButtonBounds = { left: decreaseButton.x - decreaseButton.width * decreaseButton.scaleX / 2, right: decreaseButton.x + decreaseButton.width * decreaseButton.scaleX / 2, top: decreaseButton.y - decreaseButton.height * decreaseButton.scaleY / 2, bottom: decreaseButton.y + decreaseButton.height * decreaseButton.scaleY / 2 }; var increaseButtonBounds = { left: increaseButton.x - increaseButton.width * increaseButton.scaleX / 2, right: increaseButton.x + increaseButton.width * increaseButton.scaleX / 2, top: increaseButton.y - increaseButton.height * increaseButton.scaleY / 2, bottom: increaseButton.y + increaseButton.height * increaseButton.scaleY / 2 }; var backFromSettingsButtonBounds = { left: backFromSettingsButton.x - backFromSettingsButton.width * backFromSettingsButton.scaleX / 2, right: backFromSettingsButton.x + backFromSettingsButton.width * backFromSettingsButton.scaleX / 2, top: backFromSettingsButton.y - backFromSettingsButton.height * backFromSettingsButton.scaleY / 2, bottom: backFromSettingsButton.y + backFromSettingsButton.height * backFromSettingsButton.scaleY / 2 }; if (x >= decreaseButtonBounds.left && x <= decreaseButtonBounds.right && y >= decreaseButtonBounds.top && y <= decreaseButtonBounds.bottom) { sensitivity = Math.max(0.1, sensitivity - 0.1); storage.sensitivity = sensitivity; sensitivityText.setText('Sensibilidad: ' + Math.round(sensitivity * 100) + '%'); } else if (x >= increaseButtonBounds.left && x <= increaseButtonBounds.right && y >= increaseButtonBounds.top && y <= increaseButtonBounds.bottom) { sensitivity = Math.min(1.0, sensitivity + 0.1); storage.sensitivity = sensitivity; sensitivityText.setText('Sensibilidad: ' + Math.round(sensitivity * 100) + '%'); } else if (x >= backFromSettingsButtonBounds.left && x <= backFromSettingsButtonBounds.right && y >= backFromSettingsButtonBounds.top && y <= backFromSettingsButtonBounds.bottom) { backToPauseMenu(); } } }; game.move = function (x, y, obj) { // No movement tracking needed for Suika Game }; game.up = function (x, y, obj) { if (gameState === 'playing') { isDragging = false; } }; // Suika Game helper functions can be added here if needed // Main game update game.update = function () { // Animate fog elements in menu if (gameState === 'menu') { for (var i = 0; i < fogElements.length; i++) { var fog = fogElements[i]; fog.x += Math.cos(fog.fogDirection) * fog.fogSpeed; fog.y += Math.sin(fog.fogDirection) * fog.fogSpeed * 0.3; fog.alpha += Math.sin(LK.ticks * 0.02 + i) * 0.01; // Keep fog within bounds and wrap around if (fog.x < -100) fog.x = 2148; if (fog.x > 2148) fog.x = -100; if (fog.y < 1000) fog.y = 2200; if (fog.y > 2200) fog.y = 1000; } } if (gameState === 'playing') { // Update button1 text based on selection mode if (button1Text) { if (selectionMode) { var remaining = maxSelectableCircles - selectedCircles.length; if (remaining > 0) { button1Text.setText('SELECCIONA ' + remaining); } else { button1Text.setText('ELIMINANDO...'); } } else { button1Text.setText('BOTON 1'); } } // Handle circle merging var mergedCircles = []; var circlesToRemove = []; for (var i = circles.length - 1; i >= 0; i--) { var circle = circles[i]; if (circle.shouldMerge && circle.mergeInto) { // Only add the merged circle once if (mergedCircles.indexOf(circle.mergeInto) === -1) { game.addChild(circle.mergeInto); mergedCircles.push(circle.mergeInto); circles.push(circle.mergeInto); circle.mergeInto.lastY = circle.mergeInto.y; circle.mergeInto.lastIntersecting = false; // Set spawn immunity for merged circles circle.mergeInto.spawnImmunity = true; circle.mergeInto.spawnTime = LK.ticks; // Use tween to disable immunity after 3 seconds for merged circle var mergedImmunityObj = { immunity: 1 }; var mergedCircle = circle.mergeInto; // Capture reference before tween tween(mergedImmunityObj, { immunity: 0 }, { duration: 3000, onFinish: function onFinish() { if (mergedCircle) { mergedCircle.spawnImmunity = false; } } }); } // Mark circle for removal circlesToRemove.push(circle); } } // Remove all circles that merged for (var j = 0; j < circlesToRemove.length; j++) { var circleToRemove = circlesToRemove[j]; game.removeChild(circleToRemove); var index = circles.indexOf(circleToRemove); if (index > -1) { circles.splice(index, 1); } } // Check for game over (circle rises and touches the red line) for (var i = 0; i < circles.length; i++) { var circle = circles[i]; // Only trigger game over if circle touches the red line and this specific circle's immunity is not active if (circle.y - circle.radius <= containerY && !circle.spawnImmunity) { // Game over condition - circle touched the red line LK.showGameOver(); return; } } } };
===================================================================
--- original.js
+++ change.js
@@ -592,54 +592,54 @@
// Add pause button
game.addChild(pauseButton);
game.addChild(pauseButtonText);
// Create wooden board below container
- var woodenBoard = LK.getAsset('woodenBoard', {
+ woodenBoard = LK.getAsset('woodenBoard', {
anchorX: 0.5,
anchorY: 0
});
woodenBoard.x = containerX + containerWidth / 2;
woodenBoard.y = containerY + containerHeight + 50;
game.addChild(woodenBoard);
// Create 3 buttons on the wooden board
- var button1 = LK.getAsset('button1', {
+ button1 = LK.getAsset('button1', {
anchorX: 0.5,
anchorY: 0.5
});
button1.x = woodenBoard.x - 300;
button1.y = woodenBoard.y + 100;
game.addChild(button1);
- var button1Text = new Text2('BOTON 1', {
+ button1Text = new Text2('BOTON 1', {
size: 30,
fill: 0xFFFFFF
});
button1Text.anchor.set(0.5, 0.5);
button1Text.x = button1.x;
button1Text.y = button1.y;
game.addChild(button1Text);
- var button2 = LK.getAsset('button2', {
+ button2 = LK.getAsset('button2', {
anchorX: 0.5,
anchorY: 0.5
});
button2.x = woodenBoard.x;
button2.y = woodenBoard.y + 100;
game.addChild(button2);
- var button2Text = new Text2('BOTON 2', {
+ button2Text = new Text2('BOTON 2', {
size: 30,
fill: 0xFFFFFF
});
button2Text.anchor.set(0.5, 0.5);
button2Text.x = button2.x;
button2Text.y = button2.y;
game.addChild(button2Text);
- var button3 = LK.getAsset('button3', {
+ button3 = LK.getAsset('button3', {
anchorX: 0.5,
anchorY: 0.5
});
button3.x = woodenBoard.x + 300;
button3.y = woodenBoard.y + 100;
game.addChild(button3);
- var button3Text = new Text2('BOTON 3', {
+ button3Text = new Text2('BOTON 3', {
size: 30,
fill: 0xFFFFFF
});
button3Text.anchor.set(0.5, 0.5);
Niebla terrorifica. In-Game asset. 2d. High contrast. No shadows
marco de boton de inicio sin palabras en el. In-Game asset. 2d. High contrast. No shadows
una estrella hermosa con cara kawai que en su frente diga Dazai. In-Game asset. 2d. High contrast. No shadows
una luna redondita kawai con lentes de sol, en su frente lleva una sinta que dice STAR. In-Game asset. 2d. High contrast. No shadows
sacale el fondo de color negro, dejando solo al personaje con el redondeado rojo
un oso redondo. In-Game asset. 2d. High contrast. No shadows
un monito en una imagen redonda, el monito lleva gafas de sol, es de plastico y tiene una sonrisa. In-Game asset. 2d. High contrast. No shadows
un oso redondito, con una aureola, cara kawai y con los brazitos juntitos como rezando y cantando. In-Game asset. 2d. High contrast. No shadows
Nube realista de noche. In-Game asset. 2d. High contrast. No shadows
un edificio pixel art por la noche. In-Game asset. 2d. High contrast. No shadows
un boton color rojo, dentro de el hay un dibujo de dos flechas como indicando que se mezcla algo. In-Game asset. 2d. High contrast. No shadows
un boton redondo color amarillo, dentro de el hay un dinujo de una corona brillante. In-Game asset. 2d. High contrast. No shadows
una tabla de madera alargada como si fuese de una cocina. In-Game asset. 2d. High contrast. No shadows
Una luna brillante. In-Game asset. 2d. High contrast. No shadows
un corazon pixeleado al estilo de DELTARUNE u Undertale. In-Game asset. 2d. High contrast. No shadows
Jevil, un jefe del capitulo 1 de deltarune, es pixleado y el fondo detras de este es color blanco. In-Game asset. 2d. High contrast. No shadows
un diamante, es pixeleado, solo mejora su calidad, no cambies su forma
haz que este trebol blanco, sea pixeleado de 16x16
Jevil de deltarune capitulo uno siendo golpeado en el estomago echandose un poco para atras aunque con una risa loca en su rostro (pixeleado con fondo blanco). In-Game asset. 2d. High contrast. No shadows
Una caja sorpresa cerrada en blanco y negro pixeleado en 16x16 pixeles, en la caja hay un dibujo de unos ojos y sonrisa de Jevil de deltarune. el fondo de la imagen es de color rojo
un corazon de color blanco con bordes negros, el mismo que lanza Jevil en deltarune capitulo 1, el corazon es pixeleado 16x16 (el fondo de la imagen sea roja). In-Game asset. 2d. High contrast. No shadows
una bomba redonda, color blanco con bordes de color negro, es pixeleada de 16x16 (la imagen tiene fondo rojo). In-Game asset. 2d. High contrast. No shadows