User prompt
cambia la probabilidad a un 25 % de que te salte el jumscare y pon que al reiniciar a los 5 intentos tambien se reinicien los personajes osea que al reiniciar despues de los 5 intentos tengas que comprar todo otra vez , menos los personajes gratis , y tambien al intentar comprar un personaje y no tener esferas suficientes te coloque un texto en la pantalla que diga no tienes esferas suficientes. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
arregla el jumscare , lo que tienes que aser es que la imagen de jumscare se coloque en toda la pantalla del juego y cuando el jumscare se coloque en toda la pantalla se ponga el sonido jumscare , y elimina eso de que se agrande y se achique la imagen ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que no se incremente la velocidad al tocar una esfera , eso es crucial , "no se aumenta la velocidad al tocar una esfera" , y cambia el valor de las esferas a 3 puntos por esfera , y cada 5 intentos se reinicie el puntaje acumulado ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
añade lo que te pedi
User prompt
pon el ganaste o win al llegar a los 50000 puntos y los puntos acumulados que solo se muestren en el apartado de la seleccion de personajes ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
camvia el valor de las esferas a 15 puntos al tocarlas y que los pinchos al llegar el tiempo a 0 cambiar el valor de daño de los pinchos a 25
User prompt
añade un contador abajo a la izquierda de 223 segundos , cuando el contador llege a 0 segundos que las pelotitas incrementen su velocidad sumando su mitad de velocidad , afectando a las esferas y a los pinchos , tambien añade que los puntos se guarden en el apartado de elegir tu personaje , costando desagrado 50 , miedo 340 , desagrado 500 , felicidad gratis , al terminar la partida los puntos acumulados en la parte superior en el medio seran sumados al contador de esferas de el apartado de seleccion de personajes , los puntos obtenidos , abra un texto que diga los precios de cada unos de los personajes , al tocar un personaje y no tener suficientes puntos no se podra elegir ese personaje , el precio de cada uno de los personaje al tener esferas sufucientes para obtener el personaje y añadirlo a la coleccion de los personajes que obtenga las esferas restantes de mis puntos acumulados seran restados al precio de cada personaje , al no tener esferas suficientes para comprar un personaje , el personaje no podra ser seleccionado ↪💡 Consider importing and using the following plugins: @upit/storage.v1, @upit/tween.v1
User prompt
añade la imagen de jumscare y tambien su audio , al perder que haiga una provavilidad del 22.2 % de que salga en la pantalla agrandandose y achicandose , mientras que se reproduce su audio : jumscare ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
tiene que tener una jit box invisible en el texto de jugar en el cual al tocar en la jitbox de el texto JUGAR hay te lleve a elegir los personajes , y cada uno de los personajes tambien tienen que tener una jit box invisible y vien colocada para poder elegir a el personaje que querramos
User prompt
ahora quiero que al tocar la palabra jugar que ponga un texto que diga selecciona tu personaje , y abajo de el texto que esten los personajes de intensamente 1 para elegir y al tocar uno de ellos poder empesar a jugar con el , al elegir el personaje que eligamos que aiga una cuenta regresiva , 3, 2, 1, 0 , cuando el contador llege a 0 que empiese el juego
User prompt
antes de iniciar el juego tienes que poner un menu para empesar a jugar , al tocar la palabra jugar que te muestre las respectivas esferas con sus nombres cuales se encuentren estaticas en el sentro de la pantalla , y al seleccionar una de ellas se inicie con ese personaje y que tenga un contador regresivo de 3 segindos , 3 , 2 , 1 y que al llegar a 0 inicien a caer las esferas y los pinchos
User prompt
quiero que agreges un menu para poder elegir mi personaje segun las emociones que aiga para elegir , y que la velocidad de las esferas y de los pinchos aumenten poco a poco , para complicarlo un poco mas
User prompt
al tocar una esfera empesar a jugar con ese personaje , al iniciar el juego me gustaria que tenga una cuenta regresiva para iniciar a jugar , al iniciar el juego tiene que empesar a caer esferas de distintos colores , verde , azul , rojo y amarillo aleatoriamente y tambien una esfera nega con pinchos que te aga daño perdiendo vida progresivamente segun el puntaje que allas obtenido al recoger las esferas , cada esfera que obtengas sera un punto
User prompt
cambia las esferas por imagenes de los personajes , alegria por el sirculo amarillo , enojo por el sirculo rojo , desagrado por la esfera verde y miedo por la esfera purpura
User prompt
el juego tiene que estar en español
Code edit (1 edits merged)
Please save this source code
User prompt
Inside Out Memory Sphere Catcher
User prompt
la idea que tengo para crear el juego seria que haiga un personaje de intensamente el cual puedas seleccionar para cambiar de personaje y un menu de inicio , para iniciar a jugar tener opciones , EJ: vajar y suvir el volumen , y la idea es que caigan las esferas de recuerdos de intensamente 1 caigan de el cielo, y algunas corruptas o con espinas , las corruptas o con espinas que le agan daño a la personaje , el personaje tiene que ser alguno de la pelicula de intensamente 1 , alegria , enojo, desagrado o miedo, y que las esferas de recuerdos tengan un contador de puntos
Initial prompt
traduce todo lo que me digas al español
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var CorruptedMemory = Container.expand(function () {
var self = Container.call(this);
var memoryGraphics = self.attachAsset('corruptedMemory', {
anchorX: 0.5,
anchorY: 0.5
});
// Add spikes around the corrupted memory
var spike1 = self.attachAsset('spike', {
anchorX: 0.5,
anchorY: 0.5
});
spike1.x = -30;
spike1.y = -30;
spike1.rotation = Math.PI / 4;
var spike2 = self.attachAsset('spike', {
anchorX: 0.5,
anchorY: 0.5
});
spike2.x = 30;
spike2.y = -30;
spike2.rotation = -Math.PI / 4;
var spike3 = self.attachAsset('spike', {
anchorX: 0.5,
anchorY: 0.5
});
spike3.x = 30;
spike3.y = 30;
spike3.rotation = Math.PI / 4;
var spike4 = self.attachAsset('spike', {
anchorX: 0.5,
anchorY: 0.5
});
spike4.x = -30;
spike4.y = 30;
spike4.rotation = -Math.PI / 4;
self.speed = 4;
self.lastY = undefined;
self.update = function () {
self.y += self.speed;
};
return self;
});
var EmotionCharacter = Container.expand(function (emotionType) {
var self = Container.call(this);
var characterGraphics = self.attachAsset(emotionType, {
anchorX: 0.5,
anchorY: 0.5
});
self.emotionType = emotionType;
self.health = 100;
self.maxHealth = 100;
return self;
});
var GoldenMemory = Container.expand(function () {
var self = Container.call(this);
var memoryGraphics = self.attachAsset('goldenMemory', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 3;
self.lastY = undefined;
self.update = function () {
self.y += self.speed;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Background music
// Sound effects
// Memory sphere assets
// Character assets - Joy, Anger, Disgust, Fear
// Game variables
var selectedEmotion = storage.selectedEmotion || 'joy';
var gameStarted = false;
var countdownActive = false;
var countdownValue = 3;
var character = null;
var goldenMemories = [];
var corruptedMemories = [];
var spawnTimer = 0;
var difficultyLevel = 1;
var health = 100;
var maxHealth = 100;
// Character selection UI
var characterSelectionActive = false;
var selectionButtons = [];
// UI Elements
var scoreText = new Text2('Puntos: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
var healthText = new Text2('Vida: 100/100', {
size: 50,
fill: 0xFF0000
});
healthText.anchor.set(1, 0);
LK.gui.topRight.addChild(healthText);
var instructionText = new Text2('¡Toca una esfera para elegir tu personaje!', {
size: 80,
fill: 0xFFFFFF
});
instructionText.anchor.set(0.5, 0.5);
instructionText.x = 1024;
instructionText.y = 600;
game.addChild(instructionText);
var countdownText = new Text2('3', {
size: 200,
fill: 0xFFFFFF
});
countdownText.anchor.set(0.5, 0.5);
countdownText.x = 1024;
countdownText.y = 1366;
countdownText.alpha = 0;
game.addChild(countdownText);
// Handle sphere selection for character choice
function handleSphereSelection(sphere) {
if (sphere.characterType) {
selectedEmotion = sphere.characterType;
storage.selectedEmotion = selectedEmotion;
// Flash selected sphere
LK.effects.flashObject(sphere, 0xFFFFFF, 500);
// Clear all spheres
for (var i = goldenMemories.length - 1; i >= 0; i--) {
goldenMemories[i].destroy();
goldenMemories.splice(i, 1);
}
// Start countdown
LK.setTimeout(function () {
startCountdown();
}, 600);
}
}
// Start countdown before game
function startCountdown() {
countdownActive = true;
countdownValue = 3;
instructionText.alpha = 0;
countdownText.alpha = 1;
countdownText.setText('3');
var countdownInterval = LK.setInterval(function () {
countdownValue--;
if (countdownValue > 0) {
countdownText.setText(countdownValue.toString());
} else if (countdownValue === 0) {
countdownText.setText('¡Juega!');
} else {
LK.clearInterval(countdownInterval);
countdownText.alpha = 0;
startActualGame();
}
}, 1000);
}
// Start the actual game
function startActualGame() {
countdownActive = false;
gameStarted = true;
// Create player character
character = new EmotionCharacter(selectedEmotion);
character.x = 1024;
character.y = 2400;
game.addChild(character);
// Start background music
LK.playMusic('gameMusic');
}
// Spawn memory function
function spawnMemory() {
var spawnX = Math.random() * (2048 - 160) + 80;
var randomType = Math.random();
if (!gameStarted) {
// Character selection phase - spawn character spheres
if (randomType < 0.25) {
// Joy sphere (yellow)
var joyMemory = new GoldenMemory();
joyMemory.x = spawnX;
joyMemory.y = -100;
joyMemory.lastY = joyMemory.y;
joyMemory.characterType = 'joy';
joyMemory.children[0].tint = 0xffeb3b;
goldenMemories.push(joyMemory);
game.addChild(joyMemory);
} else if (randomType < 0.5) {
// Anger sphere (red)
var angerMemory = new GoldenMemory();
angerMemory.x = spawnX;
angerMemory.y = -100;
angerMemory.lastY = angerMemory.y;
angerMemory.characterType = 'anger';
angerMemory.children[0].tint = 0xf44336;
goldenMemories.push(angerMemory);
game.addChild(angerMemory);
} else if (randomType < 0.75) {
// Disgust sphere (green)
var disgustMemory = new GoldenMemory();
disgustMemory.x = spawnX;
disgustMemory.y = -100;
disgustMemory.lastY = disgustMemory.y;
disgustMemory.characterType = 'disgust';
disgustMemory.children[0].tint = 0x4caf50;
goldenMemories.push(disgustMemory);
game.addChild(disgustMemory);
} else {
// Fear sphere (purple)
var fearMemory = new GoldenMemory();
fearMemory.x = spawnX;
fearMemory.y = -100;
fearMemory.lastY = fearMemory.y;
fearMemory.characterType = 'fear';
fearMemory.children[0].tint = 0x9c27b0;
goldenMemories.push(fearMemory);
game.addChild(fearMemory);
}
} else {
// Game phase - spawn colored spheres and corrupted ones
if (randomType < 0.15) {
// Yellow sphere
var yellowMemory = new GoldenMemory();
yellowMemory.x = spawnX;
yellowMemory.y = -100;
yellowMemory.lastY = yellowMemory.y;
yellowMemory.children[0].tint = 0xffeb3b;
goldenMemories.push(yellowMemory);
game.addChild(yellowMemory);
} else if (randomType < 0.3) {
// Green sphere
var greenMemory = new GoldenMemory();
greenMemory.x = spawnX;
greenMemory.y = -100;
greenMemory.lastY = greenMemory.y;
greenMemory.children[0].tint = 0x4caf50;
goldenMemories.push(greenMemory);
game.addChild(greenMemory);
} else if (randomType < 0.45) {
// Blue sphere
var blueMemory = new GoldenMemory();
blueMemory.x = spawnX;
blueMemory.y = -100;
blueMemory.lastY = blueMemory.y;
blueMemory.children[0].tint = 0x2196f3;
goldenMemories.push(blueMemory);
game.addChild(blueMemory);
} else if (randomType < 0.6) {
// Red sphere
var redMemory = new GoldenMemory();
redMemory.x = spawnX;
redMemory.y = -100;
redMemory.lastY = redMemory.y;
redMemory.children[0].tint = 0xf44336;
goldenMemories.push(redMemory);
game.addChild(redMemory);
} else {
// Corrupted memory with spikes
var corrupted = new CorruptedMemory();
corrupted.x = spawnX;
corrupted.y = -100;
corrupted.lastY = corrupted.y;
corruptedMemories.push(corrupted);
game.addChild(corrupted);
}
}
}
// Game event handlers
game.down = function (x, y, obj) {
// No character selection needed here anymore
};
game.move = function (x, y, obj) {
if (gameStarted && character) {
character.x = Math.max(60, Math.min(1988, x));
}
};
// Start spawning spheres for character selection
// Main game update loop
game.update = function () {
// Spawn spheres even during character selection
spawnTimer++;
var spawnRate = gameStarted ? Math.max(30, 90 - difficultyLevel * 5) : 60;
if (spawnTimer >= spawnRate) {
spawnMemory();
spawnTimer = 0;
}
if (!gameStarted && !countdownActive) {
// Character selection phase - just update falling spheres
for (var i = goldenMemories.length - 1; i >= 0; i--) {
var golden = goldenMemories[i];
if (golden.lastY === undefined) golden.lastY = golden.y;
if (golden.lastY <= 2732 && golden.y > 2732) {
golden.destroy();
goldenMemories.splice(i, 1);
continue;
}
// Check collision for character selection
if (golden.characterType) {
var bounds = golden.getBounds();
// Auto-select if sphere reaches bottom area
if (golden.y > 2000) {
handleSphereSelection(golden);
break;
}
}
golden.lastY = golden.y;
}
return;
}
if (!gameStarted) return;
// Increase difficulty over time
if (LK.getScore() > 0 && LK.getScore() % 10 === 0) {
difficultyLevel = Math.floor(LK.getScore() / 10) + 1;
}
// Spawn rate already handled at top of update function
// Update golden memories
for (var i = goldenMemories.length - 1; i >= 0; i--) {
var golden = goldenMemories[i];
// Initialize lastY if needed
if (golden.lastY === undefined) golden.lastY = golden.y;
// Check if off screen
if (golden.lastY <= 2732 && golden.y > 2732) {
golden.destroy();
goldenMemories.splice(i, 1);
continue;
}
// Check collision with character for game phase
if (character && golden.intersects(character) && gameStarted) {
LK.setScore(LK.getScore() + 1);
scoreText.setText('Puntos: ' + LK.getScore());
LK.getSound('collect').play();
// Flash character gold
LK.effects.flashObject(character, 0xFFD700, 300);
golden.destroy();
goldenMemories.splice(i, 1);
continue;
}
// Check collision for character selection phase
if (!gameStarted && !countdownActive && golden.characterType) {
var bounds = golden.getBounds();
// Check if sphere was touched (simplified touch detection)
if (golden.y > 500 && golden.y < 2000) {
handleSphereSelection(golden);
golden.destroy();
goldenMemories.splice(i, 1);
continue;
}
}
golden.lastY = golden.y;
}
// Update corrupted memories
for (var j = corruptedMemories.length - 1; j >= 0; j--) {
var corrupted = corruptedMemories[j];
// Initialize lastY if needed
if (corrupted.lastY === undefined) corrupted.lastY = corrupted.y;
// Check if off screen
if (corrupted.lastY <= 2732 && corrupted.y > 2732) {
corrupted.destroy();
corruptedMemories.splice(j, 1);
continue;
}
// Check collision with character
if (character && corrupted.intersects(character)) {
health -= 20;
healthText.setText('Vida: ' + health + '/' + maxHealth);
LK.getSound('damage').play();
// Flash character red
LK.effects.flashObject(character, 0xFF0000, 500);
corrupted.destroy();
corruptedMemories.splice(j, 1);
// Check game over
if (health <= 0) {
LK.showGameOver();
return;
}
continue;
}
corrupted.lastY = corrupted.y;
}
// Increase memory speed based on difficulty
for (var k = 0; k < goldenMemories.length; k++) {
goldenMemories[k].speed = 3 + difficultyLevel * 0.5;
}
for (var l = 0; l < corruptedMemories.length; l++) {
corruptedMemories[l].speed = 4 + difficultyLevel * 0.5;
}
// Check win condition (score of 100)
if (LK.getScore() >= 100) {
LK.showYouWin();
}
}; ===================================================================
--- original.js
+++ change.js
@@ -90,17 +90,19 @@
// Character assets - Joy, Anger, Disgust, Fear
// Game variables
var selectedEmotion = storage.selectedEmotion || 'joy';
var gameStarted = false;
+var countdownActive = false;
+var countdownValue = 3;
var character = null;
var goldenMemories = [];
var corruptedMemories = [];
var spawnTimer = 0;
var difficultyLevel = 1;
var health = 100;
var maxHealth = 100;
// Character selection UI
-var characterSelectionActive = true;
+var characterSelectionActive = false;
var selectionButtons = [];
// UI Elements
var scoreText = new Text2('Puntos: 0', {
size: 60,
@@ -113,149 +115,219 @@
fill: 0xFF0000
});
healthText.anchor.set(1, 0);
LK.gui.topRight.addChild(healthText);
-var instructionText = new Text2('¡Elige tu emoción!', {
+var instructionText = new Text2('¡Toca una esfera para elegir tu personaje!', {
size: 80,
fill: 0xFFFFFF
});
instructionText.anchor.set(0.5, 0.5);
instructionText.x = 1024;
instructionText.y = 600;
game.addChild(instructionText);
-// Character selection setup
-function setupCharacterSelection() {
- var emotions = ['joy', 'anger', 'disgust', 'fear'];
- var emotionNames = ['Alegría', 'Enojo', 'Desagrado', 'Miedo'];
- for (var i = 0; i < emotions.length; i++) {
- var button = new EmotionCharacter(emotions[i]);
- button.x = 400 + i * 300;
- button.y = 1200;
- button.emotionType = emotions[i];
- button.emotionName = emotionNames[i];
- // Add name label
- var nameLabel = new Text2(emotionNames[i], {
- size: 50,
- fill: 0xFFFFFF
- });
- nameLabel.anchor.set(0.5, 0);
- nameLabel.y = 80;
- button.addChild(nameLabel);
- game.addChild(button);
- selectionButtons.push(button);
+var countdownText = new Text2('3', {
+ size: 200,
+ fill: 0xFFFFFF
+});
+countdownText.anchor.set(0.5, 0.5);
+countdownText.x = 1024;
+countdownText.y = 1366;
+countdownText.alpha = 0;
+game.addChild(countdownText);
+// Handle sphere selection for character choice
+function handleSphereSelection(sphere) {
+ if (sphere.characterType) {
+ selectedEmotion = sphere.characterType;
+ storage.selectedEmotion = selectedEmotion;
+ // Flash selected sphere
+ LK.effects.flashObject(sphere, 0xFFFFFF, 500);
+ // Clear all spheres
+ for (var i = goldenMemories.length - 1; i >= 0; i--) {
+ goldenMemories[i].destroy();
+ goldenMemories.splice(i, 1);
+ }
+ // Start countdown
+ LK.setTimeout(function () {
+ startCountdown();
+ }, 600);
}
}
+// Start countdown before game
+function startCountdown() {
+ countdownActive = true;
+ countdownValue = 3;
+ instructionText.alpha = 0;
+ countdownText.alpha = 1;
+ countdownText.setText('3');
+ var countdownInterval = LK.setInterval(function () {
+ countdownValue--;
+ if (countdownValue > 0) {
+ countdownText.setText(countdownValue.toString());
+ } else if (countdownValue === 0) {
+ countdownText.setText('¡Juega!');
+ } else {
+ LK.clearInterval(countdownInterval);
+ countdownText.alpha = 0;
+ startActualGame();
+ }
+ }, 1000);
+}
// Start the actual game
-function startGame() {
- characterSelectionActive = false;
+function startActualGame() {
+ countdownActive = false;
gameStarted = true;
- // Clear selection UI
- for (var i = 0; i < selectionButtons.length; i++) {
- selectionButtons[i].destroy();
- }
- selectionButtons = [];
- // Update instruction text
- instructionText.setText('¡Atrapa recuerdos dorados, evita los corruptos!');
// Create player character
character = new EmotionCharacter(selectedEmotion);
character.x = 1024;
character.y = 2400;
game.addChild(character);
// Start background music
LK.playMusic('gameMusic');
- // Hide instruction after a moment
- LK.setTimeout(function () {
- instructionText.alpha = 0;
- }, 3000);
}
// Spawn memory function
function spawnMemory() {
var spawnX = Math.random() * (2048 - 160) + 80;
- // Create different character spheres
var randomType = Math.random();
- if (randomType < 0.25) {
- // Joy sphere (yellow)
- var golden = new GoldenMemory();
- golden.x = spawnX;
- golden.y = -100;
- golden.lastY = golden.y;
- goldenMemories.push(golden);
- game.addChild(golden);
- } else if (randomType < 0.5) {
- // Disgust sphere (green) - good memory
- var disgustMemory = new GoldenMemory();
- disgustMemory.x = spawnX;
- disgustMemory.y = -100;
- disgustMemory.lastY = disgustMemory.y;
- // Change to green color for disgust
- disgustMemory.children[0].tint = 0x4caf50;
- goldenMemories.push(disgustMemory);
- game.addChild(disgustMemory);
- } else if (randomType < 0.75) {
- // Fear sphere (purple) - good memory
- var fearMemory = new GoldenMemory();
- fearMemory.x = spawnX;
- fearMemory.y = -100;
- fearMemory.lastY = fearMemory.y;
- // Change to purple color for fear
- fearMemory.children[0].tint = 0x9c27b0;
- goldenMemories.push(fearMemory);
- game.addChild(fearMemory);
+ if (!gameStarted) {
+ // Character selection phase - spawn character spheres
+ if (randomType < 0.25) {
+ // Joy sphere (yellow)
+ var joyMemory = new GoldenMemory();
+ joyMemory.x = spawnX;
+ joyMemory.y = -100;
+ joyMemory.lastY = joyMemory.y;
+ joyMemory.characterType = 'joy';
+ joyMemory.children[0].tint = 0xffeb3b;
+ goldenMemories.push(joyMemory);
+ game.addChild(joyMemory);
+ } else if (randomType < 0.5) {
+ // Anger sphere (red)
+ var angerMemory = new GoldenMemory();
+ angerMemory.x = spawnX;
+ angerMemory.y = -100;
+ angerMemory.lastY = angerMemory.y;
+ angerMemory.characterType = 'anger';
+ angerMemory.children[0].tint = 0xf44336;
+ goldenMemories.push(angerMemory);
+ game.addChild(angerMemory);
+ } else if (randomType < 0.75) {
+ // Disgust sphere (green)
+ var disgustMemory = new GoldenMemory();
+ disgustMemory.x = spawnX;
+ disgustMemory.y = -100;
+ disgustMemory.lastY = disgustMemory.y;
+ disgustMemory.characterType = 'disgust';
+ disgustMemory.children[0].tint = 0x4caf50;
+ goldenMemories.push(disgustMemory);
+ game.addChild(disgustMemory);
+ } else {
+ // Fear sphere (purple)
+ var fearMemory = new GoldenMemory();
+ fearMemory.x = spawnX;
+ fearMemory.y = -100;
+ fearMemory.lastY = fearMemory.y;
+ fearMemory.characterType = 'fear';
+ fearMemory.children[0].tint = 0x9c27b0;
+ goldenMemories.push(fearMemory);
+ game.addChild(fearMemory);
+ }
} else {
- // Anger sphere (red) - corrupted memory
- var corrupted = new CorruptedMemory();
- corrupted.x = spawnX;
- corrupted.y = -100;
- corrupted.lastY = corrupted.y;
- corruptedMemories.push(corrupted);
- game.addChild(corrupted);
- }
-}
-// Handle character selection
-function handleCharacterSelection(x, y, obj) {
- if (!characterSelectionActive) return;
- for (var i = 0; i < selectionButtons.length; i++) {
- var button = selectionButtons[i];
- var bounds = button.getBounds();
- if (x >= bounds.x && x <= bounds.x + bounds.width && y >= bounds.y && y <= bounds.y + bounds.height) {
- selectedEmotion = button.emotionType;
- storage.selectedEmotion = selectedEmotion;
- // Flash selected character
- LK.effects.flashObject(button, 0xFFFFFF, 500);
- LK.setTimeout(function () {
- startGame();
- }, 600);
- break;
+ // Game phase - spawn colored spheres and corrupted ones
+ if (randomType < 0.15) {
+ // Yellow sphere
+ var yellowMemory = new GoldenMemory();
+ yellowMemory.x = spawnX;
+ yellowMemory.y = -100;
+ yellowMemory.lastY = yellowMemory.y;
+ yellowMemory.children[0].tint = 0xffeb3b;
+ goldenMemories.push(yellowMemory);
+ game.addChild(yellowMemory);
+ } else if (randomType < 0.3) {
+ // Green sphere
+ var greenMemory = new GoldenMemory();
+ greenMemory.x = spawnX;
+ greenMemory.y = -100;
+ greenMemory.lastY = greenMemory.y;
+ greenMemory.children[0].tint = 0x4caf50;
+ goldenMemories.push(greenMemory);
+ game.addChild(greenMemory);
+ } else if (randomType < 0.45) {
+ // Blue sphere
+ var blueMemory = new GoldenMemory();
+ blueMemory.x = spawnX;
+ blueMemory.y = -100;
+ blueMemory.lastY = blueMemory.y;
+ blueMemory.children[0].tint = 0x2196f3;
+ goldenMemories.push(blueMemory);
+ game.addChild(blueMemory);
+ } else if (randomType < 0.6) {
+ // Red sphere
+ var redMemory = new GoldenMemory();
+ redMemory.x = spawnX;
+ redMemory.y = -100;
+ redMemory.lastY = redMemory.y;
+ redMemory.children[0].tint = 0xf44336;
+ goldenMemories.push(redMemory);
+ game.addChild(redMemory);
+ } else {
+ // Corrupted memory with spikes
+ var corrupted = new CorruptedMemory();
+ corrupted.x = spawnX;
+ corrupted.y = -100;
+ corrupted.lastY = corrupted.y;
+ corruptedMemories.push(corrupted);
+ game.addChild(corrupted);
}
}
}
// Game event handlers
game.down = function (x, y, obj) {
- if (characterSelectionActive) {
- handleCharacterSelection(x, y, obj);
- }
+ // No character selection needed here anymore
};
game.move = function (x, y, obj) {
if (gameStarted && character) {
character.x = Math.max(60, Math.min(1988, x));
}
};
-// Initialize character selection
-setupCharacterSelection();
+// Start spawning spheres for character selection
// Main game update loop
game.update = function () {
- if (!gameStarted) return;
- // Increase difficulty over time
- if (LK.getScore() > 0 && LK.getScore() % 10 === 0) {
- difficultyLevel = Math.floor(LK.getScore() / 10) + 1;
- }
- // Spawn memories based on difficulty
+ // Spawn spheres even during character selection
spawnTimer++;
- var spawnRate = Math.max(30, 90 - difficultyLevel * 5);
+ var spawnRate = gameStarted ? Math.max(30, 90 - difficultyLevel * 5) : 60;
if (spawnTimer >= spawnRate) {
spawnMemory();
spawnTimer = 0;
}
+ if (!gameStarted && !countdownActive) {
+ // Character selection phase - just update falling spheres
+ for (var i = goldenMemories.length - 1; i >= 0; i--) {
+ var golden = goldenMemories[i];
+ if (golden.lastY === undefined) golden.lastY = golden.y;
+ if (golden.lastY <= 2732 && golden.y > 2732) {
+ golden.destroy();
+ goldenMemories.splice(i, 1);
+ continue;
+ }
+ // Check collision for character selection
+ if (golden.characterType) {
+ var bounds = golden.getBounds();
+ // Auto-select if sphere reaches bottom area
+ if (golden.y > 2000) {
+ handleSphereSelection(golden);
+ break;
+ }
+ }
+ golden.lastY = golden.y;
+ }
+ return;
+ }
+ if (!gameStarted) return;
+ // Increase difficulty over time
+ if (LK.getScore() > 0 && LK.getScore() % 10 === 0) {
+ difficultyLevel = Math.floor(LK.getScore() / 10) + 1;
+ }
+ // Spawn rate already handled at top of update function
// Update golden memories
for (var i = goldenMemories.length - 1; i >= 0; i--) {
var golden = goldenMemories[i];
// Initialize lastY if needed
@@ -265,10 +337,10 @@
golden.destroy();
goldenMemories.splice(i, 1);
continue;
}
- // Check collision with character
- if (character && golden.intersects(character)) {
+ // Check collision with character for game phase
+ if (character && golden.intersects(character) && gameStarted) {
LK.setScore(LK.getScore() + 1);
scoreText.setText('Puntos: ' + LK.getScore());
LK.getSound('collect').play();
// Flash character gold
@@ -276,8 +348,19 @@
golden.destroy();
goldenMemories.splice(i, 1);
continue;
}
+ // Check collision for character selection phase
+ if (!gameStarted && !countdownActive && golden.characterType) {
+ var bounds = golden.getBounds();
+ // Check if sphere was touched (simplified touch detection)
+ if (golden.y > 500 && golden.y < 2000) {
+ handleSphereSelection(golden);
+ golden.destroy();
+ goldenMemories.splice(i, 1);
+ continue;
+ }
+ }
golden.lastY = golden.y;
}
// Update corrupted memories
for (var j = corruptedMemories.length - 1; j >= 0; j--) {