User prompt
Cuando comienze el reto de experto que la velocidad de los alimentos baje más rapido. Y el texto en la pantalla que ocupe toda la pantalla y cambia las fuentes del juego a unas más llamativas ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Haz que la barra de Energía vaya avanzando progresivamente según los alimentos saludable que consiga el jugador ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Podrias agrandar la barra de energía
User prompt
Marcador Barra de Energía (agrandalo) (0‐30). Empieza en 15.
‐ A 0 → pantalla “Fatiga” (fin).
Vida = 3 corazones; sin corazones → pantalla “Colapso” (fin).
Niveles–tiempo El juego es endless; a los 30 segundos aparece mensaje “¡Reto experto!” y se agregan bombas de ansiedad (objeto negro) → –5 Energía si se atrapa.
Power‐ups 1 cada 20 alimentos: Botella de agua → restaura +3 Energía.
Duración sprite en pantalla igual a alimentos
↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Agranda el tamño del jugador y de la comida
User prompt
Clasificación 1 Saludables → +1 punto «Energía».
2 Ultraprocesados → –1 vida.
3 Falsos sanos (p. ej. “cereal azucarado”) → –2 puntos «Energía».
Marcador Barra de Energía (0‐30). Empieza en 15.
‐ A 0 → pantalla “Fatiga” (fin).
Vida = 3 corazones; sin corazones → pantalla “Colapso” (fin).
Niveles–tiempo El juego es endless; al minuto 2 aparece mensaje “¡Reto experto!” y se agregan bombas de ansiedad (objeto negro) → –5 Energía si se atrapa.
Power‐ups 1 cada 20 alimentos: Botella de agua → restaura +3 Energía.
Duración sprite en pantalla igual a alimentos.
Feedback inmediato Acierto → sonido “ping”, destello verde en avatar.
Error → sonido “buzz”, destello rojo, vibra (API Vibration) 100 ms en móvil.
Pantalla final ‐ Muestra: Puntuación (Energía alcanzada), tiempo jugado, tabla de mensajes:
▸ ≥25 pts → “¡NutriMáster!”
▸ 15‐24 pts → “¡Buen cazador de nutrientes!”
▸ <15 pts → “Sigue practicando, revisa tus elecciones”.
Reintento Botón “Jugar de nuevo”; re‐inicia variables y anima contador regresivo 3‐2‐1.
↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
User prompt
Que la bola de ansiedad aparezca cada 40 segundos, que la comida caiga en diferentes velocidades ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Clasificación 1 Saludables → +1 punto «Energía».
2 Ultraprocesados → –1 vida.
3 Falsos sanos (p. ej. “cereal azucarado”) → –2 puntos «Energía».
Marcador Barra de Energía (0‐30). Empieza en 15.
‐ A 0 → pantalla “Fatiga” (fin).
Vida = 3 corazones; sin corazones → pantalla “Colapso” (fin).
Niveles–tiempo El juego es endless; al minuto 2 aparece mensaje “¡Reto experto!” y se agregan bombas de ansiedad (objeto negro) → –5 Energía si se atrapa.
Power‐ups 1 cada 20 alimentos: Botella de agua → restaura +3 Energía.
Duración sprite en pantalla igual a alimentos.
Feedback inmediato Acierto → sonido “ping”, destello verde en avatar.
Error → sonido “buzz”, destello rojo, vibra (API Vibration) 100 ms en móvil.
Pantalla final ‐ Muestra: Puntuación (Energía alcanzada), tiempo jugado, tabla de mensajes:
▸ ≥25 pts → “¡NutriMáster!”
▸ 15‐24 pts → “¡Buen cazador de nutrientes!”
▸ <15 pts → “Sigue practicando, revisa tus elecciones”.
Reintento Botón “Jugar de nuevo”; re‐inicia variables y anima contador regresivo 3‐2‐1.
↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
User prompt
Lista mínima de sprites saludables (PNG, fondo transparente): plátano, manzana, zanahoria, brócoli, pan integral, huevo duro. Sprites ultraprocesados: gaseosa, papas fritas de bolsa, caramelo, hamburguesa fast‐food. Sprites falsos sanos: barra “cereal” con azúcar, yogur saborizado azucarado.
User prompt
que la comida sea el doble de grance, que no caiga tanta a la vez y que caiga más rapido
User prompt
que caiga menos fruta y que sea más grande
User prompt
que la fruta sea más grande y rapida, Alimentos que caen ‐ Sprites PNG 96×96 px. ‐ Velocidad inicial 100 px/s; aumenta 10 px/s cada 15 seg. ‐ Cada 0,7 s se instancia 1 alimento en posición X aleatoria arriba del canvas. Clasificación 1 Saludables → +1 punto «Energía». 2 Ultraprocesados → –1 vida. 3 Falsos sanos (p. ej. “cereal azucarado”) → –2 puntos «Energía». Marcador Barra de Energía (0‐30). Empieza en 15. ‐ A 0 → pantalla “Fatiga” (fin). Vida = 3 corazones; sin corazones → pantalla “Colapso” (fin). Niveles–tiempo El juego es endless; al minuto 2 aparece mensaje “¡Reto experto!” y se agregan bombas de ansiedad (objeto negro) → –5 Energía si se atrapa. Power‐ups 1 cada 20 alimentos: Botella de agua → restaura +3 Energía. Duración sprite en pantalla igual a alimentos. Feedback inmediato Acierto → sonido “ping”, destello verde en avatar. Error → sonido “buzz”, destello rojo, vibra (API Vibration) 100 ms en móvil. Pantalla final ‐ Muestra: Puntuación (Energía alcanzada), tiempo jugado, tabla de mensajes: ▸ ≥25 pts → “¡NutriMáster!” ▸ 15‐24 pts → “¡Buen cazador de nutrientes!” ▸ <15 pts → “Sigue practicando, revisa tus elecciones”. Reintento Botón “Jugar de nuevo”; re‐inicia variables y anima contador regresivo 3‐2‐1. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que solamente haya 10 tipos de comida, y aumentales el tamaño un poco más
User prompt
agrega más variedad de comida
User prompt
haz la comida más grande y que caiga más rapido
User prompt
podrías hacer que la fruta caiga más rápido
User prompt
podrías agrandar el tamaño de todo, tambien cambiale la letra a una más llaamtiva, que no caiga tanta comida a la vez y que algunas caigan más rapido que otra
Code edit (1 edits merged)
Please save this source code
User prompt
Caza-ingredientes: Elige bien, vive mejor
Initial prompt
1. Resumen del juego Título: Caza‐ingredientes: Elige bien, vive mejor Género: Arcade «catch‐&‐avoid» (atrapar y esquivar). Público objetivo: Adolescentes de 11‐16 años, nivel de lectura básico‐intermedio, contexto latino (Perú). Plataforma: Web (HTML5/JavaScript, responsive para móviles y escritorio). Duración media de partida: 2‐3 min. (sesiones rápidas, rejugables). Objetivo pedagógico: 1. Reconocer alimentos saludables vs. ultraprocesados. 2. Comprender que las elecciones repetidas repercuten en energía y bienestar. 2. Mecánicas principales Elemento Detalle estricto a implementar Avatar‐canasta Personaje estilo cartoon (neutral, inclusivo) situado en la parte inferior de la pantalla; se mueve solo en eje X con ← → o deslizar dedo. Hitbox ≈ 80 % de sprite. Alimentos que caen ‐ Sprites PNG 96×96 px. ‐ Velocidad inicial 100 px/s; aumenta 10 px/s cada 15 seg. ‐ Cada 0,7 s se instancia 1 alimento en posición X aleatoria arriba del canvas. Clasificación 1 Saludables → +1 punto «Energía». 2 Ultraprocesados → –1 vida. 3 Falsos sanos (p. ej. “cereal azucarado”) → –2 puntos «Energía». Marcador Barra de Energía (0‐30). Empieza en 15. ‐ A 0 → pantalla “Fatiga” (fin). Vida = 3 corazones; sin corazones → pantalla “Colapso” (fin). Niveles–tiempo El juego es endless; al minuto 2 aparece mensaje “¡Reto experto!” y se agregan bombas de ansiedad (objeto negro) → –5 Energía si se atrapa. Power‐ups 1 cada 20 alimentos: Botella de agua → restaura +3 Energía. Duración sprite en pantalla igual a alimentos. Feedback inmediato Acierto → sonido “ping”, destello verde en avatar. Error → sonido “buzz”, destello rojo, vibra (API Vibration) 100 ms en móvil. Pantalla final ‐ Muestra: Puntuación (Energía alcanzada), tiempo jugado, tabla de mensajes: ▸ ≥25 pts → “¡NutriMáster!” ▸ 15‐24 pts → “¡Buen cazador de nutrientes!” ▸ <15 pts → “Sigue practicando, revisa tus elecciones”. Reintento Botón “Jugar de nuevo”; re‐inicia variables y anima contador regresivo 3‐2‐1. 3. Activos y arte Estilo visual: Paleta alegre (verdes/amarillos/naranjas), outline fino tipo cartoon. Lista mínima de sprites saludables (PNG, fondo transparente): plátano, manzana, zanahoria, brócoli, pan integral, huevo duro. Sprites ultraprocesados: gaseosa, papas fritas de bolsa, caramelo, hamburguesa fast‐food. Sprites falsos sanos: barra “cereal” con azúcar, yogur saborizado azucarado. UI: Fuente sans‐serif rounded (p. ej. Poppins). Íconos SVG para corazones y botella de agua. (La IA generadora debe crear o stubear estos sprites; si no, usar colores planos y text labels.) 4. Sonido Sonidos libres (≤ 3 s): ping acierto. buzz error. whoosh caída objeto raro. Loop de música alegre 120 BPM (vol. 0.3). 5. Pseudocódigo clave (referencia rápida) pseudo Copiar Editar init() score = 15 lives = 3 speed = 100 spawnInterval = 0.7 every spawnInterval seconds -> spawnFood() spawnFood() type = weightedRandom(healthy 50%, ultra 35%, fake 10%, water 5%) create sprite at (randX, top) set velocityY = speed update(dt) if time % 15s == 0 -> speed += 10 for each sprite if sprite collides avatar applyEffect(type) destroy sprite else if sprite.y > canvasHeight destroy sprite if score <=0 or lives==0 -> gameOver()
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var FallingItem = Container.expand(function (type) { var self = Container.call(this); self.type = type; self.speed = fallSpeed; var assetName = 'healthyFood'; if (type === 'junk') assetName = 'junkFood';else if (type === 'fake') assetName = 'fakeHealthy';else if (type === 'water') assetName = 'waterBottle';else if (type === 'anxiety') assetName = 'anxietyBomb'; var graphic = self.attachAsset(assetName, { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.y += self.speed; }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerBody = self.attachAsset('player', { anchorX: 0.5, anchorY: 1.0 }); var basket = self.attachAsset('basket', { anchorX: 0.5, anchorY: 0.5, y: -75 }); self.speed = 8; self.targetX = self.x; self.update = function () { var dx = self.targetX - self.x; if (Math.abs(dx) > 5) { self.x += dx * 0.15; } else { self.x = self.targetX; } // Keep player within bounds if (self.x < 75) self.x = 75; if (self.x > 2048 - 75) self.x = 2048 - 75; }; self.moveTo = function (targetX) { self.targetX = targetX; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ // Game variables var player; var fallingItems = []; var energy = 15; var lives = 3; var fallSpeed = 100 / 60; // 100px/s converted to pixels per frame var lastSpeedIncrease = 0; var lastWaterSpawn = 0; var gameStartTime = 0; var foodsCaught = 0; var anxietyBombsActive = false; // UI elements var energyBar; var livesText; var scoreText; var energyText; // Initialize UI function initializeUI() { // Energy bar background var energyBarBg = LK.getAsset('basket', { width: 400, height: 30, anchorX: 0, anchorY: 0 }); energyBarBg.tint = 0x444444; LK.gui.topLeft.addChild(energyBarBg); energyBarBg.x = 150; energyBarBg.y = 20; // Energy bar fill energyBar = LK.getAsset('basket', { width: 200, height: 26, anchorX: 0, anchorY: 0 }); energyBar.tint = 0x32CD32; LK.gui.topLeft.addChild(energyBar); energyBar.x = 152; energyBar.y = 22; // Energy text energyText = new Text2('Energía: 15/30', { size: 24, fill: 0xFFFFFF }); energyText.anchor.set(0, 0); LK.gui.topLeft.addChild(energyText); energyText.x = 150; energyText.y = 60; // Lives text livesText = new Text2('Vidas: 3', { size: 32, fill: 0xFF0000 }); livesText.anchor.set(1, 0); LK.gui.topRight.addChild(livesText); livesText.x = -20; livesText.y = 20; // Score text scoreText = new Text2('Puntuación: 0', { size: 28, fill: 0xFFFFFF }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); scoreText.y = 120; } // Update UI function updateUI() { var energyPercent = Math.max(0, energy / 30); energyBar.width = 396 * energyPercent; if (energy > 20) energyBar.tint = 0x32CD32; // Green else if (energy > 10) energyBar.tint = 0xFFD700; // Yellow else energyBar.tint = 0xFF4500; // Red energyText.setText('Energía: ' + energy + '/30'); livesText.setText('Vidas: ' + lives); scoreText.setText('Puntuación: ' + LK.getScore()); } // Flash effect function flashScreen(color) { LK.effects.flashScreen(color, 300); } // Spawn falling item function spawnFallingItem() { var type = 'healthy'; var rand = Math.random(); if (anxietyBombsActive && rand < 0.1) { type = 'anxiety'; } else if (foodsCaught > 0 && foodsCaught % 20 === 0 && lastWaterSpawn !== foodsCaught) { type = 'water'; lastWaterSpawn = foodsCaught; } else if (rand < 0.3) { type = 'junk'; } else if (rand < 0.5) { type = 'fake'; } var item = new FallingItem(type); item.x = Math.random() * (2048 - 160) + 80; item.y = -50; item.speed = fallSpeed; fallingItems.push(item); game.addChild(item); } // Handle item collision function handleItemCollision(item) { switch (item.type) { case 'healthy': energy = Math.min(30, energy + 1); LK.setScore(LK.getScore() + 10); LK.getSound('ping').play(); flashScreen(0x32CD32); foodsCaught++; break; case 'junk': lives--; LK.getSound('buzz').play(); flashScreen(0xFF4500); tween(player, { tint: 0xFF4500 }, { duration: 200, onFinish: function onFinish() { tween(player, { tint: 0xFFFFFF }, { duration: 200 }); } }); break; case 'fake': energy = Math.max(0, energy - 2); LK.getSound('buzz').play(); flashScreen(0xFFD700); tween(player, { tint: 0xFFD700 }, { duration: 200, onFinish: function onFinish() { tween(player, { tint: 0xFFFFFF }, { duration: 200 }); } }); break; case 'water': energy = Math.min(30, energy + 3); LK.setScore(LK.getScore() + 20); LK.getSound('powerup').play(); flashScreen(0x00BFFF); tween(player, { scaleX: 1.2, scaleY: 1.2 }, { duration: 150, onFinish: function onFinish() { tween(player, { scaleX: 1.0, scaleY: 1.0 }, { duration: 150 }); } }); break; case 'anxiety': energy = Math.max(0, energy - 5); LK.getSound('explosion').play(); flashScreen(0x8B008B); tween(player, { tint: 0x8B008B }, { duration: 300, onFinish: function onFinish() { tween(player, { tint: 0xFFFFFF }, { duration: 300 }); } }); break; } } // Initialize game function initializeGame() { gameStartTime = LK.ticks; // Create player player = new Player(); player.x = 2048 / 2; player.y = 2732 - 100; game.addChild(player); // Initialize UI initializeUI(); updateUI(); } // Game input handling game.down = function (x, y, obj) { var gamePos = game.toLocal({ x: x, y: y }); player.moveTo(gamePos.x); }; game.move = function (x, y, obj) { var gamePos = game.toLocal({ x: x, y: y }); player.moveTo(gamePos.x); }; // Main game update loop game.update = function () { var currentTime = LK.ticks; var gameTime = (currentTime - gameStartTime) / 60; // Convert to seconds // Increase speed every 15 seconds if (gameTime - lastSpeedIncrease >= 15) { fallSpeed += 10 / 60; // Increase by 10px/s lastSpeedIncrease = gameTime; } // Activate anxiety bombs after 2 minutes if (gameTime >= 120 && !anxietyBombsActive) { anxietyBombsActive = true; } // Spawn items randomly if (Math.random() < 0.02) { spawnFallingItem(); } // Update falling items for (var i = fallingItems.length - 1; i >= 0; i--) { var item = fallingItems[i]; // Check collision with player if (item.intersects(player)) { handleItemCollision(item); item.destroy(); fallingItems.splice(i, 1); continue; } // Remove items that fall off screen if (item.y > 2732 + 100) { item.destroy(); fallingItems.splice(i, 1); } } // Update UI updateUI(); // Check game over conditions if (energy <= 0 || lives <= 0) { var finalScore = Math.max(0, energy * 10); LK.setScore(finalScore); if (finalScore > 200) { // High score message } else if (finalScore > 100) { // Medium score message } else { // Low score message - encourage better choices } LK.showGameOver(); } }; // Initialize the game initializeGame();
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,327 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var FallingItem = Container.expand(function (type) {
+ var self = Container.call(this);
+ self.type = type;
+ self.speed = fallSpeed;
+ var assetName = 'healthyFood';
+ if (type === 'junk') assetName = 'junkFood';else if (type === 'fake') assetName = 'fakeHealthy';else if (type === 'water') assetName = 'waterBottle';else if (type === 'anxiety') assetName = 'anxietyBomb';
+ var graphic = self.attachAsset(assetName, {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.update = function () {
+ self.y += self.speed;
+ };
+ return self;
+});
+var Player = Container.expand(function () {
+ var self = Container.call(this);
+ var playerBody = self.attachAsset('player', {
+ anchorX: 0.5,
+ anchorY: 1.0
+ });
+ var basket = self.attachAsset('basket', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ y: -75
+ });
+ self.speed = 8;
+ self.targetX = self.x;
+ self.update = function () {
+ var dx = self.targetX - self.x;
+ if (Math.abs(dx) > 5) {
+ self.x += dx * 0.15;
+ } else {
+ self.x = self.targetX;
+ }
+ // Keep player within bounds
+ if (self.x < 75) self.x = 75;
+ if (self.x > 2048 - 75) self.x = 2048 - 75;
+ };
+ self.moveTo = function (targetX) {
+ self.targetX = targetX;
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x87CEEB
+});
+
+/****
+* Game Code
+****/
+// Game variables
+var player;
+var fallingItems = [];
+var energy = 15;
+var lives = 3;
+var fallSpeed = 100 / 60; // 100px/s converted to pixels per frame
+var lastSpeedIncrease = 0;
+var lastWaterSpawn = 0;
+var gameStartTime = 0;
+var foodsCaught = 0;
+var anxietyBombsActive = false;
+// UI elements
+var energyBar;
+var livesText;
+var scoreText;
+var energyText;
+// Initialize UI
+function initializeUI() {
+ // Energy bar background
+ var energyBarBg = LK.getAsset('basket', {
+ width: 400,
+ height: 30,
+ anchorX: 0,
+ anchorY: 0
+ });
+ energyBarBg.tint = 0x444444;
+ LK.gui.topLeft.addChild(energyBarBg);
+ energyBarBg.x = 150;
+ energyBarBg.y = 20;
+ // Energy bar fill
+ energyBar = LK.getAsset('basket', {
+ width: 200,
+ height: 26,
+ anchorX: 0,
+ anchorY: 0
+ });
+ energyBar.tint = 0x32CD32;
+ LK.gui.topLeft.addChild(energyBar);
+ energyBar.x = 152;
+ energyBar.y = 22;
+ // Energy text
+ energyText = new Text2('Energía: 15/30', {
+ size: 24,
+ fill: 0xFFFFFF
+ });
+ energyText.anchor.set(0, 0);
+ LK.gui.topLeft.addChild(energyText);
+ energyText.x = 150;
+ energyText.y = 60;
+ // Lives text
+ livesText = new Text2('Vidas: 3', {
+ size: 32,
+ fill: 0xFF0000
+ });
+ livesText.anchor.set(1, 0);
+ LK.gui.topRight.addChild(livesText);
+ livesText.x = -20;
+ livesText.y = 20;
+ // Score text
+ scoreText = new Text2('Puntuación: 0', {
+ size: 28,
+ fill: 0xFFFFFF
+ });
+ scoreText.anchor.set(0.5, 0);
+ LK.gui.top.addChild(scoreText);
+ scoreText.y = 120;
+}
+// Update UI
+function updateUI() {
+ var energyPercent = Math.max(0, energy / 30);
+ energyBar.width = 396 * energyPercent;
+ if (energy > 20) energyBar.tint = 0x32CD32; // Green
+ else if (energy > 10) energyBar.tint = 0xFFD700; // Yellow
+ else energyBar.tint = 0xFF4500; // Red
+ energyText.setText('Energía: ' + energy + '/30');
+ livesText.setText('Vidas: ' + lives);
+ scoreText.setText('Puntuación: ' + LK.getScore());
+}
+// Flash effect
+function flashScreen(color) {
+ LK.effects.flashScreen(color, 300);
+}
+// Spawn falling item
+function spawnFallingItem() {
+ var type = 'healthy';
+ var rand = Math.random();
+ if (anxietyBombsActive && rand < 0.1) {
+ type = 'anxiety';
+ } else if (foodsCaught > 0 && foodsCaught % 20 === 0 && lastWaterSpawn !== foodsCaught) {
+ type = 'water';
+ lastWaterSpawn = foodsCaught;
+ } else if (rand < 0.3) {
+ type = 'junk';
+ } else if (rand < 0.5) {
+ type = 'fake';
+ }
+ var item = new FallingItem(type);
+ item.x = Math.random() * (2048 - 160) + 80;
+ item.y = -50;
+ item.speed = fallSpeed;
+ fallingItems.push(item);
+ game.addChild(item);
+}
+// Handle item collision
+function handleItemCollision(item) {
+ switch (item.type) {
+ case 'healthy':
+ energy = Math.min(30, energy + 1);
+ LK.setScore(LK.getScore() + 10);
+ LK.getSound('ping').play();
+ flashScreen(0x32CD32);
+ foodsCaught++;
+ break;
+ case 'junk':
+ lives--;
+ LK.getSound('buzz').play();
+ flashScreen(0xFF4500);
+ tween(player, {
+ tint: 0xFF4500
+ }, {
+ duration: 200,
+ onFinish: function onFinish() {
+ tween(player, {
+ tint: 0xFFFFFF
+ }, {
+ duration: 200
+ });
+ }
+ });
+ break;
+ case 'fake':
+ energy = Math.max(0, energy - 2);
+ LK.getSound('buzz').play();
+ flashScreen(0xFFD700);
+ tween(player, {
+ tint: 0xFFD700
+ }, {
+ duration: 200,
+ onFinish: function onFinish() {
+ tween(player, {
+ tint: 0xFFFFFF
+ }, {
+ duration: 200
+ });
+ }
+ });
+ break;
+ case 'water':
+ energy = Math.min(30, energy + 3);
+ LK.setScore(LK.getScore() + 20);
+ LK.getSound('powerup').play();
+ flashScreen(0x00BFFF);
+ tween(player, {
+ scaleX: 1.2,
+ scaleY: 1.2
+ }, {
+ duration: 150,
+ onFinish: function onFinish() {
+ tween(player, {
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 150
+ });
+ }
+ });
+ break;
+ case 'anxiety':
+ energy = Math.max(0, energy - 5);
+ LK.getSound('explosion').play();
+ flashScreen(0x8B008B);
+ tween(player, {
+ tint: 0x8B008B
+ }, {
+ duration: 300,
+ onFinish: function onFinish() {
+ tween(player, {
+ tint: 0xFFFFFF
+ }, {
+ duration: 300
+ });
+ }
+ });
+ break;
+ }
+}
+// Initialize game
+function initializeGame() {
+ gameStartTime = LK.ticks;
+ // Create player
+ player = new Player();
+ player.x = 2048 / 2;
+ player.y = 2732 - 100;
+ game.addChild(player);
+ // Initialize UI
+ initializeUI();
+ updateUI();
+}
+// Game input handling
+game.down = function (x, y, obj) {
+ var gamePos = game.toLocal({
+ x: x,
+ y: y
+ });
+ player.moveTo(gamePos.x);
+};
+game.move = function (x, y, obj) {
+ var gamePos = game.toLocal({
+ x: x,
+ y: y
+ });
+ player.moveTo(gamePos.x);
+};
+// Main game update loop
+game.update = function () {
+ var currentTime = LK.ticks;
+ var gameTime = (currentTime - gameStartTime) / 60; // Convert to seconds
+ // Increase speed every 15 seconds
+ if (gameTime - lastSpeedIncrease >= 15) {
+ fallSpeed += 10 / 60; // Increase by 10px/s
+ lastSpeedIncrease = gameTime;
+ }
+ // Activate anxiety bombs after 2 minutes
+ if (gameTime >= 120 && !anxietyBombsActive) {
+ anxietyBombsActive = true;
+ }
+ // Spawn items randomly
+ if (Math.random() < 0.02) {
+ spawnFallingItem();
+ }
+ // Update falling items
+ for (var i = fallingItems.length - 1; i >= 0; i--) {
+ var item = fallingItems[i];
+ // Check collision with player
+ if (item.intersects(player)) {
+ handleItemCollision(item);
+ item.destroy();
+ fallingItems.splice(i, 1);
+ continue;
+ }
+ // Remove items that fall off screen
+ if (item.y > 2732 + 100) {
+ item.destroy();
+ fallingItems.splice(i, 1);
+ }
+ }
+ // Update UI
+ updateUI();
+ // Check game over conditions
+ if (energy <= 0 || lives <= 0) {
+ var finalScore = Math.max(0, energy * 10);
+ LK.setScore(finalScore);
+ if (finalScore > 200) {
+ // High score message
+ } else if (finalScore > 100) {
+ // Medium score message
+ } else {
+ // Low score message - encourage better choices
+ }
+ LK.showGameOver();
+ }
+};
+// Initialize the game
+initializeGame();
\ No newline at end of file