User prompt
mejora la caja de colision de los circulos para que no se sobrepongan encima de otros
User prompt
cambia el nombre del juego a: The amazing digital chaos!
User prompt
mejora el hitbox de la colision entre los circulos que no son pares, para que no se sobrepongan por encima de las otras
User prompt
borra estos elementos: House, Character 1, Character 2 y Character 3
User prompt
borra una lo de las skins porfavor
User prompt
borra estos elementos del juego ya que no cumplen ninguna funcion: DECORATION, FLOOR Y TREE
User prompt
elimina el boton de personajes y pon uno de Skins, para cambiar la skin de Todos los circulos
User prompt
vuelve a agregar el circulo numero 3 porfa
User prompt
haz que las fisicas de los circulos sea mejor, que cuando otro circulo lo golpee se mueva mas como si fuese una canica real
User prompt
haz que los circulos den vueltas su imagen cuando para que no se vean tan duros cuando se mueven o caen ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
haz que todos los circulos sean mas grandes
User prompt
elimina el boton de la sensibilidad y en su lugar agrega un boton llamado Reiniciar, para reiniciar el nivel, en el modo pausa
User prompt
haz que los circulos sean todos mas grandes y que al momento de que dos se fusionen, se combiertan en uno solo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
bien, ahora haz que cuando un circulo toque a otro de su mismo tipo, se fusionen y hagan uno mas grande, haciendo que de los dos, solo salga 1 mas grande ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
arregla el error, al momento de hacer click en la pantalla el juego detecta como que perdi, arregla eso
User prompt
arregla el error de perder si tocas la pantalla ya que los circulos no caen en el frasco
User prompt
haz mas grande el frasco, como 2 veces mas grande de lo que es para que ocupe casi toda la pantalla, y soluciona el error al hacer click en la pantalla, y haz que los circulos caigan en el frasco, y solamente se pueda perder si los circulos llegan a pasar por encima de la boca de el frasco
User prompt
haz que el frasco sea mucho mas grande, que se vea bastante bien, y haz que los circulos al momento de hacer click, caigan en el frasco
User prompt
ahora, el inicio del juego y las cosas de la pausa dejalos tal y como estan, pero el juego cambialo, haz que sea una plantilla de juego como Suika Game, osea genera un Frasco gigante en el cual van a ir callendo circulos de diversos tamaños
User prompt
que los colores de los nombres de CONTINUAR, MENU PRINCIPAL y SENSIBILIDAD de la pausa sean de color negro
User prompt
haz que los botones de CONTINUAR, MENU PRINCIPAL y SENSIBILIDAD de la pausa, tengan sus propios diseños para que yo pueda cambiar y asi no tengan el mismo diseño que el boton de jugar
User prompt
haz que los personajes sean un poco mas grandes
User prompt
haz que el color de las letras de Jugar sea de color Negro, y que el color de las letras de Personajes sea tambien negro
User prompt
quitale los efectos verdes del boton de Jugar para que solo quede el boton que dice Jugar y el diseño de boton que yo implemente, lo mismo haz con el boton de Personajes
User prompt
haz que el diseño del boton de Personajes no sea el mismo que el de Jugar, asi yo puedo personalizar su diseño
/****
* 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][circleType - 1];
self.lastY = 0;
self.lastIntersecting = 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;
// 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
}
// 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);
var minDistance = self.radius + other.radius;
if (distance < minDistance && distance > 0) {
// Same size circles merge
if (self.circleType === other.circleType && self.circleType < 7) {
// 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;
}
// Improved collision response with better physics
var overlap = minDistance - distance;
var halfOverlap = overlap * 0.5;
var normalX = dx / distance;
var normalY = dy / distance;
// Separate circles based on their relative masses (size)
var mass1 = self.radius * self.radius; // Mass proportional to area
var mass2 = other.radius * other.radius;
var totalMass = mass1 + mass2;
var ratio1 = mass2 / totalMass; // Heavier objects move less
var ratio2 = mass1 / totalMass;
// Position correction with mass consideration
self.x += normalX * overlap * ratio1;
self.y += normalY * overlap * ratio1;
other.x -= normalX * overlap * ratio2;
other.y -= normalY * overlap * ratio2;
// Realistic velocity exchange with conservation of momentum
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) {
// Coefficient of restitution (bounciness) - marble-like behavior
var restitution = 0.75;
var impulse = -(1 + restitution) * separatingVelocity / (1 / mass1 + 1 / mass2);
// Apply impulse to velocities
var impulseX = impulse * normalX;
var impulseY = impulse * normalY;
self.velocityX += impulseX / mass1;
self.velocityY += impulseY / mass1;
other.velocityX -= impulseX / mass2;
other.velocityY -= impulseY / mass2;
// Add some tangential friction for more realistic behavior
var tangentX = -normalY;
var tangentY = normalX;
var tangentialVelocity = relativeVelocityX * tangentX + relativeVelocityY * tangentY;
var friction = 0.1;
var frictionImpulse = tangentialVelocity * friction;
self.velocityX -= frictionImpulse * tangentX / mass1;
self.velocityY -= frictionImpulse * tangentY / mass1;
other.velocityX += frictionImpulse * tangentX / mass2;
other.velocityY += frictionImpulse * tangentY / mass2;
}
}
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Keep menu assets
// Suika Game assets
// Game state management
var gameState = 'menu'; // 'menu', 'characters', 'playing', 'paused', or 'settings'
var selectedCharacter = 'player'; // Default character
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;
// 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;
// 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 dark purple horror background for menu
var horrorBackground = LK.getAsset('floor', {
anchorX: 0,
anchorY: 0
});
horrorBackground.x = 0;
horrorBackground.y = 0;
horrorBackground.width = 2048;
horrorBackground.height = 2732;
horrorBackground.tint = 0x301934; // Dark purple color
game.addChild(horrorBackground);
// Create forest background with trees
var forestElements = [];
for (var i = 0; i < 15; i++) {
var tree = LK.getAsset('tree', {
anchorX: 0.5,
anchorY: 1
});
tree.x = Math.random() * 2048;
tree.y = 1800 + Math.random() * 400; // Trees at bottom part
tree.tint = 0x1a2e14; // Very dark green
tree.alpha = 0.6;
tree.scaleX = 0.8 + Math.random() * 0.8;
tree.scaleY = 1 + Math.random() * 0.5;
game.addChild(tree);
forestElements.push(tree);
}
// Add more trees in background
for (var i = 0; i < 10; i++) {
var tree = LK.getAsset('tree', {
anchorX: 0.5,
anchorY: 1
});
tree.x = Math.random() * 2048;
tree.y = 1000 + Math.random() * 600;
tree.tint = 0x0f1a0a; // Even darker green
tree.alpha = 0.4;
tree.scaleX = 0.5 + Math.random() * 0.6;
tree.scaleY = 0.8 + Math.random() * 0.4;
game.addChild(tree);
forestElements.push(tree);
}
// Create spooky house in the center
var spookyHouse = LK.getAsset('house', {
anchorX: 0.5,
anchorY: 0.5
});
spookyHouse.x = 2048 / 2;
spookyHouse.y = 1600;
spookyHouse.tint = 0x2a1f17; // Dark brown
spookyHouse.alpha = 0.8;
game.addChild(spookyHouse);
forestElements.push(spookyHouse);
// Add house windows (dark rectangles)
var window1 = LK.getAsset('decoration', {
anchorX: 0.5,
anchorY: 0.5
});
window1.x = spookyHouse.x - 60;
window1.y = spookyHouse.y - 20;
window1.tint = 0x000000;
window1.scaleX = 1.2;
window1.scaleY = 1.5;
game.addChild(window1);
forestElements.push(window1);
var window2 = LK.getAsset('decoration', {
anchorX: 0.5,
anchorY: 0.5
});
window2.x = spookyHouse.x + 60;
window2.y = spookyHouse.y - 20;
window2.tint = 0x000000;
window2.scaleX = 1.2;
window2.scaleY = 1.5;
game.addChild(window2);
forestElements.push(window2);
// Create animated fog effects
var fogElements = [];
for (var i = 0; i < 12; i++) {
var fog = LK.getAsset('fog', {
anchorX: 0.5,
anchorY: 0.5
});
fog.x = Math.random() * 2048;
fog.y = 1200 + Math.random() * 800;
fog.tint = 0x4a4a4a; // Gray fog
fog.alpha = 0.2 + Math.random() * 0.3;
fog.scaleX = 1 + Math.random() * 2;
fog.scaleY = 0.8 + Math.random() * 1.2;
fog.fogSpeed = 0.5 + Math.random() * 1;
fog.fogDirection = Math.random() * Math.PI * 2;
game.addChild(fog);
fogElements.push(fog);
}
// Create multiple shadow/fog elements for horror atmosphere
var shadowElements = [];
for (var i = 0; i < 8; i++) {
var shadow = LK.getAsset('decoration', {
anchorX: 0.5,
anchorY: 0.5
});
shadow.x = Math.random() * 2048;
shadow.y = Math.random() * 2732;
shadow.tint = 0x1a0d1f; // Very dark purple
shadow.alpha = 0.3;
shadow.scaleX = Math.random() * 3 + 2;
shadow.scaleY = Math.random() * 3 + 2;
game.addChild(shadow);
shadowElements.push(shadow);
}
// Create start screen elements
var titleText = new Text2('Warm Room Explorer', {
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;
var charactersButton = LK.getAsset('house', {
anchorX: 0.5,
anchorY: 0.5
});
charactersButton.x = 2048 / 2;
charactersButton.y = 2732 / 2 + 200; // More spacing from play button
charactersButton.scaleX = 1.5; // Wider house shape
charactersButton.scaleY = 1.8; // Taller for better proportions
// Add border for characters button using decoration asset
var charactersButtonBorder = LK.getAsset('decoration', {
anchorX: 0.5,
anchorY: 0.5
});
charactersButtonBorder.x = charactersButton.x;
charactersButtonBorder.y = charactersButton.y;
charactersButtonBorder.tint = 0x000000; // Black border
charactersButtonBorder.scaleX = 8; // Much larger for house-sized border
charactersButtonBorder.scaleY = 7; // Proportional to house
game.addChild(charactersButtonBorder);
game.addChild(charactersButton);
var charactersButtonText = new Text2('PERSONAJES', {
size: 80,
//{26} // Larger text size
fill: 0x000000 //{27} // Black color
});
charactersButtonText.anchor.set(0.5, 0.5);
charactersButtonText.x = charactersButton.x;
charactersButtonText.y = charactersButton.y;
// Add start screen elements
game.addChild(titleText);
game.addChild(playButton);
game.addChild(playButtonText);
game.addChild(charactersButton);
game.addChild(charactersButtonText);
// Store references for easy removal (including horror elements)
var menuElements = [horrorBackground, titleText, playButtonBorder, playButton, playButtonText, charactersButtonBorder, charactersButton, charactersButtonText].concat(shadowElements).concat(forestElements).concat(fogElements);
// Character selection screen elements
var characterScreenElements = [];
var characterSelectionTitle = new Text2('Selecciona tu Personaje', {
size: 100,
fill: 0xFFD700
});
characterSelectionTitle.anchor.set(0.5, 0.5);
characterSelectionTitle.x = 2048 / 2;
characterSelectionTitle.y = 600;
// Character selection buttons
var character1Button = LK.getAsset('character1', {
anchorX: 0.5,
anchorY: 0.5
});
character1Button.x = 2048 / 2 - 300;
character1Button.y = 1200;
character1Button.scaleX = 2.5;
character1Button.scaleY = 2.5;
character1Button.tint = 0xFF6B6B; // Red tint for character 1
var character2Button = LK.getAsset('character2', {
anchorX: 0.5,
anchorY: 0.5
});
character2Button.x = 2048 / 2;
character2Button.y = 1200;
character2Button.scaleX = 2.5;
character2Button.scaleY = 2.5;
character2Button.tint = 0x4ECDC4; // Teal tint for character 2
var character3Button = LK.getAsset('character3', {
anchorX: 0.5,
anchorY: 0.5
});
character3Button.x = 2048 / 2 + 300;
character3Button.y = 1200;
character3Button.scaleX = 2.5;
character3Button.scaleY = 2.5;
character3Button.tint = 0x95E1D3; // Light green tint for character 3
// Character names
var char1Text = new Text2('Explorador', {
size: 60,
fill: 0xFFFFFF
});
char1Text.anchor.set(0.5, 0.5);
char1Text.x = character1Button.x;
char1Text.y = character1Button.y + 100;
var char2Text = new Text2('Aventurero', {
size: 60,
fill: 0xFFFFFF
});
char2Text.anchor.set(0.5, 0.5);
char2Text.x = character2Button.x;
char2Text.y = character2Button.y + 100;
var char3Text = new Text2('Cazador', {
size: 60,
fill: 0xFFFFFF
});
char3Text.anchor.set(0.5, 0.5);
char3Text.x = character3Button.x;
char3Text.y = character3Button.y + 100;
// Back button for character selection
var backButton = LK.getAsset('furniture', {
anchorX: 0.5,
anchorY: 0.5
});
backButton.x = 2048 / 2;
backButton.y = 1800;
backButton.tint = 0x888888;
backButton.scaleX = 1.2;
backButton.scaleY = 0.8;
var backButtonText = new Text2('VOLVER', {
size: 60,
fill: 0xFFFFFF
});
backButtonText.anchor.set(0.5, 0.5);
backButtonText.x = backButton.x;
backButtonText.y = backButton.y;
characterScreenElements = [characterSelectionTitle, character1Button, character2Button, character3Button, char1Text, char2Text, char3Text, backButton, backButtonText];
// 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 pauseMenuBackground = LK.getAsset('floor', {
anchorX: 0,
anchorY: 0
});
pauseMenuBackground.x = 0;
pauseMenuBackground.y = 0;
pauseMenuBackground.width = 2048;
pauseMenuBackground.height = 2732;
pauseMenuBackground.tint = 0x000000;
pauseMenuBackground.alpha = 0.8;
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 = [pauseMenuBackground, 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 = [pauseMenuBackground, settingsTitle, sensitivityText, decreaseButton, decreaseButtonText, increaseButton, increaseButtonText, backFromSettingsButton, backFromSettingsButtonText];
// Function to show character selection screen
function showCharacterSelection() {
gameState = 'characters';
// Remove menu elements
for (var i = 0; i < menuElements.length; i++) {
game.removeChild(menuElements[i]);
}
// Add character selection elements
for (var i = 0; i < characterScreenElements.length; i++) {
game.addChild(characterScreenElements[i]);
}
}
// Function to go back to main menu
function backToMenu() {
gameState = 'menu';
// Remove character selection elements
for (var i = 0; i < characterScreenElements.length; i++) {
game.removeChild(characterScreenElements[i]);
}
// Add menu elements back
for (var i = 0; i < menuElements.length; i++) {
game.addChild(menuElements[i]);
}
}
// 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(scoreText);
game.addChild(nextCirclePreview);
game.addChild(nextCircleText);
// Add pause button
game.addChild(pauseButton);
game.addChild(pauseButtonText);
// 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(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);
// 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;
function generateNextCircle() {
nextCircleType = Math.floor(Math.random() * 4) + 1; // Random circle type 1-4
// 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();
}
// Check if characters button was clicked
var charactersButtonBounds = {
left: charactersButton.x - charactersButton.width * charactersButton.scaleX / 2,
right: charactersButton.x + charactersButton.width * charactersButton.scaleX / 2,
top: charactersButton.y - charactersButton.height * charactersButton.scaleY / 2,
bottom: charactersButton.y + charactersButton.height * charactersButton.scaleY / 2
};
if (x >= charactersButtonBounds.left && x <= charactersButtonBounds.right && y >= charactersButtonBounds.top && y <= charactersButtonBounds.bottom) {
showCharacterSelection();
}
} else if (gameState === 'characters') {
// Character selection logic
var char1Bounds = {
left: character1Button.x - character1Button.width * character1Button.scaleX / 2,
right: character1Button.x + character1Button.width * character1Button.scaleX / 2,
top: character1Button.y - character1Button.height * character1Button.scaleY / 2,
bottom: character1Button.y + character1Button.height * character1Button.scaleY / 2
};
var char2Bounds = {
left: character2Button.x - character2Button.width * character2Button.scaleX / 2,
right: character2Button.x + character2Button.width * character2Button.scaleX / 2,
top: character2Button.y - character2Button.height * character2Button.scaleY / 2,
bottom: character2Button.y + character2Button.height * character2Button.scaleY / 2
};
var char3Bounds = {
left: character3Button.x - character3Button.width * character3Button.scaleX / 2,
right: character3Button.x + character3Button.width * character3Button.scaleX / 2,
top: character3Button.y - character3Button.height * character3Button.scaleY / 2,
bottom: character3Button.y + character3Button.height * character3Button.scaleY / 2
};
var backBounds = {
left: backButton.x - backButton.width * backButton.scaleX / 2,
right: backButton.x + backButton.width * backButton.scaleX / 2,
top: backButton.y - backButton.height * backButton.scaleY / 2,
bottom: backButton.y + backButton.height * backButton.scaleY / 2
};
if (x >= char1Bounds.left && x <= char1Bounds.right && y >= char1Bounds.top && y <= char1Bounds.bottom) {
selectedCharacter = 'character1';
backToMenu();
} else if (x >= char2Bounds.left && x <= char2Bounds.right && y >= char2Bounds.top && y <= char2Bounds.bottom) {
selectedCharacter = 'character2';
backToMenu();
} else if (x >= char3Bounds.left && x <= char3Bounds.right && y >= char3Bounds.top && y <= char3Bounds.bottom) {
selectedCharacter = 'character3';
backToMenu();
} else if (x >= backBounds.left && x <= backBounds.right && y >= backBounds.top && y <= backBounds.bottom) {
backToMenu();
}
} 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 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 + 50;
newCircle.velocityY = 2;
newCircle.velocityX = 0;
newCircle.lastY = newCircle.y;
newCircle.lastIntersecting = false;
game.addChild(newCircle);
circles.push(newCircle);
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') {
// 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;
}
// 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 reaches above container mouth)
for (var i = 0; i < circles.length; i++) {
var circle = circles[i];
// Only check game over if circle has been falling for a while and has low velocity
if (circle.y - circle.radius < containerY + 50 && Math.abs(circle.velocityY) < 2 && circle.y > containerY) {
// Game over condition - circle reached above container mouth and has settled
LK.showGameOver();
return;
}
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -778,9 +778,9 @@
var isDragging = false;
var lastTouchX = 0;
var lastTouchY = 0;
function generateNextCircle() {
- nextCircleType = Math.floor(Math.random() * 3) + 1; // Random circle type 1-3
+ nextCircleType = Math.floor(Math.random() * 4) + 1; // Random circle type 1-4
// Update preview
game.removeChild(nextCirclePreview);
nextCirclePreview = LK.getAsset('circle' + nextCircleType, {
anchorX: 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