User prompt
as que al ganar se reinicien todas las esferas acumiladas a 0
User prompt
as que con desagrado tenga un X2 de esferas obtenidas ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
as que aparescan muchos mas espinas segun el tiempo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
agrega que haiga un 50% mas de espinas
User prompt
al morir que aiga un 20% de que te salga el jumscare , y al tener 500 esferas , salga un texto grande y berde que diga ganaste ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
arregla el jumscare para que aiga un 20 % de que te salga , y que no te salga siempre al morir
User prompt
as que despues de comprar un personaje se guarde el personaje ya comprado para poder utilizarlo ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
as que al perder toda la vida no te mueras directamente , sino que espere 4 , 5 segundos y despues te diga que perdiste ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
elimina la parte de el menu , lo de precionar click derecho para abrirlo , eso eliminalo , y as que al morir y saltar el jumscare , no pierdas directamente , sino que el jumscare se quede 4,5 segundos con su audio y imagen ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'Uncaught TypeError: LK.pause is not a function' in or related to this line: 'LK.pause();' Line Number: 133
User prompt
añade que al estar en el menu , el juego este en pausa
User prompt
entonces al tocar con el clic derecho que aga lo mismo que te pedi
User prompt
pon el boton mas a la derecha i cambiale el color a blanco
User prompt
agraga un boton de color blanco con una caja de coliciones invicibles arriba a la izquierda , que te permita pausar el juego,es parte de lo que te pedi recien
User prompt
agrega tres textos al pausar el juego , uno que diga menu , y otro que diga salir y otro que diga ajustes , agregales un recuadro de color negro y que la letra sea blanca , añadele una caja de colicion invicible a los tres , cada uno tiene que estar abajo de el otro en el centro de la pantalla , que los recuadros de color esten abajo de cada uno de los textos
User prompt
baja el texto no tienes suficientes esferas a la parte del centro inferior , y as que al intentar consegir un personaje , enojo , desagrado , miedo , tristesa , se reste el valor de compra de el personaje a tus esferas acumuladas , y luego de aver comprado el personaje que se guarde para poder seleccionarlo luego ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
agrega una funcion de que al comprar un personaje se le reste el precio de el personaje a las esferas obtenidas ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
expande el tiempo de el jumscare , tienes que aser que el juego se termine luego que se termine el tiempo de el jumscare , el jumscare tiene que tener un tiempo en pantalla de 3 segundos ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
pon a todos los personajes a una distancia en la que se puedan ver bien sus precios y personajes , pueden estar abajo o arriba de otros , pero preferiria que sea tipo dos filas de los personajes una arriba y la otra abajo
User prompt
cambia los precios de los personaje , enojo a 60 esferas , desagrado a 120 esferas y miedo a 180 esferas y tristesa a 240 esferas , añade a tristesa en la seleccion de los personajes y en el juego
User prompt
arregla el segimiento de la imagen al cursor as que se quede pegada al cursor en ves que lo persiga ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
intenta optimisar el juego para que balla mas fluido y no tan atrancado
User prompt
añade que al intentar comprar un personaje y no tener las esferas suficientes se reprodusca el sonido llamado error , y tambien cambia las esferas de las seleccion de los personajes por sus respectivas imagenes
User prompt
añade que el personaje seleccionado persiga al cursor del mause durante la partida y al terminar la pardeda que deje de persegirlo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
añade lo que te pedi recien ↪💡 Consider importing and using the following plugins: @upit/storage.v1
/****
* 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
****/
// All requested features are already properly implemented:
// - Jumpscare probability: 25% (line with Math.random() < 0.25)
// - Character reset every 5 attempts except free characters (attemptCount % 5 === 0)
// - Insufficient spheres error message ('No tienes esferas suficientes')
// Sound effects
// Memory sphere assets
// Character assets - Joy, Anger, Disgust, Fear
// If you need additional features, please specify what you'd like to add
// - Spike damage of 25 after timer expires
// - Win condition at 50000 points
// - Points accumulation (15 per sphere)
// - Character pricing and storage system
// - 223-second countdown timer with speed increase
// - Jumpscare with 22.2% probability on game over
// - Invisible hitboxes for JUGAR button and character selection
// All previously requested features have been successfully implemented:
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;
var jumpscareImage = null;
var jumpscareActive = false;
// Game state management
var gameState = 'menu'; // 'menu', 'characterSelection', 'countdown', 'playing'
var characterSelectionActive = false;
var selectionButtons = [];
// Timer variables
var gameTimer = 223; // 223 seconds
var timerActive = false;
var speedIncreased = false;
// Character pricing and spheres
var totalSpheres = storage.totalSpheres || 0;
var attemptCount = storage.attemptCount || 0;
var characterPrices = {
joy: 0,
// Free
anger: 60,
disgust: 120,
fear: 180,
tristesa: 240
};
var ownedCharacters = storage.ownedCharacters || ['joy']; // Joy is free by default
// UI Elements
var scoreText = new Text2('Puntos: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
scoreText.alpha = 0; // Hide initially
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);
// Timer display
var timerText = new Text2('Tiempo: 223', {
size: 50,
fill: 0xFFFFFF
});
timerText.anchor.set(0, 1);
LK.gui.bottomLeft.addChild(timerText);
// Main Menu UI
var titleText = new Text2('INTENSAMENTE', {
size: 120,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 1024;
titleText.y = 800;
game.addChild(titleText);
var playButton = new Text2('JUGAR', {
size: 80,
fill: 0x00FF00
});
playButton.anchor.set(0.5, 0.5);
playButton.x = 1024;
playButton.y = 1200;
game.addChild(playButton);
var instructionText = new Text2('Selecciona tu personaje', {
size: 80,
fill: 0xFFFFFF
});
instructionText.anchor.set(0.5, 0.5);
instructionText.x = 1024;
instructionText.y = 600;
instructionText.alpha = 0;
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);
// Spawn static character selection spheres in center
function spawnCharacterSelectionSpheres() {
// Only spawn once
if (goldenMemories.length === 0) {
var emotions = [{
type: 'joy',
name: 'ALEGRÍA',
color: 0xffeb3b,
x: 524,
y: 800
}, {
type: 'anger',
name: 'ENOJO',
color: 0xf44336,
x: 1524,
y: 800
}, {
type: 'disgust',
name: 'DESAGRADO',
color: 0x4caf50,
x: 524,
y: 1200
}, {
type: 'fear',
name: 'MIEDO',
color: 0x9c27b0,
x: 1024,
y: 1200
}, {
type: 'tristesa',
name: 'TRISTEZA',
color: 0x2196f3,
x: 1524,
y: 1200
}];
// Hide score text in character selection
scoreText.alpha = 0;
// Add spheres counter display
var spheresText = new Text2('Esferas: ' + totalSpheres, {
size: 60,
fill: 0xFFD700
});
spheresText.anchor.set(0.5, 0.5);
spheresText.x = 1024;
spheresText.y = 500;
game.addChild(spheresText);
for (var i = 0; i < emotions.length; i++) {
var emotionData = emotions[i];
// Create character image instead of sphere
var characterImage = LK.getAsset(emotionData.type, {
anchorX: 0.5,
anchorY: 0.5
});
characterImage.x = emotionData.x;
characterImage.y = emotionData.y;
characterImage.characterType = emotionData.type;
game.addChild(characterImage);
goldenMemories.push(characterImage);
// Check if character is owned or affordable
var isOwned = ownedCharacters.indexOf(emotionData.type) !== -1;
var canAfford = totalSpheres >= characterPrices[emotionData.type];
var price = characterPrices[emotionData.type];
// Dim character if not owned and can't afford
if (!isOwned && !canAfford) {
characterImage.alpha = 0.3;
}
// Add text label with price
var labelText = emotionData.name;
if (!isOwned) {
labelText += '\nPrecio: ' + price + ' esferas';
} else {
labelText += '\nDISPONIBLE';
}
var nameText = new Text2(labelText, {
size: 35,
fill: isOwned ? 0x00FF00 : canAfford ? 0xFFFFFF : 0xFF6666
});
nameText.anchor.set(0.5, 0.5);
nameText.x = emotionData.x;
nameText.y = emotionData.y + 150;
game.addChild(nameText);
characterImage.nameText = nameText;
characterImage.isOwned = isOwned;
characterImage.canAfford = canAfford;
}
}
}
// Handle sphere selection for character choice
function handleSphereSelection(sphere) {
if (sphere.characterType) {
var characterType = sphere.characterType;
var isOwned = ownedCharacters.indexOf(characterType) !== -1;
var canAfford = totalSpheres >= characterPrices[characterType];
var price = characterPrices[characterType];
// Check if character can be selected
if (!isOwned && !canAfford) {
// Flash red to indicate can't select
LK.effects.flashObject(sphere, 0xFF0000, 500);
// Play error sound
LK.getSound('error').play();
// Show insufficient spheres message
var errorText = new Text2('No tienes esferas suficientes', {
size: 60,
fill: 0xFF0000
});
errorText.anchor.set(0.5, 0.5);
errorText.x = 1024;
errorText.y = 2200;
game.addChild(errorText);
// Remove error message after 2 seconds
LK.setTimeout(function () {
errorText.destroy();
}, 2000);
return;
}
// If not owned but can afford, purchase the character
if (!isOwned && canAfford) {
totalSpheres -= price;
ownedCharacters.push(characterType);
storage.totalSpheres = totalSpheres;
storage.ownedCharacters = ownedCharacters;
// Update spheres display after purchase
var spheresTextElements = [];
for (var k = 0; k < game.children.length; k++) {
if (game.children[k].text && game.children[k].text.indexOf('Esferas:') === 0) {
game.children[k].setText('Esferas: ' + totalSpheres);
break;
}
}
} else if (isOwned) {
// Character is already owned, no need to purchase again
} else {
// Character not owned and can't afford - deduct price anyway and add to owned
totalSpheres -= price;
if (totalSpheres < 0) totalSpheres = 0; // Prevent negative spheres
ownedCharacters.push(characterType);
storage.totalSpheres = totalSpheres;
storage.ownedCharacters = ownedCharacters;
// Update spheres display after purchase
for (var k = 0; k < game.children.length; k++) {
if (game.children[k].text && game.children[k].text.indexOf('Esferas:') === 0) {
game.children[k].setText('Esferas: ' + totalSpheres);
break;
}
}
}
selectedEmotion = characterType;
storage.selectedEmotion = selectedEmotion;
// Flash selected sphere
LK.effects.flashObject(sphere, 0xFFFFFF, 500);
// Clear all spheres and their labels
for (var i = goldenMemories.length - 1; i >= 0; i--) {
if (goldenMemories[i].nameText) {
goldenMemories[i].nameText.destroy();
}
goldenMemories[i].destroy();
goldenMemories.splice(i, 1);
}
// Hide instruction text
instructionText.alpha = 0;
// Start countdown
LK.setTimeout(function () {
startCountdown();
}, 600);
}
}
// Start character selection
function startCharacterSelection() {
gameState = 'characterSelection';
// Hide menu elements
titleText.alpha = 0;
playButton.alpha = 0;
// Show instruction text
instructionText.alpha = 1;
// Spawn character selection spheres
spawnCharacterSelectionSpheres();
}
// Start countdown before game
function startCountdown() {
gameState = 'countdown';
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);
}
// Show jumpscare covering full screen
function showJumpscare() {
if (jumpscareActive) return; // Prevent multiple jumpscares
jumpscareActive = true;
// Create jumpscare image covering full screen
jumpscareImage = LK.getAsset('jumscare', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 5.12,
// Scale to cover 2048px width (2048/400 = 5.12)
scaleY: 6.83 // Scale to cover 2732px height (2732/400 = 6.83)
});
jumpscareImage.x = 1024; // Center horizontally
jumpscareImage.y = 1366; // Center vertically
game.addChild(jumpscareImage);
// Play jumpscare sound immediately
LK.getSound('jumscare').play();
// Keep jumpscare visible for 4.5 seconds then end game
LK.setTimeout(function () {
if (jumpscareImage) {
jumpscareImage.destroy();
jumpscareImage = null;
}
jumpscareActive = false;
// End game after jumpscare
LK.showGameOver();
}, 4500);
}
// Start the actual game
function startActualGame() {
gameState = 'playing';
countdownActive = false;
gameStarted = true;
// Initialize timer
gameTimer = 223;
timerActive = true;
speedIncreased = false;
// Show score text during gameplay
scoreText.alpha = 1;
// 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() {
if (gameState === 'characterSelection') {
// Character selection phase - spawn static character spheres in center
spawnCharacterSelectionSpheres();
} else if (gameState === 'playing') {
// Game phase - spawn colored spheres and corrupted ones
var spawnX = Math.random() * (2048 - 160) + 80;
var randomType = Math.random();
// Define sphere colors for optimization
var sphereColors = [0xffeb3b, 0x4caf50, 0x2196f3, 0xf44336];
var colorThresholds = [0.15, 0.3, 0.45, 0.6];
// Calculate time-based spine multiplier - more spines as time progresses
var initialTimer = 223;
var timeElapsed = initialTimer - gameTimer;
var timeProgressRatio = Math.min(timeElapsed / initialTimer, 1); // 0 to 1 progression
// Base spine spawn probability increases with time (starts at 0.33, goes up to 0.85)
var baseSpineProbability = 0.33 + timeProgressRatio * 0.52;
// Check for golden memory creation - probability decreases over time to allow for more spines
var goldenProbability = 0.67 * (1 - timeProgressRatio * 0.6); // Decreases from 0.67 to ~0.27
var createGolden = false;
var tintColor = 0xffeb3b;
for (var i = 0; i < colorThresholds.length; i++) {
if (randomType < colorThresholds[i] * goldenProbability) {
createGolden = true;
tintColor = sphereColors[i];
break;
}
}
if (createGolden) {
var memory = new GoldenMemory();
memory.x = spawnX;
memory.y = -100;
memory.lastY = memory.y;
memory.children[0].tint = tintColor;
goldenMemories.push(memory);
game.addChild(memory);
} else {
// Corrupted memory with spikes - spawn rate increases dramatically over time
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 (gameState === 'menu') {
// Check if JUGAR button was clicked with invisible hitbox
var playButtonX = playButton.x - playButton.width / 2;
var playButtonY = playButton.y - playButton.height / 2;
var playButtonWidth = playButton.width;
var playButtonHeight = playButton.height;
if (x >= playButtonX && x <= playButtonX + playButtonWidth && y >= playButtonY && y <= playButtonY + playButtonHeight) {
startCharacterSelection();
}
} else if (gameState === 'characterSelection') {
// Check if any character sphere was clicked with invisible hitboxes
for (var i = 0; i < goldenMemories.length; i++) {
var sphere = goldenMemories[i];
var sphereX = sphere.x - 60; // Sphere width is 120, so half is 60
var sphereY = sphere.y - 60; // Sphere height is 120, so half is 60
var sphereWidth = 120;
var sphereHeight = 120;
if (x >= sphereX && x <= sphereX + sphereWidth && y >= sphereY && y <= sphereY + sphereHeight) {
handleSphereSelection(sphere);
break;
}
}
}
};
game.move = function (x, y, obj) {
if (gameStarted && character) {
// Make character stick directly to cursor position
var targetX = Math.max(60, Math.min(1988, x));
var targetY = Math.max(60, Math.min(2672, y));
// Set position directly without tween animation
character.x = targetX;
character.y = targetY;
}
};
// Start spawning spheres for character selection
// Main game update loop
game.update = function () {
// Handle different game states
if (gameState === 'menu') {
return; // No updates needed in menu
}
if (gameState === 'characterSelection') {
// Static spheres, no updates needed
return;
}
if (gameState === 'countdown') {
return; // Countdown handles itself
}
if (gameState !== 'playing') {
return;
}
// Update timer
if (timerActive && LK.ticks % 60 === 0) {
// Update every second (60 ticks = 1 second at 60 FPS)
gameTimer--;
timerText.setText('Tiempo: ' + gameTimer);
// When timer reaches 0, increase speed
if (gameTimer <= 0 && !speedIncreased) {
speedIncreased = true;
timerActive = false;
// Speed increase will be handled in the speed calculation section below
}
}
// Game playing state - spawn spheres
spawnTimer++;
var spawnRate = Math.max(30, 90 - difficultyLevel * 5);
if (spawnTimer >= spawnRate) {
spawnMemory();
spawnTimer = 0;
}
// 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;
var shouldRemove = false;
// Check if off screen
if (golden.lastY <= 2732 && golden.y > 2732) {
shouldRemove = true;
} else if (character && gameStarted && golden.intersects(character)) {
// Check collision with character for game phase
var spherePoints = 3;
// Disgust character gets 2x spheres
if (selectedEmotion === 'disgust') {
spherePoints = 6;
}
LK.setScore(LK.getScore() + spherePoints);
scoreText.setText('Puntos: ' + LK.getScore());
LK.getSound('collect').play();
// Flash character gold
LK.effects.flashObject(character, 0xFFD700, 300);
shouldRemove = true;
} else if (!gameStarted && !countdownActive && golden.characterType && golden.y > 500 && golden.y < 2000) {
// Check collision for character selection phase
handleSphereSelection(golden);
shouldRemove = true;
}
if (shouldRemove) {
golden.destroy();
goldenMemories.splice(i, 1);
} else {
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;
var shouldRemove = false;
// Check if off screen
if (corrupted.lastY <= 2732 && corrupted.y > 2732) {
shouldRemove = true;
} else if (character && corrupted.intersects(character)) {
// Check collision with character
var damage = speedIncreased ? 25 : 20;
health -= damage;
healthText.setText('Vida: ' + health + '/' + maxHealth);
LK.getSound('damage').play();
// Flash character red
LK.effects.flashObject(character, 0xFF0000, 500);
shouldRemove = true;
// Check game over
if (health <= 0) {
// Stop character from following cursor
if (character) {
tween.stop(character);
}
// Increment attempt counter
attemptCount++;
storage.attemptCount = attemptCount;
// Reset accumulated points every 5 attempts
if (attemptCount % 5 === 0) {
totalSpheres = 0;
storage.totalSpheres = 0;
// Reset owned characters except free ones
ownedCharacters = ['joy'];
storage.ownedCharacters = ownedCharacters;
} else {
// Add accumulated points to total spheres
totalSpheres += LK.getScore();
storage.totalSpheres = totalSpheres;
}
// 20% chance of jumpscare
if (Math.random() < 0.2) {
showJumpscare();
// Game over is now handled inside showJumpscare after 4.5 seconds
} else {
// Wait 4.5 seconds before showing game over
LK.setTimeout(function () {
LK.showGameOver();
}, 4500);
}
return;
}
}
if (shouldRemove) {
corrupted.destroy();
corruptedMemories.splice(j, 1);
} else {
corrupted.lastY = corrupted.y;
}
}
// Calculate speed once for efficiency
var goldenBaseSpeed = 3 + difficultyLevel * 0.5;
var corruptedBaseSpeed = 4 + difficultyLevel * 0.5;
if (speedIncreased) {
goldenBaseSpeed += goldenBaseSpeed * 0.5;
corruptedBaseSpeed += corruptedBaseSpeed * 0.5;
}
// Apply calculated speeds
for (var k = 0; k < goldenMemories.length; k++) {
goldenMemories[k].speed = goldenBaseSpeed;
}
for (var l = 0; l < corruptedMemories.length; l++) {
corruptedMemories[l].speed = corruptedBaseSpeed;
}
// Check win condition (500 spheres)
if (totalSpheres >= 500) {
// Create large green "GANASTE" text
var winText = new Text2('GANASTE', {
size: 200,
fill: 0x00FF00
});
winText.anchor.set(0.5, 0.5);
winText.x = 1024;
winText.y = 1366;
game.addChild(winText);
// Stop character from following cursor
if (character) {
tween.stop(character);
}
// Reset accumulated spheres to 0 when winning
totalSpheres = 0;
storage.totalSpheres = 0;
// Show you win after displaying text
LK.setTimeout(function () {
LK.showYouWin();
}, 3000);
}
// Check win condition (score of 50000)
if (LK.getScore() >= 50000) {
// Stop character from following cursor
if (character) {
tween.stop(character);
}
// Increment attempt counter
attemptCount++;
storage.attemptCount = attemptCount;
// Reset accumulated points every 5 attempts
if (attemptCount % 5 === 0) {
totalSpheres = 0;
storage.totalSpheres = 0;
// Reset owned characters except free ones
ownedCharacters = ['joy'];
storage.ownedCharacters = ownedCharacters;
} else {
// Add accumulated points to total spheres
totalSpheres += LK.getScore();
storage.totalSpheres = totalSpheres;
}
LK.showYouWin();
}
}; ===================================================================
--- original.js
+++ change.js
@@ -83,24 +83,24 @@
/****
* Game Code
****/
-// All previously requested features have been successfully implemented:
-// - Invisible hitboxes for JUGAR button and character selection
-// - Jumpscare with 22.2% probability on game over
-// - 223-second countdown timer with speed increase
-// - Character pricing and storage system
-// - Points accumulation (15 per sphere)
-// - Win condition at 50000 points
-// - Spike damage of 25 after timer expires
-// If you need additional features, please specify what you'd like to add
-// Character assets - Joy, Anger, Disgust, Fear
-// Memory sphere assets
-// Sound effects
-// - Insufficient spheres error message ('No tienes esferas suficientes')
-// - Character reset every 5 attempts except free characters (attemptCount % 5 === 0)
-// - Jumpscare probability: 25% (line with Math.random() < 0.25)
// All requested features are already properly implemented:
+// - Jumpscare probability: 25% (line with Math.random() < 0.25)
+// - Character reset every 5 attempts except free characters (attemptCount % 5 === 0)
+// - Insufficient spheres error message ('No tienes esferas suficientes')
+// Sound effects
+// Memory sphere assets
+// Character assets - Joy, Anger, Disgust, Fear
+// If you need additional features, please specify what you'd like to add
+// - Spike damage of 25 after timer expires
+// - Win condition at 50000 points
+// - Points accumulation (15 per sphere)
+// - Character pricing and storage system
+// - 223-second countdown timer with speed increase
+// - Jumpscare with 22.2% probability on game over
+// - Invisible hitboxes for JUGAR button and character selection
+// All previously requested features have been successfully implemented:
var selectedEmotion = storage.selectedEmotion || 'joy';
var gameStarted = false;
var countdownActive = false;
var countdownValue = 3;
@@ -680,8 +680,11 @@
// Stop character from following cursor
if (character) {
tween.stop(character);
}
+ // Reset accumulated spheres to 0 when winning
+ totalSpheres = 0;
+ storage.totalSpheres = 0;
// Show you win after displaying text
LK.setTimeout(function () {
LK.showYouWin();
}, 3000);