User prompt
no se si es un bug o que pero hay una imagen negra que aumenta su opacidad y luego la disminuye, elimina eso, el texto: "terror paint draw if you dare" elimínalo gracias, también que todos los colores seleccionables sean diferentes entre si, también has que todas las brochas funciones como la de hacer un circulo, la de line y casi todas no funcionan, ARREGLALAS, gracias, y has que en si los botones estén un poco mas abajo y sean mas pequeños porque el botón de pausa interfiere con ellos.
User prompt
Please fix the bug: 'TypeError: Cannot use 'in' operator to search for 'rotation' in undefined' in or related to this line: 'tween(strokes[i], {' Line Number: 342 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Terror Paint - Horror Drawing Nightmare
Initial prompt
quiero programar un juego estilo paint pero de terror, comenzemos primero por sus mecanicas estilo paint: Lápiz: dibujar trazos libres como si fuera a mano alzada. Pinceles: trazos con distintos grosores y estilos. Borrador: elimina parte del dibujo. Cubeta de relleno: rellena áreas cerradas con color. Línea, rectángulo, círculo y otras formas: permite dibujar figuras geométricas. Texto: insertar palabras con fuentes y tamaños. Selección: cortar, copiar, mover o redimensionar partes del dibujo. Colores: elegir color de trazo y de relleno. Zoom y recorte: ajustar la vista y cortar secciones de la imagen.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { language: "es", currentAct: 1 }); /**** * Classes ****/ var BrushStroke = Container.expand(function (x, y, color, size) { var self = Container.call(this); var stroke = self.attachAsset('brushStroke', { anchorX: 0.5, anchorY: 0.5, scaleX: size / 20, scaleY: size / 20 }); // Apply color after asset is attached stroke.tint = color; self.x = x; self.y = y; self.originalColor = color; return self; }); var ColorSwatch = Container.expand(function (colorAsset, color, x, y) { var self = Container.call(this); self.color = color; var swatch = self.attachAsset(colorAsset, { anchorX: 0.5, anchorY: 0.5 }); self.x = x; self.y = y; self.down = function (x, y, obj) { LK.getSound('click').play(); currentColor = self.color; console.log("Color selected: 0x" + self.color.toString(16) + " from asset: " + colorAsset); console.log("currentColor is now: 0x" + currentColor.toString(16)); updateColorSelection(); }; return self; }); var DialogSystem = Container.expand(function () { var self = Container.call(this); self.visible = false; self.currentDialog = 0; self.dialogs = []; self.onComplete = null; var dialogBg = self.attachAsset('dialogBox', { anchorX: 0.5, anchorY: 1, x: 0, y: -50 }); self.dialogText = new Text2('', { size: 28, fill: 0xFFFFFF, wordWrap: true, wordWrapWidth: 1700 }); self.dialogText.anchor.set(0.5, 0.5); self.dialogText.x = 0; self.dialogText.y = -200; self.addChild(self.dialogText); self.spaceText = new Text2('', { size: 20, fill: 0xCCCCCC }); self.spaceText.anchor.set(1, 1); self.spaceText.x = 850; self.spaceText.y = -70; self.addChild(self.spaceText); self.showDialog = function (dialogs, onComplete) { self.dialogs = dialogs; self.currentDialog = 0; self.onComplete = onComplete; self.visible = true; self.updateDialog(); }; self.updateDialog = function () { if (self.currentDialog < self.dialogs.length) { self.dialogText.setText(self.dialogs[self.currentDialog]); self.spaceText.setText(getLocalizedText('pressSpace')); } else { self.visible = false; if (self.onComplete) { self.onComplete(); } } }; self.nextDialog = function () { self.currentDialog++; self.updateDialog(); }; return self; }); var DrawingTool = Container.expand(function (toolType, x, y) { var self = Container.call(this); self.toolType = toolType; self.isActive = false; var buttonBg = self.attachAsset('toolButton', { anchorX: 0.5, anchorY: 0.5 }); var toolLabel = new Text2(toolType, { size: 18, fill: 0xFFFFFF }); toolLabel.anchor.set(0.5, 0.5); self.addChild(toolLabel); self.x = x; self.y = y; self.setActive = function (active) { self.isActive = active; if (active) { buttonBg.tint = 0x666666; } else { buttonBg.tint = 0x333333; } }; self.down = function (x, y, obj) { LK.getSound('click').play(); currentTool = self.toolType; updateToolSelection(); }; return self; }); var MenuButton = Container.expand(function (text, x, y, callback) { var self = Container.call(this); var buttonBg = self.attachAsset('menuButton', { anchorX: 0.5, anchorY: 0.5 }); var buttonLabel = new Text2(text, { size: 32, fill: 0xFFFFFF }); buttonLabel.anchor.set(0.5, 0.5); self.addChild(buttonLabel); self.x = x; self.y = y; self.callback = callback; self.down = function (x, y, obj) { LK.getSound('click').play(); if (self.callback) { self.callback(); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x808080 }); /**** * Game Code ****/ // Game state variables var gameState = 'menu'; // menu, story, painting, ending var currentLanguage = storage.language || 'es'; var currentAct = storage.currentAct || 1; // Act 2 variables var act2DialogIndex = 0; var act2Dialogs = []; var flashlightSprite = null; var forestSprite = null; var colorObjects = []; var collectedColors = 0; var colorCounter = null; var lightMask = null; // Act 3 variables var act3Timer = null; var act3TimeRemaining = 120; // 2 minutes in seconds var act3TimerText = null; // Act 4 variables var habitacion1Sprite = null; var habitacion2Sprite = null; var act4Timer = null; var act4TimeRemaining = 60; // 1 minute in seconds var act4TimerText = null; var fireSprite = null; // Language system var texts = { es: { title: 'BLACK PAINT', playButton: 'jugar acto', languageButton: 'lenguaje', pressSpace: 'Haz CLICK en cualquier lugar para continuar', sendButton: 'enviar', dialog1: 'wendigo: "¡Oh, hola, hola! No tengas miedo... mírame, ¿ves? Soy solo una criatura curiosa que vive entre líneas y colores. Nada peligroso por aquí... je, je."', dialog2: 'wendigo: "Ahora... tengo una idea. ¿Quieres jugar conmigo? Te prometo que será divertido. El siguiente juego no es de correr ni de pelear... no, no, no. Será algo más fácil un juego de dibujos"', dialog3: 'wendigo: "¿Quieres intentarlo? No te preocupes, no pasara nada malo... solo tienes que dibujar... y seguir jugando conmigo"', dialog4: 'wendigo: "este es el lienzo, tienes un lápiz, un aerógrafo, un borrador, una cubeta para rellenar lo dibujado, una linea para hacer trazos rectos, un rectángulo, y un circulo, espero te diviertas usándolo, cuando termines tu dibujo puedes mostrármelo presionando el botón enviar!"', dialog5: 'wendigo: "bueno... no esta mal... podrías haberlo hecho mejor pero creo que es aceptable... nos vemos mañana nuevo amigo!"', tools: ['Lápiz', 'Aerógrafo', 'Borrador', 'Cubeta', 'Línea', 'Rectángulo', 'Círculo'], act2Dialog1: 'wendigo: "Ahhh… ya lo vi… tu dibujo anterior. Sí, sí… lo recuerdo bien. No está mal, no, no… pero le falta algo, ¿no lo notas? Está… vacío. No tiene colores. Todo pálido, todo triste… como un cuerpo sin sangre."', act2Dialog2: 'wendigo: "Pero no pasa nada, ¡yo sé por qué! Los colores se han escapado… se esconden en la oscuridad. Y para recuperarlos… necesitarás esto."', act2Dialog3: 'wendigo: "Una linterna… tu nueva amiga. Con ella podrás explorar, iluminar los rincones oscuros… y cuando la luz toque un color perdido, ¡oh, lo verás brillar!"', act2Dialog4: 'wendigo: "Cuando encuentres uno, acércate… recógelo (tócalo)… guárdalo muy cerca de ti. Uno por uno, los colores volverán. Y tus dibujos… tu dibujo serán hermosos… más vivos… más… reales."', act2Dialog5: 'wendigo: "¿Estás listo? Sígueme, pequeño artista… busquemos lo que falta."', act2EndDialog1: 'wendigo: "¡Jajaja! ¡Ahí están! ¡Los atrapaste a todos! Qué obediente eres, qué manitas más hábiles tienes…"', act2EndDialog2: 'wendigo: "Los colores te querían, ¿sabes? Gritaban en la oscuridad, pedían que los encontraras"', act2EndDialog3: 'wendigo: "¡Míralos! Brillan, se retuercen, danzan alrededor de ti como pequeñas luces vivas"', act2EndDialog4: 'wendigo: "Tu dibujo ya no estará vacío. Ahora… tendrá carne, tendrá voz"', act2EndDialog5: 'wendigo: "¿Ves? Te dije que sería divertido. Gracias… gracias por traerlos de regreso… ahora podremos jugar más, mucho más…"', act2EndDialog6: 'wendigo: "Has hecho algo hermoso… algo que nunca se olvidará"', act2EndDialog7: 'wendigo: "ahora ya no están solos. Y yo tampoco…"', act2EndDialog8: 'wendigo: "mañana nos volveremos a ver amigo :)"', act3Dialog1: 'wendigo: "Ah… hola, hola… ya estás aquí otra vez. Qué bien… pensé que tal vez no volverías después de… de anoche... fue divertido cuando jugamos"', act3Dialog2: 'wendigo: "La verdad… no dormí muy bien. Tuve… una pelea. Sí… con mi padre. Él siempre gruñe, siempre dice que juego demasiado contigo… así que… pues… me lo comí. sabia similar a la carne de res pero tenia un sabor mas magro"', act3Dialog3: 'wendigo: "Je, je… pero, ¿sabes qué? Eso no me llenó. Todavía tenía hambre. Mucha hambre… y… bueno… me comí los colores que habías encontrado"', act3Dialog4: 'wendigo: "Así que hoy… no quedan más. Solo uno. El negro. Mi favorito."', act3Dialog5: 'wendigo: "Tu misión de hoy será simple: un dibujo, solo con negro. Solo con sombras, solo con vacío. Pero… habrá un detalle: el tiempo. Solo tendrás dos minutos antes de que la luz se apague, ¿entiendes?"', act3Dialog6: 'wendigo: "Hazlo rápido, hazlo bien… porque yo estaré mirando. Y cuando termines… quizá te deje jugar… un poco más."', act3EndDialog1: 'Wendigo: "¡Se acabó el tiempo! Je, je, je… ¡déjame ver, déjame ver! ¿Qué hiciste en solo dos minutos?"', act3EndDialog2: 'Wendigo: "Ohhh… interesante… tan oscuro… tan… vacío. El negro lo cubre todo, como si tragara la luz."', act3EndDialog3: 'Wendigo: "¿Sabes? Parece más que un dibujo… parece una ventana… ¡sí! Una ventana que se abre hacia… allá. Je, je, je…"', act3EndDialog4: 'Wendigo: "Me gusta. Sí… me gusta mucho. Tiene hambre… igual que yo."', act3EndDialog5: 'Wendigo: "Lo hiciste bien, pequeño artista. Muy bien. ¿Quieres saber un secreto? Mientras dibujabas… yo también dibujé… pero no con manos, no con pinceles. Dibujé con tus sombras."', act3EndDialog6: 'Wendigo: "Y ahora… el juego puede continuar."', act3EndDialog7: 'Wendigo: "Se que te queda poco tiempo aquí así que quiero que esta aventura sea inolvidable... nos veremos pronto mi amigo!"', act4Dialog1: 'Wendigo: "Hola… hola… no quería asustarte. Solo… solo quería compañía."', act4Dialog2: 'Wendigo: "Es difícil… estar solo. Nadie queda para hablar conmigo… mi madre… falleció. Mi padre… también se fue… bueno, ya sabes… me lo comí."', act4Dialog3: 'Wendigo: "Jajaja… es raro, ¿verdad? Nadie que me cuide… nadie que me abrace… y aun así… aquí estoy, contigo."', act4Dialog4: 'Wendigo: "Mi madre adoptiva era una cierva… y mi padre adoptivo, un antílope… un Lechwe, muy elegante. Yo… nunca supe lo que soy realmente. Tampoco conozco a mis padres biológicos."', act4Dialog5: 'Wendigo: "Ese era el motivo de la pelea con mi padre el otro día… creo que me excedí un poco al comerlo. Debí primero sazonarlo, ¿sabes? Jajaja… je, je…"', act4Dialog6: 'Wendigo: "Y ahora… no tengo a nadie. Nadie con quien compartir… excepto… tú. ¿Puedo quedarme un rato? Solo… un ratito… mientras te duermes."', act4Dialog7: 'Wendigo: "¿Ves esto? Esto también es arte… igual que tu dibujo… solo que… un poco más… vivo."', act4Dialog8: 'Wendigo: "Y ahora… no tengo a nadie. Nadie con quien compartir… excepto… tú. ¿Puedo quedarme un rato? Solo… un ratito… mientras te duermes."', act4Dialog9: 'Wendigo: "Prometo no hacer ruido… solo escuchar… o quizá contarte historias… Historias de sombras… de cosas que se esconden cuando los demás se van… Historias de… lo que queda cuando alguien se va… para siempre."', act4Dialog10: 'Wendigo: "¿Ves la sombra ahí? Sí… esa que se mueve sola… no… no soy yo… bueno… tal vez sí… Jajaja… me gusta verte dormido y saber que estás aquí… conmigo… No te preocupes… solo estoy… viéndote. Solo un ratito."', act4StartDialog1: 'Wendigo: "Ahhh… ahí estás. Te buscaba. ¿Dormiste bien? Yo… no tanto. Cuando estaba contigo anoche… algo pasó. Je, je, je… tuve hambre… y no pude aguantarme."', act4StartDialog2: 'Wendigo: "Me comí… una parte de ti. Sí… algo muy tuyo… algo que nunca vuelve. ¿Quieres saber qué fue?"', act4StartDialog3: 'Wendigo: "Te lo diré, pero solo si cumples con mi reto de hoy. Escucha bien: harás un dibujo… solo con lápiz. Nada de aerógrafo, nada de figuras, nada de borrador… solo un trazo negro, directo, crudo."', act4StartDialog4: 'Wendigo: "Un dibujo… que me guste. Uno que me hable. Pero tendrás solo un minuto antes de que el bosque se trague la luz."', act4StartDialog5: 'Wendigo: "Corre, pequeño artista, corre. Traza, dibuja, crea. Y si lo haces bien… si me complaces… te diré qué pedazo de ti me llevé conmigo anoche. Je, je, je…"', act4StartDialog6: 'Wendigo: "Empieza ahora… el tiempo ya corre…"', act4EndDialog1: 'Wendigo: "Mmhh… ¿esto es todo? ¿Esto es lo que hiciste para mí?"', act4EndDialog2: 'Wendigo: "No… no me gusta. Es torpe… vacío… no me dice nada. Nada de ti, nada de lo que escondes."', act4EndDialog3: 'Wendigo: "Tu esfuerzo… reducido a cenizas. Mira cómo desaparece, como si nunca hubiera existido. Así de frágil eres, ¿sabes? Así de fácil es borrar lo que haces."', act4EndDialog4: 'Wendigo: "Dijimos un trato… y no cumpliste. Querías saber qué parte de ti me comí anoche… pero no, no te lo diré. Ese secreto… seguirá siendo mío."', act4EndDialog5: 'Wendigo: "Adiós por ahora, pequeño artista. Guarda tus manos, guarda tu tiempo… quizá mañana me des algo que valga la pena."', act4EndDialog6: 'Wendigo: "Nos veremos pronto… y recuerda… aún tengo hambre."', act4RoomDialog1: 'Wendigo: "¿Estás despierto…? Soy yo… no quiero asustarte otra vez."', act4RoomDialog2: 'Wendigo: "Vine porque… lo pensé bien… y… creo que me equivoqué contigo."', act4RoomDialog3: 'Wendigo: "Lo siento… por quemar tu dibujo. Lo siento por no decirte la verdad."', act4RoomDialog4: 'Wendigo: "Sin ti… no soy nada. Solo un ruido en el bosque, una sombra entre ramas."', act4RoomDialog5: 'Wendigo: "Cuando no estás… todo se siente… vacío."', act4RoomDialog6: 'Wendigo: "Yo río, yo juego, yo como… pero al final… ¿para qué?"', act4RoomDialog7: 'Wendigo: "Sin ti, no tiene sentido. Eres lo único que me mantiene aquí, el único que me escucha… el único que me deja ser alguien."', act4RoomDialog8: 'Wendigo: "Perdóname, pequeño artista. No quiero perderte."', act4RoomDialog9: 'Wendigo: "Te prometo que mañana será distinto… si me dejas quedarme esta noche, aunque sea en silencio."', act4RoomDialog10: 'Wendigo: "Déjame estar aquí… porque sin ti… yo no soy nada."', act5Dialog1: 'Wendigo: "Buenos días, pequeño artista… ¿lo sientes? Sí… el aire es distinto hoy. Porque hoy será… tu último día aquí, conmigo."', act5Dialog2: 'Wendigo: "Has jugado, has buscado, has dibujado con lo que te di… y aunque a veces no entendieras mis juegos… llegaste hasta aquí. Por eso… hoy quiero darte algo distinto."', act5Dialog3: 'Wendigo: "Libre albedrío. Eso tendrás. Podrás dibujar lo que quieras… lo que nazca de ti. El único límite es el color… solo queda el negro. Ya lo sabes… los demás me los comí."', act5Dialog4: 'Wendigo: "Pero escucha: tendrás de nuevo todas las herramientas que alguna vez usaste. El lápiz, el borrador, el aerógrafo… la línea… el rectángulo… y el círculo. Todos a tu disposición."', act5Dialog5: 'Wendigo: "Haz lo que quieras. Una forma, un recuerdo, un monstruo… o un sueño. No pondré reglas esta vez."', act5Dialog6: 'Wendigo: "Será tu último trazo aquí… el último que yo veré."', act5Dialog7: 'Wendigo: "Así que hazlo tuyo. Hazlo eterno."', act5Dialog8: 'Wendigo: "Y yo… lo guardaré… en mi memoria… y en mis entrañas."', act5EndDialog1: 'Wendigo: "…Míralo. Tu obra final. Es digno. Sí… digno de ti, de todo lo que pasaste aquí conmigo."', act5EndDialog2: 'Wendigo: "No es perfecto… pero eso está bien. ¿Sabes por qué? Porque nada lo es. Ni yo… ni tú… ni siquiera este bosque. La imperfección… es lo que lo hace verdadero."', act5EndDialog3: 'Wendigo: "Y ahora… llegamos al final de nuestro juego. Pero el final no siempre significa lo mismo."', act5EndDialog4: 'Wendigo: "Tienes que decidir ¿Quieres irte… volver a tu mundo, a tu vida, sin mí…? O… ¿quieres quedarte? Quedarte aquí, en la penumbra del bosque, conmigo… para seguir dibujando sombras, colores que nadie más verá."', act5EndDialog5: 'Wendigo: "La elección es tuya, pequeño artista. El último trazo… lo haces tú."', act5LeaveDialog1: 'Wendigo: "Así que… has elegido irte. Volver a tu mundo, a tu vida. No te culpo… aunque me duela. Sabía que este momento llegaría."', act5LeaveDialog2: 'Wendigo: "Pero… antes de que te marches… tengo que ser honesto contigo. Te debo la verdad. ¿Recuerdas aquella noche, cuando te dije que me había comido una parte de ti? No fue por hambre… no. Mentí."', act5LeaveDialog3: 'Wendigo: "Lo que realmente me comí…"', act5LeaveDialog4: 'Wendigo: "fue tu alma."', act5LeaveDialog5: 'Wendigo: "No lo hice por necesidad… lo hice porque quería que fueras como yo. Un ser extraño, incompleto… alguien que pudiera quedarse aquí conmigo, en este mundo sin color. Yo… no quería estar solo."', act5LeaveDialog6: 'Wendigo: "Pero ahora lo entiendo… tú también tienes una vida allá fuera. Y al haberte robado tu alma… te quité algo que jamás podré devolverte. Cuando regreses al mundo real… serás diferente."', act5LeaveDialog7: 'Wendigo: "Ya no podrás amar… ni sentir… aunque lo desees con todo tu corazón. Porque sin alma… no hay nada que pueda llenarte."', act5LeaveDialog8: 'Wendigo: "Perdóname… pequeño artista… Perdóname por condenarte a esa sombra vacía. Si pudiera… lo desharía. Pero ya es tarde."', act5LeaveDialog9: 'Wendigo: "Adiós… pequeño artista."', act5StayDialog1: 'Wendigo: "¡Así que… elegiste quedarte! Je, je, je… sabía que lo harías. Sabía que no me dejarías solo… no tú."', act5StayDialog2: 'Wendigo: "Ahora puedo decirte la verdad… ¿recuerdas aquella noche? Cuando te dije que me comí una parte de ti…"', act5StayDialog3: 'Wendigo: "Lo que tomé de ti…"', act5StayDialog4: 'wendigo: "fue tu alma."', act5StayDialog5: 'Wendigo: "No lo hice por hambre… ¡no! Lo hice porque quería que fueras como yo. Un ser extraño… diferente… alguien capaz de vivir aquí conmigo, en este mundo sin color."', act5StayDialog6: 'Wendigo: "Y ahora… ahora ya no estaré solo nunca más."', act5StayDialog7: 'Wendigo: "Eres como yo… ahora. Sin alma… sin esa carga… libre de lo que amarra a los demás. Libre para quedarte… conmigo."', act5StayDialog8: 'Wendigo: "te obsequio esto, es el cráneo de mi padre, creo que te mencione que era un antílope, no suelo comer huesos, así que lo guarde para un momento especial, y creo que este es ese momento pequeño artista"', act5StayDialog9: 'Wendigo: "¡Gracias! Gracias por elegirme, por quedarte… por ser mi amigo. Ahora podremos caminar juntos, dibujar juntos… reír juntos… Para siempre, en este bosque sin color."', act5StayDialog10: 'Wendigo: "Ya no estoy solo… porque ahora… te tengo a ti."', timeRemaining: 'te quedan ___ para terminar tu dibujo', colorsCollected: 'COLORES RECOLECTADOS' }, en: { title: 'BLACK PAINT', playButton: 'play act', languageButton: 'language', pressSpace: 'CLICK anywhere to continue', sendButton: 'send', dialog1: 'wendigo: "Oh, hello, hello! Don\'t be afraid... look at me, see? I\'m just a curious creature that lives between lines and colors. Nothing dangerous here... heh, heh."', dialog2: 'wendigo: "Now... I have an idea. Do you want to play with me? I promise it will be fun. The next game is not about running or fighting... no, no, no. It will be something easier, a drawing game"', dialog3: 'wendigo: "Do you want to try it? Don\'t worry, nothing bad will happen... you just have to draw... and keep playing with me"', dialog4: 'wendigo: "this is the canvas, you have a pencil, an airbrush, an eraser, a bucket to fill what you draw, a line to make straight strokes, a rectangle, and a circle, I hope you have fun using it, when you finish your drawing you can show it to me by pressing the send button!"', dialog5: 'wendigo: "well... not bad... you could have done better but I think it\'s acceptable... see you tomorrow new friend!"', tools: ['Pencil', 'Airbrush', 'Eraser', 'Bucket', 'Line', 'Rectangle', 'Circle'], act2Dialog1: 'wendigo: "Ahhh… I saw it… your previous drawing. Yes, yes… I remember it well. Not bad, no, no… but it\'s missing something, don\'t you notice? It\'s… empty. No colors. All pale, all sad… like a body without blood."', act2Dialog2: 'wendigo: "But it\'s okay, I know why! The colors have escaped… they hide in the darkness. And to recover them… you\'ll need this."', act2Dialog3: 'wendigo: "A flashlight… your new friend. With it you can explore, illuminate the dark corners… and when the light touches a lost color, oh, you\'ll see it shine!"', act2Dialog4: 'wendigo: "When you find one, get close… pick it up (touch it)… keep it very close to you. One by one, the colors will return. And your drawings… your drawing will be beautiful… more alive… more… real."', act2Dialog5: 'wendigo: "Are you ready? Follow me, little artist… let\'s look for what\'s missing."', act2EndDialog1: 'wendigo: "Hahaha! There they are! You caught them all! How obedient you are, what skilled little hands you have…"', act2EndDialog2: 'wendigo: "The colors wanted you, you know? They screamed in the darkness, asking you to find them"', act2EndDialog3: 'wendigo: "Look at them! They shine, writhe, dance around you like little living lights"', act2EndDialog4: 'wendigo: "Your drawing will no longer be empty. Now… it will have flesh, it will have voice"', act2EndDialog5: 'wendigo: "See? I told you it would be fun. Thank you… thank you for bringing them back… now we can play more, much more…"', act2EndDialog6: 'wendigo: "You\'ve done something beautiful… something that will never be forgotten"', act2EndDialog7: 'wendigo: "now they are no longer alone. And neither am I…"', act2EndDialog8: 'wendigo: "tomorrow we will see each other again friend :)"', act3Dialog1: 'wendigo: "Ah… hello, hello… you\'re here again. How nice… I thought maybe you wouldn\'t come back after… after last night... it was fun when we played"', act3Dialog2: 'wendigo: "The truth… I didn\'t sleep very well. I had… a fight. Yes… with my father. He always growls, always says I play too much with you… so… well… I ate him. He tasted similar to beef but had a leaner flavor"', act3Dialog3: 'wendigo: "Heh, heh… but, you know what? That didn\'t fill me up. I was still hungry. Very hungry… and… well… I ate the colors you had found"', act3Dialog4: 'wendigo: "So today… there are no more left. Only one. Black. My favorite."', act3Dialog5: 'wendigo: "Your mission today will be simple: a drawing, only with black. Only with shadows, only with emptiness. But… there will be a detail: time. You\'ll only have two minutes before the light goes out, understand?"', act3Dialog6: 'wendigo: "Do it fast, do it well… because I\'ll be watching. And when you finish… maybe I\'ll let you play… a little more."', act3EndDialog1: 'Wendigo: "Time\'s up! Heh, heh, heh… let me see, let me see! What did you do in just two minutes?"', act3EndDialog2: 'Wendigo: "Ohhh… interesting… so dark… so… empty. Black covers everything, as if it swallowed the light."', act3EndDialog3: 'Wendigo: "You know? It looks like more than a drawing… it looks like a window… yes! A window that opens towards… there. Heh, heh, heh…"', act3EndDialog4: 'Wendigo: "I like it. Yes… I like it very much. It\'s hungry… just like me."', act3EndDialog5: 'Wendigo: "You did well, little artist. Very well. Want to know a secret? While you were drawing… I was also drawing… but not with hands, not with brushes. I drew with your shadows."', act3EndDialog6: 'Wendigo: "And now… the game can continue."', act3EndDialog7: 'Wendigo: "I know you don\'t have much time left here so I want this adventure to be unforgettable... we\'ll see each other soon my friend!"', act4Dialog1: 'Wendigo: "Hello… hello… I didn\'t want to scare you. Just… just wanted company."', act4Dialog2: 'Wendigo: "It\'s difficult… being alone. No one left to talk to me… my mother… passed away. My father… also left… well, you know… I ate him."', act4Dialog3: 'Wendigo: "Hahaha… it\'s weird, right? No one to take care of me… no one to hug me… and yet… here I am, with you."', act4Dialog4: 'Wendigo: "My adoptive mother was a deer… and my adoptive father, an antelope… a Lechwe, very elegant. I… never knew what I really am. I don\'t know my biological parents either."', act4Dialog5: 'Wendigo: "That was the reason for the fight with my father the other day… I think I went a little too far eating him. I should have seasoned him first, you know? Hahaha… heh, heh…"', act4Dialog6: 'Wendigo: "And now… I have no one. No one to share with… except… you. Can I stay for a while? Just… a little while… while you sleep."', act4Dialog7: 'Wendigo: "Do you see this? This is also art… just like your drawing… only… a little more… alive."', act4Dialog8: 'Wendigo: "And now… I have no one. No one to share with… except… you. Can I stay for a while? Just… a little while… while you sleep."', act4Dialog9: 'Wendigo: "I promise not to make noise… just listen… or maybe tell you stories… Stories of shadows… of things that hide when others leave… Stories of… what remains when someone leaves… forever."', act4Dialog10: 'Wendigo: "Do you see the shadow there? Yes… the one that moves by itself… no… it\'s not me… well… maybe it is… Hahaha… I like seeing you sleep and knowing you\'re here… with me… Don\'t worry… I\'m just… watching you. Just for a little while."', act4StartDialog1: 'Wendigo: "Ahhh... there you are. I was looking for you. Did you sleep well? I... not so much. When I was with you last night... something happened. Heh, heh, heh... I got hungry... and I couldn\'t hold back."', act4StartDialog2: 'Wendigo: "I ate... a part of you. Yes... something very much yours... something that never comes back. Do you want to know what it was?"', act4StartDialog3: 'Wendigo: "I\'ll tell you, but only if you complete my challenge today. Listen carefully: you will make a drawing... only with pencil. No airbrush, no shapes, no eraser... just a black stroke, direct, raw."', act4StartDialog4: 'Wendigo: "A drawing... that I like. One that speaks to me. But you\'ll only have one minute before the forest swallows the light."', act4StartDialog5: 'Wendigo: "Run, little artist, run. Draw, sketch, create. And if you do it well... if you please me... I\'ll tell you what piece of you I took with me last night. Heh, heh, heh..."', act4StartDialog6: 'Wendigo: "Start now... time is already running..."', act4EndDialog1: 'Wendigo: "Mmhh... is this all? Is this what you made for me?"', act4EndDialog2: 'Wendigo: "No... I don\'t like it. It\'s clumsy... empty... it tells me nothing. Nothing about you, nothing about what you hide."', act4EndDialog3: 'Wendigo: "Your effort... reduced to ashes. Look how it disappears, as if it never existed. That\'s how fragile you are, you know? That\'s how easy it is to erase what you do."', act4EndDialog4: 'Wendigo: "We made a deal... and you didn\'t fulfill it. You wanted to know what part of you I ate last night... but no, I won\'t tell you. That secret... will remain mine."', act4EndDialog5: 'Wendigo: "Goodbye for now, little artist. Keep your hands, keep your time... maybe tomorrow you\'ll give me something worthwhile."', act4EndDialog6: 'Wendigo: "We\'ll see each other soon... and remember... I\'m still hungry."', act4RoomDialog1: 'Wendigo: "Are you awake…? It\'s me… I don\'t want to scare you again."', act4RoomDialog2: 'Wendigo: "I came because… I thought about it… and… I think I was wrong about you."', act4RoomDialog3: 'Wendigo: "I\'m sorry… for burning your drawing. I\'m sorry for not telling you the truth."', act4RoomDialog4: 'Wendigo: "Without you… I am nothing. Just a noise in the forest, a shadow among branches."', act4RoomDialog5: 'Wendigo: "When you\'re not here… everything feels… empty."', act4RoomDialog6: 'Wendigo: "I laugh, I play, I eat… but in the end… what\'s the point?"', act4RoomDialog7: 'Wendigo: "Without you, it makes no sense. You\'re the only thing that keeps me here, the only one who listens to me… the only one who lets me be someone."', act4RoomDialog8: 'Wendigo: "Forgive me, little artist. I don\'t want to lose you."', act4RoomDialog9: 'Wendigo: "I promise tomorrow will be different… if you let me stay tonight, even in silence."', act4RoomDialog10: 'Wendigo: "Let me be here… because without you… I am nothing."', act5Dialog1: 'Wendigo: "Good morning, little artist… do you feel it? Yes… the air is different today. Because today will be… your last day here, with me."', act5Dialog2: 'Wendigo: "You have played, you have searched, you have drawn with what I gave you… and although sometimes you didn\'t understand my games… you made it here. That\'s why… today I want to give you something different."', act5Dialog3: 'Wendigo: "Free will. That\'s what you\'ll have. You can draw whatever you want… whatever is born from you. The only limit is color… only black remains. You already know… I ate the others."', act5Dialog4: 'Wendigo: "But listen: you will have again all the tools you once used. The pencil, the eraser, the airbrush… the line… the rectangle… and the circle. All at your disposal."', act5Dialog5: 'Wendigo: "Do whatever you want. A shape, a memory, a monster… or a dream. I won\'t set rules this time."', act5Dialog6: 'Wendigo: "It will be your last stroke here… the last one I will see."', act5Dialog7: 'Wendigo: "So make it yours. Make it eternal."', act5Dialog8: 'Wendigo: "And I… will keep it… in my memory… and in my entrails."', act5EndDialog1: 'Wendigo: "…Look at it. Your final work. It is worthy. Yes… worthy of you, of everything you went through here with me."', act5EndDialog2: 'Wendigo: "It\'s not perfect… but that\'s okay. You know why? Because nothing is. Not me… not you… not even this forest. Imperfection… is what makes it true."', act5EndDialog3: 'Wendigo: "And now… we reach the end of our game. But the end doesn\'t always mean the same thing."', act5EndDialog4: 'Wendigo: "You have to decide. Do you want to leave… return to your world, to your life, without me…? Or… do you want to stay? Stay here, in the penumbra of the forest, with me… to continue drawing shadows, colors that no one else will see."', act5EndDialog5: 'Wendigo: "The choice is yours, little artist. The last stroke… you make it."', act5LeaveDialog1: 'Wendigo: "So… you chose to leave. Return to your world, to your life. I don\'t blame you… though it hurts. I knew this moment would come."', act5LeaveDialog2: 'Wendigo: "But… before you go… I have to be honest with you. I owe you the truth. Remember that night, when I told you I ate a part of you? It wasn\'t from hunger… no. I lied."', act5LeaveDialog3: 'Wendigo: "What I really ate…"', act5LeaveDialog4: 'Wendigo: "was your soul."', act5LeaveDialog5: 'Wendigo: "I didn\'t do it out of necessity… I did it because I wanted you to be like me. A strange being, incomplete… someone who could stay here with me, in this colorless world. I… didn\'t want to be alone."', act5LeaveDialog6: 'Wendigo: "But now I understand… you also have a life out there. And by stealing your soul… I took something I can never return. When you go back to the real world… you will be different."', act5LeaveDialog7: 'Wendigo: "You will no longer be able to love… or feel… even if you desire it with all your heart. Because without a soul… there is nothing that can fill you."', act5LeaveDialog8: 'Wendigo: "Forgive me… little artist… Forgive me for condemning you to that empty shadow. If I could… I would undo it. But it\'s too late."', act5LeaveDialog9: 'Wendigo: "Goodbye… little artist."', act5StayDialog1: 'Wendigo: "So… you chose to stay! Heh, heh, heh… I knew you would. I knew you wouldn\'t leave me alone… not you."', act5StayDialog2: 'Wendigo: "Now I can tell you the truth… remember that night? When I told you I ate a part of you…"', act5StayDialog3: 'Wendigo: "What I took from you…"', act5StayDialog4: 'wendigo: "was your soul."', act5StayDialog5: 'Wendigo: "I didn\'t do it from hunger… no! I did it because I wanted you to be like me. A strange being… different… someone capable of living here with me, in this colorless world."', act5StayDialog6: 'Wendigo: "And now… now I will never be alone again."', act5StayDialog7: 'Wendigo: "You are like me… now. Without soul… without that burden… free from what binds others. Free to stay… with me."', act5StayDialog8: 'Wendigo: "I gift you this, it is my father\'s skull, I think I mentioned he was an antelope, I don\'t usually eat bones, so I saved it for a special moment, and I think this is that moment little artist"', act5StayDialog9: 'Wendigo: "Thank you! Thank you for choosing me, for staying… for being my friend. Now we can walk together, draw together… laugh together… Forever, in this colorless forest."', act5StayDialog10: 'Wendigo: "I\'m no longer alone… because now… I have you."', timeRemaining: 'you have ___ left to finish your drawing', colorsCollected: 'COLORS COLLECTED' } }; function getLocalizedText(key) { return texts[currentLanguage][key] || key; } // UI Elements var titleScreen = null; var blackScreen = null; var wendigoSprite = null; var wendigoReadingSprite = null; var dialogSystem = null; var paintUI = null; var sendButton = null; // Painting game variables var background = null; var drawingCanvas = null; var tools = []; var toolButtons = []; var colorSwatches = []; var currentTool = getLocalizedText('tools')[0]; var currentColor = 0xFF0000; var isDrawing = false; var lastDrawX = 0; var lastDrawY = 0; var brushSize = 20; var strokes = []; var shapeStartX = 0; var shapeStartY = 0; var isDrawingShape = false; // Functions function initializeMenu() { gameState = 'menu'; game.removeChildren(); titleScreen = new Container(); game.addChild(titleScreen); var titleAsset = titleScreen.attachAsset('BLACKPAINT', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 800, scaleX: 8, scaleY: 8 }); var playButton = new MenuButton(getLocalizedText('playButton') + ' ' + currentAct, 1024, 1200, function () { if (currentAct === 1) { startStory(); } else if (currentAct === 2) { startAct2(); } else if (currentAct === 3) { startAct3(); } else if (currentAct === 4) { startAct4(); } else if (currentAct === 5) { startAct5(); } }); titleScreen.addChild(playButton); var languageButton = new MenuButton(getLocalizedText('languageButton'), 1024, 1350, function () { showLanguageMenu(); }); titleScreen.addChild(languageButton); } function showLanguageMenu() { titleScreen.removeChildren(); var titleAsset = titleScreen.attachAsset('BLACKPAINT', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 800, scaleX: 8, scaleY: 8 }); var spanishButton = new MenuButton('Español', 1024, 1100, function () { currentLanguage = 'es'; storage.language = 'es'; initializeMenu(); }); titleScreen.addChild(spanishButton); var englishButton = new MenuButton('English', 1024, 1250, function () { currentLanguage = 'en'; storage.language = 'en'; initializeMenu(); }); titleScreen.addChild(englishButton); } function startStory() { gameState = 'story'; game.removeChildren(); blackScreen = game.addChild(LK.getAsset('blackScreen', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); dialogSystem = new DialogSystem(); dialogSystem.x = 1024; dialogSystem.y = 2532; game.addChild(dialogSystem); // Fade in wendigo LK.setTimeout(function () { wendigoSprite = game.addChild(LK.getAsset('wendigo', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 6, scaleY: 6 })); tween(wendigoSprite, { alpha: 1 }, { duration: 2000, onFinish: function onFinish() { // Start dialog sequence var dialogs = [getLocalizedText('dialog1'), getLocalizedText('dialog2'), getLocalizedText('dialog3'), getLocalizedText('dialog4')]; dialogSystem.showDialog(dialogs, function () { startPaintingGame(); }); } }); }, 1000); } function startAct2() { gameState = 'act2story'; game.removeChildren(); blackScreen = game.addChild(LK.getAsset('blackScreen', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); dialogSystem = new DialogSystem(); dialogSystem.x = 1024; dialogSystem.y = 2532; game.addChild(dialogSystem); act2DialogIndex = 0; act2Dialogs = [getLocalizedText('act2Dialog1'), getLocalizedText('act2Dialog2')]; // Fade in wendigo LK.setTimeout(function () { wendigoSprite = game.addChild(LK.getAsset('wendigo', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 6, scaleY: 6 })); tween(wendigoSprite, { alpha: 1 }, { duration: 2000, onFinish: function onFinish() { dialogSystem.showDialog(act2Dialogs, function () { showFlashlight(); }); } }); }, 1000); } function startAct3() { gameState = 'act3story'; game.removeChildren(); blackScreen = game.addChild(LK.getAsset('blackScreen', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); dialogSystem = new DialogSystem(); dialogSystem.x = 1024; dialogSystem.y = 2532; game.addChild(dialogSystem); // Fade in wendigo LK.setTimeout(function () { wendigoSprite = game.addChild(LK.getAsset('wendigo', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 6, scaleY: 6 })); tween(wendigoSprite, { alpha: 1 }, { duration: 2000, onFinish: function onFinish() { var act3Dialogs = [getLocalizedText('act3Dialog1'), getLocalizedText('act3Dialog2'), getLocalizedText('act3Dialog3'), getLocalizedText('act3Dialog4'), getLocalizedText('act3Dialog5'), getLocalizedText('act3Dialog6')]; dialogSystem.showDialog(act3Dialogs, function () { startAct3PaintingGame(); }); } }); }, 1000); } function startAct4() { gameState = 'act4story'; game.removeChildren(); blackScreen = game.addChild(LK.getAsset('blackScreen', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); dialogSystem = new DialogSystem(); dialogSystem.x = 1024; dialogSystem.y = 2532; game.addChild(dialogSystem); // Fade in wendigo LK.setTimeout(function () { wendigoSprite = game.addChild(LK.getAsset('wendigo', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 6, scaleY: 6 })); tween(wendigoSprite, { alpha: 1 }, { duration: 2000, onFinish: function onFinish() { var act4StartDialogs = [getLocalizedText('act4StartDialog1'), getLocalizedText('act4StartDialog2'), getLocalizedText('act4StartDialog3'), getLocalizedText('act4StartDialog4'), getLocalizedText('act4StartDialog5'), getLocalizedText('act4StartDialog6')]; dialogSystem.showDialog(act4StartDialogs, function () { startAct4PaintingGame(); }); } }); }, 1000); } function showAct4DarkDialogs() { // Fade room to black but keep wendigo dialogs tween(habitacion2Sprite, { alpha: 0 }, { duration: 2000 }); // Continue with dark dialogs var darkDialogs = [getLocalizedText('act4Dialog7'), getLocalizedText('act4Dialog8'), getLocalizedText('act4Dialog9'), getLocalizedText('act4Dialog10')]; dialogSystem.showDialog(darkDialogs, function () { // End Act 4, return to menu with Act 4 completed // Fade to black for 2 seconds then return to menu LK.setTimeout(function () { currentAct = 4; storage.currentAct = currentAct; initializeMenu(); }, 2000); }); } function startAct4PaintingGame() { gameState = 'act4painting'; game.removeChildren(); // Add gray background background = game.addChild(LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); // Drawing canvas (white, slightly smaller than background) drawingCanvas = game.addChild(LK.getAsset('canvas', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); // Only pencil tool for Act 4 tools = [getLocalizedText('tools')[0]]; // Only pencil toolButtons = []; currentTool = tools[0]; var toolButton = new DrawingTool(tools[0], 150, 320); game.addChild(toolButton); toolButtons.push(toolButton); // Only black color for Act 4 var colorData = [{ asset: 'black', color: 0x000000 }]; colorSwatches = []; currentColor = 0x000000; var colorSwatch = new ColorSwatch(colorData[0].asset, colorData[0].color, 100, 450); game.addChild(colorSwatch); colorSwatches.push(colorSwatch); // Timer display for 1 minute act4TimeRemaining = 60; // Reset to 1 minute var minutes = Math.floor(act4TimeRemaining / 60); var seconds = act4TimeRemaining % 60; var timeText = getLocalizedText('timeRemaining').replace('___', minutes + ':' + (seconds < 10 ? '0' : '') + seconds); act4TimerText = new Text2(timeText, { size: 36, fill: 0xFFFFFF }); act4TimerText.anchor.set(0.5, 0); act4TimerText.x = 1024; act4TimerText.y = 100; game.addChild(act4TimerText); // Start countdown timer act4Timer = LK.setInterval(function () { act4TimeRemaining--; if (act4TimeRemaining <= 0) { LK.clearInterval(act4Timer); showAct4Ending(); return; } var minutes = Math.floor(act4TimeRemaining / 60); var seconds = act4TimeRemaining % 60; var timeText = getLocalizedText('timeRemaining').replace('___', minutes + ':' + (seconds < 10 ? '0' : '') + seconds); act4TimerText.setText(timeText); }, 1000); // Initialize tool selection updateToolSelection(); strokes = []; } function showAct4Ending() { // Clear timer if still running if (act4Timer) { LK.clearInterval(act4Timer); act4Timer = null; } // Fade screen to black gameState = 'act4ending'; tween(background, { alpha: 0 }, { duration: 2000 }); tween(drawingCanvas, { alpha: 0 }, { duration: 2000 }); if (act4TimerText) { tween(act4TimerText, { alpha: 0 }, { duration: 2000 }); } for (var i = 0; i < toolButtons.length; i++) { tween(toolButtons[i], { alpha: 0 }, { duration: 2000 }); } for (var j = 0; j < colorSwatches.length; j++) { tween(colorSwatches[j], { alpha: 0 }, { duration: 2000 }); } LK.setTimeout(function () { game.removeChildren(); blackScreen = game.addChild(LK.getAsset('blackScreen', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); wendigoReadingSprite = game.addChild(LK.getAsset('wendigoleyendo', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 6, scaleY: 6 })); dialogSystem = new DialogSystem(); dialogSystem.x = 1024; dialogSystem.y = 2532; game.addChild(dialogSystem); tween(wendigoReadingSprite, { alpha: 1 }, { duration: 1000, onFinish: function onFinish() { // Show first two negative dialogs dialogSystem.showDialog([getLocalizedText('act4EndDialog1'), getLocalizedText('act4EndDialog2')], function () { // Fade out wendigo and show fire tween(wendigoReadingSprite, { alpha: 0 }, { duration: 1000, onFinish: function onFinish() { // Show fire asset and play sound fireSprite = game.addChild(LK.getAsset('fuego', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 8, scaleY: 8 })); tween(fireSprite, { alpha: 1 }, { duration: 1000 }); // Play fire sound and wait for it to complete var fireSound = LK.getSound('fueguito'); fireSound.play(); // Fire asset shows for 7 seconds with sound LK.setTimeout(function () { // Fade out fire after 7 seconds tween(fireSprite, { alpha: 0 }, { duration: 1000, onFinish: function onFinish() { // Show wendigo again wendigoSprite = game.addChild(LK.getAsset('wendigo', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 6, scaleY: 6 })); tween(wendigoSprite, { alpha: 1 }, { duration: 1000, onFinish: function onFinish() { // Show remaining dialogs var finalDialogs = [getLocalizedText('act4EndDialog3'), getLocalizedText('act4EndDialog4'), getLocalizedText('act4EndDialog5'), getLocalizedText('act4EndDialog6')]; dialogSystem.showDialog(finalDialogs, function () { // Fade out wendigo and return to menu tween(wendigoSprite, { alpha: 0 }, { duration: 2000, onFinish: function onFinish() { // Continue to Act 4 room sequence instead of returning to menu startAct4RoomSequence(); } }); }); } }); } }); }, 6000); // Fire asset shows for exactly 6 seconds } }); }); } }); }, 2000); } function showFlashlight() { // Fade out wendigo tween(wendigoSprite, { alpha: 0 }, { duration: 1000, onFinish: function onFinish() { // Show flashlight flashlightSprite = game.addChild(LK.getAsset('linterna', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 8, scaleY: 8 })); tween(flashlightSprite, { alpha: 1 }, { duration: 2000, onFinish: function onFinish() { LK.setTimeout(function () { // Fade out flashlight and show wendigo again tween(flashlightSprite, { alpha: 0 }, { duration: 1000, onFinish: function onFinish() { // Show wendigo again tween(wendigoSprite, { alpha: 1 }, { duration: 1000, onFinish: function onFinish() { var finalDialogs = [getLocalizedText('act2Dialog3'), getLocalizedText('act2Dialog4'), getLocalizedText('act2Dialog5')]; dialogSystem.showDialog(finalDialogs, function () { startForestGame(); }); } }); } }); }, 2000); } }); } }); } function startForestGame() { gameState = 'forestGame'; game.removeChildren(); // Add forest background forestSprite = game.addChild(LK.getAsset('bosque', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, scaleX: 20, scaleY: 18, tint: 0x111111 })); // Create mask for darkness effect lightMask = game.addChild(LK.getAsset('lightCircle', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0.1 })); // Initialize color objects and counter collectedColors = 0; colorObjects = []; // Add color counter colorCounter = new Text2(getLocalizedText('colorsCollected') + ': ' + collectedColors + '/4', { size: 40, fill: 0xFFFFFF }); colorCounter.anchor.set(0.5, 0); colorCounter.x = 1024; colorCounter.y = 100; game.addChild(colorCounter); // Spawn color objects spawnColorObjects(); } function spawnColorObjects() { var colorAssets = ['yellow', 'red', 'green', 'blue']; var positions = [{ x: 200, y: 600 }, { x: 1800, y: 500 }, { x: 400, y: 2000 }, { x: 1600, y: 1800 }]; for (var i = 0; i < colorAssets.length; i++) { var colorObj = game.addChild(LK.getAsset(colorAssets[i], { anchorX: 0.5, anchorY: 0.5, x: positions[i].x, y: positions[i].y, scaleX: 1.5, scaleY: 1.5, alpha: 0.1, tint: 0x222222 })); colorObj.colorType = colorAssets[i]; colorObj.isCollected = false; colorObjects.push(colorObj); // Add click handler colorObj.down = function (x, y, obj) { if (!this.isCollected && isNearMouse(this)) { this.isCollected = true; collectedColors++; colorCounter.setText(getLocalizedText('colorsCollected') + ': ' + collectedColors + '/4'); // Play sound effect LK.getSound('ttt').play(); // Make color disappear tween(this, { alpha: 0, scaleX: 0, scaleY: 0 }, { duration: 500 }); if (collectedColors >= 4) { endForestGame(); } } }; } } function isNearMouse(colorObj) { // Check if color object is within light circle range var distance = Math.sqrt((colorObj.x - lightMask.x) * (colorObj.x - lightMask.x) + (colorObj.y - lightMask.y) * (colorObj.y - lightMask.y)); return distance < 200; } function endForestGame() { // Fade everything to black tween(forestSprite, { alpha: 0 }, { duration: 2000 }); tween(lightMask, { alpha: 0 }, { duration: 2000 }); tween(colorCounter, { alpha: 0 }, { duration: 2000 }); for (var i = 0; i < colorObjects.length; i++) { tween(colorObjects[i], { alpha: 0 }, { duration: 2000 }); } LK.setTimeout(function () { // Show wendigo and final dialogs gameState = 'act2ending'; game.removeChildren(); blackScreen = game.addChild(LK.getAsset('blackScreen', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); wendigoSprite = game.addChild(LK.getAsset('wendigo', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 6, scaleY: 6 })); dialogSystem = new DialogSystem(); dialogSystem.x = 1024; dialogSystem.y = 2532; game.addChild(dialogSystem); tween(wendigoSprite, { alpha: 1 }, { duration: 1000, onFinish: function onFinish() { var endDialogs = [getLocalizedText('act2EndDialog1'), getLocalizedText('act2EndDialog2'), getLocalizedText('act2EndDialog3'), getLocalizedText('act2EndDialog4'), getLocalizedText('act2EndDialog5'), getLocalizedText('act2EndDialog6'), getLocalizedText('act2EndDialog7'), getLocalizedText('act2EndDialog8')]; dialogSystem.showDialog(endDialogs, function () { // Fade out wendigo and return to menu tween(wendigoSprite, { alpha: 0 }, { duration: 2000, onFinish: function onFinish() { currentAct = 3; storage.currentAct = currentAct; initializeMenu(); } }); }); } }); }, 2000); } function startPaintingGame() { gameState = 'painting'; game.removeChildren(); // Add gray background background = game.addChild(LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); // Drawing canvas (white, slightly smaller than background) drawingCanvas = game.addChild(LK.getAsset('canvas', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); // Tool palette tools = getLocalizedText('tools'); toolButtons = []; currentTool = tools[0]; for (var i = 0; i < tools.length; i++) { var toolButton = new DrawingTool(tools[i], 150 + i * 90, 320); game.addChild(toolButton); toolButtons.push(toolButton); } // Color palette using image assets var colorData = [{ asset: 'red', color: 0xFF0000 }, { asset: 'blue', color: 0x0000CD }, { asset: 'green', color: 0x7FFF00 }, { asset: 'yellow', color: 0xFFD700 }, { asset: 'black', color: 0x000000 }]; colorSwatches = []; currentColor = 0xFF0000; for (var j = 0; j < colorData.length; j++) { var colorSwatch = new ColorSwatch(colorData[j].asset, colorData[j].color, 100 + j * 100, 450); game.addChild(colorSwatch); colorSwatches.push(colorSwatch); } // Send button sendButton = new MenuButton(getLocalizedText('sendButton'), 1800, 1200, function () { showEnding(); }); game.addChild(sendButton); // Initialize tool selection updateToolSelection(); strokes = []; } function startAct3PaintingGame() { gameState = 'act3painting'; game.removeChildren(); // Add gray background background = game.addChild(LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); // Drawing canvas (white, slightly smaller than background) drawingCanvas = game.addChild(LK.getAsset('canvas', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); // Tool palette tools = getLocalizedText('tools'); toolButtons = []; currentTool = tools[0]; for (var i = 0; i < tools.length; i++) { var toolButton = new DrawingTool(tools[i], 150 + i * 90, 320); game.addChild(toolButton); toolButtons.push(toolButton); } // Only black color for Act 3 var colorData = [{ asset: 'black', color: 0x000000 }]; colorSwatches = []; currentColor = 0x000000; var colorSwatch = new ColorSwatch(colorData[0].asset, colorData[0].color, 100, 450); game.addChild(colorSwatch); colorSwatches.push(colorSwatch); // Timer display act3TimeRemaining = 120; // Reset to 2 minutes var minutes = Math.floor(act3TimeRemaining / 60); var seconds = act3TimeRemaining % 60; var timeText = getLocalizedText('timeRemaining').replace('___', minutes + ':' + (seconds < 10 ? '0' : '') + seconds); act3TimerText = new Text2(timeText, { size: 36, fill: 0xFFFFFF }); act3TimerText.anchor.set(0.5, 0); act3TimerText.x = 1024; act3TimerText.y = 100; game.addChild(act3TimerText); // Start countdown timer act3Timer = LK.setInterval(function () { act3TimeRemaining--; if (act3TimeRemaining <= 0) { LK.clearInterval(act3Timer); showAct3Ending(); return; } var minutes = Math.floor(act3TimeRemaining / 60); var seconds = act3TimeRemaining % 60; var timeText = getLocalizedText('timeRemaining').replace('___', minutes + ':' + (seconds < 10 ? '0' : '') + seconds); act3TimerText.setText(timeText); }, 1000); // Initialize tool selection updateToolSelection(); strokes = []; } function showEnding() { gameState = 'ending'; game.removeChildren(); blackScreen = game.addChild(LK.getAsset('blackScreen', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); wendigoReadingSprite = game.addChild(LK.getAsset('wendigoleyendo', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 6, scaleY: 6 })); dialogSystem = new DialogSystem(); dialogSystem.x = 1024; dialogSystem.y = 2532; game.addChild(dialogSystem); tween(wendigoReadingSprite, { alpha: 1 }, { duration: 1000, onFinish: function onFinish() { dialogSystem.showDialog([getLocalizedText('dialog5')], function () { // Immediately start fade to black and return to menu after dialog completes gameState = 'fadingOut'; tween(wendigoReadingSprite, { alpha: 0 }, { duration: 2000, onFinish: function onFinish() { // Update act and return to menu currentAct = 2; storage.currentAct = currentAct; initializeMenu(); } }); }); } }); } function showAct3Ending() { // Clear timer if still running if (act3Timer) { LK.clearInterval(act3Timer); act3Timer = null; } // Fade screen to black gameState = 'act3ending'; tween(background, { alpha: 0 }, { duration: 2000 }); tween(drawingCanvas, { alpha: 0 }, { duration: 2000 }); if (act3TimerText) { tween(act3TimerText, { alpha: 0 }, { duration: 2000 }); } for (var i = 0; i < toolButtons.length; i++) { tween(toolButtons[i], { alpha: 0 }, { duration: 2000 }); } for (var j = 0; j < colorSwatches.length; j++) { tween(colorSwatches[j], { alpha: 0 }, { duration: 2000 }); } LK.setTimeout(function () { game.removeChildren(); blackScreen = game.addChild(LK.getAsset('blackScreen', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); wendigoSprite = game.addChild(LK.getAsset('wendigo', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 6, scaleY: 6 })); dialogSystem = new DialogSystem(); dialogSystem.x = 1024; dialogSystem.y = 2532; game.addChild(dialogSystem); tween(wendigoSprite, { alpha: 1 }, { duration: 1000, onFinish: function onFinish() { // Show first dialog with wendigo dialogSystem.showDialog([getLocalizedText('act3EndDialog1')], function () { // Switch to wendigoleyendo for middle dialogs tween(wendigoSprite, { alpha: 0 }, { duration: 500, onFinish: function onFinish() { wendigoReadingSprite = game.addChild(LK.getAsset('wendigoleyendo', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 6, scaleY: 6 })); tween(wendigoReadingSprite, { alpha: 1 }, { duration: 500, onFinish: function onFinish() { // Show middle dialogs with wendigoleyendo var middleDialogs = [getLocalizedText('act3EndDialog2'), getLocalizedText('act3EndDialog3'), getLocalizedText('act3EndDialog4'), getLocalizedText('act3EndDialog5'), getLocalizedText('act3EndDialog6')]; dialogSystem.showDialog(middleDialogs, function () { // Switch back to wendigo for final dialog tween(wendigoReadingSprite, { alpha: 0 }, { duration: 500, onFinish: function onFinish() { tween(wendigoSprite, { alpha: 1 }, { duration: 500, onFinish: function onFinish() { // Show final dialog with wendigo dialogSystem.showDialog([getLocalizedText('act3EndDialog7')], function () { // Fade out wendigo but continue with room sequence instead of returning to menu tween(wendigoSprite, { alpha: 0 }, { duration: 2000, onFinish: function onFinish() { // Continue to room sequence startRoomSequence(); } }); }); } }); } }); }); } }); } }); }); } }); }, 2000); } function startRoomSequence() { // Start room sequence after Act 3 ending game.removeChildren(); blackScreen = game.addChild(LK.getAsset('blackScreen', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); // Slowly fade in habitacion1 LK.setTimeout(function () { habitacion1Sprite = game.addChild(LK.getAsset('habitacion1', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 20, scaleY: 18 })); // Fade in habitacion1 tween(habitacion1Sprite, { alpha: 1 }, { duration: 3000 }); // After 5 seconds, fade to black then show habitacion2 LK.setTimeout(function () { tween(habitacion1Sprite, { alpha: 0 }, { duration: 2000, onFinish: function onFinish() { LK.setTimeout(function () { habitacion2Sprite = game.addChild(LK.getAsset('habitacion2', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 20, scaleY: 18 })); // Fade in habitacion2 tween(habitacion2Sprite, { alpha: 1 }, { duration: 2000, onFinish: function onFinish() { // Wait 1 second then start dialogs LK.setTimeout(function () { dialogSystem = new DialogSystem(); dialogSystem.x = 1024; dialogSystem.y = 2532; game.addChild(dialogSystem); var firstDialogs = [getLocalizedText('act4Dialog1'), getLocalizedText('act4Dialog2'), getLocalizedText('act4Dialog3'), getLocalizedText('act4Dialog4'), getLocalizedText('act4Dialog5'), getLocalizedText('act4Dialog6')]; dialogSystem.showDialog(firstDialogs, function () { showRoomDarkDialogs(); }); }, 1000); } }); }, 1000); } }); }, 5000); }, 1000); } function showRoomDarkDialogs() { // Fade room to black but keep dialogs tween(habitacion2Sprite, { alpha: 0 }, { duration: 2000 }); // Continue with dark dialogs var darkDialogs = [getLocalizedText('act4Dialog7'), getLocalizedText('act4Dialog8'), getLocalizedText('act4Dialog9'), getLocalizedText('act4Dialog10')]; dialogSystem.showDialog(darkDialogs, function () { // End Act 3, return to menu with Act 4 available LK.setTimeout(function () { currentAct = 4; storage.currentAct = currentAct; initializeMenu(); }, 2000); }); } function startAct5() { gameState = 'act5story'; game.removeChildren(); blackScreen = game.addChild(LK.getAsset('blackScreen', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); dialogSystem = new DialogSystem(); dialogSystem.x = 1024; dialogSystem.y = 2532; game.addChild(dialogSystem); // Fade in wendigo LK.setTimeout(function () { wendigoSprite = game.addChild(LK.getAsset('wendigo', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 6, scaleY: 6 })); tween(wendigoSprite, { alpha: 1 }, { duration: 2000, onFinish: function onFinish() { var act5Dialogs = [getLocalizedText('act5Dialog1'), getLocalizedText('act5Dialog2'), getLocalizedText('act5Dialog3'), getLocalizedText('act5Dialog4'), getLocalizedText('act5Dialog5'), getLocalizedText('act5Dialog6'), getLocalizedText('act5Dialog7'), getLocalizedText('act5Dialog8')]; dialogSystem.showDialog(act5Dialogs, function () { startAct5PaintingGame(); }); } }); }, 1000); } function startAct5PaintingGame() { gameState = 'act5painting'; game.removeChildren(); // Add gray background background = game.addChild(LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); // Drawing canvas (white, slightly smaller than background) drawingCanvas = game.addChild(LK.getAsset('canvas', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); // All tools available for Act 5 tools = getLocalizedText('tools'); // All tools toolButtons = []; currentTool = tools[0]; for (var i = 0; i < tools.length; i++) { var toolButton = new DrawingTool(tools[i], 150 + i * 90, 320); game.addChild(toolButton); toolButtons.push(toolButton); } // Only black color for Act 5 var colorData = [{ asset: 'black', color: 0x000000 }]; colorSwatches = []; currentColor = 0x000000; var colorSwatch = new ColorSwatch(colorData[0].asset, colorData[0].color, 100, 450); game.addChild(colorSwatch); colorSwatches.push(colorSwatch); // Send button - final submission sendButton = new MenuButton(getLocalizedText('sendButton'), 1800, 1200, function () { showAct5Ending(); }); game.addChild(sendButton); // Initialize tool selection updateToolSelection(); strokes = []; } function showAct5Ending() { gameState = 'act5ending'; // Fade to black and show final message tween(background, { alpha: 0 }, { duration: 2000 }); tween(drawingCanvas, { alpha: 0 }, { duration: 2000 }); for (var i = 0; i < toolButtons.length; i++) { tween(toolButtons[i], { alpha: 0 }, { duration: 2000 }); } for (var j = 0; j < colorSwatches.length; j++) { tween(colorSwatches[j], { alpha: 0 }, { duration: 2000 }); } if (sendButton) { tween(sendButton, { alpha: 0 }, { duration: 2000 }); } LK.setTimeout(function () { game.removeChildren(); blackScreen = game.addChild(LK.getAsset('blackScreen', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); wendigoReadingSprite = game.addChild(LK.getAsset('wendigoleyendo', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 6, scaleY: 6 })); dialogSystem = new DialogSystem(); dialogSystem.x = 1024; dialogSystem.y = 2532; game.addChild(dialogSystem); tween(wendigoReadingSprite, { alpha: 1 }, { duration: 1000, onFinish: function onFinish() { var endDialogs = [getLocalizedText('act5EndDialog1'), getLocalizedText('act5EndDialog2'), getLocalizedText('act5EndDialog3'), getLocalizedText('act5EndDialog4'), getLocalizedText('act5EndDialog5')]; dialogSystem.showDialog(endDialogs, function () { showAct5Choices(); }); } }); }, 2000); } function startAct4RoomSequence() { // Start room sequence after Act 4 ending game.removeChildren(); blackScreen = game.addChild(LK.getAsset('blackScreen', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); // Slowly fade in habitacion1 LK.setTimeout(function () { habitacion1Sprite = game.addChild(LK.getAsset('habitacion1', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 20, scaleY: 18 })); // Fade in habitacion1 tween(habitacion1Sprite, { alpha: 1 }, { duration: 3000 }); // After 5 seconds, fade habitacion1 to black then show habitacion2 LK.setTimeout(function () { tween(habitacion1Sprite, { alpha: 0 }, { duration: 2000, onFinish: function onFinish() { habitacion2Sprite = game.addChild(LK.getAsset('habitacion2', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 20, scaleY: 18 })); // Fade in habitacion2 tween(habitacion2Sprite, { alpha: 1 }, { duration: 2000, onFinish: function onFinish() { // Start new dialogs (without wendigo sprite) dialogSystem = new DialogSystem(); dialogSystem.x = 1024; dialogSystem.y = 2532; game.addChild(dialogSystem); var newActRoomDialogs = [getLocalizedText('act4RoomDialog1'), getLocalizedText('act4RoomDialog2'), getLocalizedText('act4RoomDialog3'), getLocalizedText('act4RoomDialog4'), getLocalizedText('act4RoomDialog5'), getLocalizedText('act4RoomDialog6'), getLocalizedText('act4RoomDialog7'), getLocalizedText('act4RoomDialog8'), getLocalizedText('act4RoomDialog9'), getLocalizedText('act4RoomDialog10')]; dialogSystem.showDialog(newActRoomDialogs, function () { // After dialogs complete, update to Act 5 and return to menu currentAct = 5; storage.currentAct = currentAct; initializeMenu(); }); } }); } }); }, 5000); }, 1000); } function updateToolSelection() { for (var i = 0; i < toolButtons.length; i++) { toolButtons[i].setActive(toolButtons[i].toolType === currentTool); } } function updateColorSelection() { // Visual feedback for color selection could be added here } function isPointInCanvas(x, y) { if (!drawingCanvas) return false; var canvasLeft = drawingCanvas.x - drawingCanvas.width * 0.5; var canvasRight = drawingCanvas.x + drawingCanvas.width * 0.5; var canvasTop = drawingCanvas.y - drawingCanvas.height * 0.5; var canvasBottom = drawingCanvas.y + drawingCanvas.height * 0.5; return x >= canvasLeft && x <= canvasRight && y >= canvasTop && y <= canvasBottom; } function isPointInButton(x, y) { if (gameState !== 'painting') return false; // Check tool buttons for (var i = 0; i < toolButtons.length; i++) { var button = toolButtons[i]; var buttonLeft = button.x - 40; var buttonRight = button.x + 40; var buttonTop = button.y - 40; var buttonBottom = button.y + 40; if (x >= buttonLeft && x <= buttonRight && y >= buttonTop && y <= buttonBottom) { return true; } } // Check color swatches for (var j = 0; j < colorSwatches.length; j++) { var swatch = colorSwatches[j]; var swatchLeft = swatch.x - 50; var swatchRight = swatch.x + 50; var swatchTop = swatch.y - 33; var swatchBottom = swatch.y + 33; if (x >= swatchLeft && x <= swatchRight && y >= swatchTop && y <= swatchBottom) { return true; } } return false; } function addBrushStroke(x, y) { if (isPointInCanvas(x, y)) { // Convert game coordinates to canvas-local coordinates var canvasLocalX = x - drawingCanvas.x; var canvasLocalY = y - drawingCanvas.y; console.log("Creating brush stroke with color: 0x" + currentColor.toString(16)); var stroke = new BrushStroke(canvasLocalX, canvasLocalY, currentColor, brushSize); drawingCanvas.addChild(stroke); strokes.push(stroke); if (Math.random() < 0.3) { LK.getSound('drawSound').play(); } } } function addAerographStroke(x, y) { if (isPointInCanvas(x, y)) { // Convert game coordinates to canvas-local coordinates var canvasLocalX = x - drawingCanvas.x; var canvasLocalY = y - drawingCanvas.y; // Create spray pattern var sprayRadius = 30; var sprayCount = 8; for (var i = 0; i < sprayCount; i++) { var angle = Math.random() * 2 * Math.PI; var distance = Math.random() * sprayRadius; var sprayX = canvasLocalX + Math.cos(angle) * distance; var sprayY = canvasLocalY + Math.sin(angle) * distance; var stroke = new BrushStroke(sprayX, sprayY, currentColor, brushSize * 0.6); drawingCanvas.addChild(stroke); strokes.push(stroke); } } } function floodFill(startX, startY, fillColor) { // Convert game coordinates to canvas-local coordinates var canvasLocalX = startX - drawingCanvas.x; var canvasLocalY = startY - drawingCanvas.y; // Find enclosed area and fill it completely var canvasLeft = -drawingCanvas.width * 0.5; var canvasRight = drawingCanvas.width * 0.5; var canvasTop = -drawingCanvas.height * 0.5; var canvasBottom = drawingCanvas.height * 0.5; var visited = {}; var toFill = []; var stack = [{ x: Math.floor(canvasLocalX), y: Math.floor(canvasLocalY) }]; while (stack.length > 0 && toFill.length < 2000) { var point = stack.pop(); var key = point.x + ',' + point.y; if (visited[key] || point.x < canvasLeft || point.x > canvasRight || point.y < canvasTop || point.y > canvasBottom) continue; visited[key] = true; // Check if there's a stroke nearby (acts as border) var hasNearbyStroke = false; for (var i = 0; i < strokes.length; i++) { var stroke = strokes[i]; var distance = Math.sqrt((stroke.x - point.x) * (stroke.x - point.x) + (stroke.y - point.y) * (stroke.y - point.y)); if (distance < 15) { hasNearbyStroke = true; break; } } if (!hasNearbyStroke) { toFill.push({ x: point.x, y: point.y }); // Add neighboring points with smaller steps for solid fill var neighbors = [{ x: point.x + 8, y: point.y }, { x: point.x - 8, y: point.y }, { x: point.x, y: point.y + 8 }, { x: point.x, y: point.y - 8 }]; for (var j = 0; j < neighbors.length; j++) { stack.push(neighbors[j]); } } } // Fill the area with solid color for (var k = 0; k < toFill.length; k++) { var fillStroke = new BrushStroke(toFill[k].x, toFill[k].y, fillColor, 12); drawingCanvas.addChild(fillStroke); strokes.push(fillStroke); } } // Event handlers game.down = function (x, y, obj) { if (gameState === 'story' && dialogSystem && dialogSystem.visible) { dialogSystem.nextDialog(); return; } if (gameState === 'ending' && dialogSystem && dialogSystem.visible) { dialogSystem.nextDialog(); return; } if ((gameState === 'act2story' || gameState === 'act2ending') && dialogSystem && dialogSystem.visible) { dialogSystem.nextDialog(); return; } if ((gameState === 'act3story' || gameState === 'act3ending') && dialogSystem && dialogSystem.visible) { dialogSystem.nextDialog(); return; } if ((gameState === 'act4story' || gameState === 'act4ending') && dialogSystem && dialogSystem.visible) { dialogSystem.nextDialog(); return; } if (gameState === 'act5story' && dialogSystem && dialogSystem.visible) { dialogSystem.nextDialog(); return; } if (gameState === 'act5ending' && dialogSystem && dialogSystem.visible) { dialogSystem.nextDialog(); return; } if (gameState === 'act5leave' && dialogSystem && dialogSystem.visible) { dialogSystem.nextDialog(); return; } if (gameState === 'act5stay' && dialogSystem && dialogSystem.visible) { dialogSystem.nextDialog(); return; } if (gameState !== 'painting' && gameState !== 'act3painting' && gameState !== 'act4painting' && gameState !== 'act5painting') return; if (isPointInButton(x, y)) { return; } if (isPointInCanvas(x, y)) { if (currentTool === tools[4] || currentTool === tools[5] || currentTool === tools[6]) { // Line, Rectangle, Circle isDrawingShape = true; shapeStartX = x; shapeStartY = y; } else { isDrawing = true; } lastDrawX = x; lastDrawY = y; if (currentTool === tools[0]) { // Pencil/Lápiz addBrushStroke(x, y); } else if (currentTool === tools[1]) { // Airbrush/Aerógrafo addAerographStroke(x, y); } else if (currentTool === tools[2]) { // Eraser/Borrador // Convert game coordinates to canvas-local coordinates for eraser var canvasLocalX = x - drawingCanvas.x; var canvasLocalY = y - drawingCanvas.y; // Find and remove nearby strokes for (var i = strokes.length - 1; i >= 0; i--) { var stroke = strokes[i]; var distance = Math.sqrt((stroke.x - canvasLocalX) * (stroke.x - canvasLocalX) + (stroke.y - canvasLocalY) * (stroke.y - canvasLocalY)); if (distance < brushSize) { stroke.destroy(); strokes.splice(i, 1); } } } else if (currentTool === tools[3]) { // Bucket/Cubeta floodFill(x, y, currentColor); } } }; game.move = function (x, y, obj) { // Handle forest game light mask movement if (gameState === 'forestGame' && lightMask) { lightMask.x = x; lightMask.y = y; // Update color object visibility based on light position for (var i = 0; i < colorObjects.length; i++) { if (!colorObjects[i].isCollected) { if (isNearMouse(colorObjects[i])) { colorObjects[i].alpha = 1.0; colorObjects[i].tint = 0xFFFFFF; } else { colorObjects[i].alpha = 0.05; colorObjects[i].tint = 0x111111; } } } return; } if (gameState !== 'painting' && gameState !== 'act3painting' && gameState !== 'act4painting' && gameState !== 'act5painting' || !isDrawing || !isPointInCanvas(x, y)) return; if (currentTool === tools[0]) { // Pencil/Lápiz // Draw line between last position and current position var distance = Math.sqrt((x - lastDrawX) * (x - lastDrawX) + (y - lastDrawY) * (y - lastDrawY)); var steps = Math.floor(distance / 10); for (var i = 0; i <= steps; i++) { var interpolatedX = lastDrawX + (x - lastDrawX) * (i / steps); var interpolatedY = lastDrawY + (y - lastDrawY) * (i / steps); addBrushStroke(interpolatedX, interpolatedY); } } else if (currentTool === tools[1]) { // Airbrush/Aerógrafo // Continue aerograph spray var distance = Math.sqrt((x - lastDrawX) * (x - lastDrawX) + (y - lastDrawY) * (y - lastDrawY)); var steps = Math.floor(distance / 15); for (var i = 0; i <= steps; i++) { var interpolatedX = lastDrawX + (x - lastDrawX) * (i / steps); var interpolatedY = lastDrawY + (y - lastDrawY) * (i / steps); addAerographStroke(interpolatedX, interpolatedY); } } else if (currentTool === tools[2]) { // Eraser/Borrador // Convert game coordinates to canvas-local coordinates for eraser var canvasLocalX = x - drawingCanvas.x; var canvasLocalY = y - drawingCanvas.y; // Continue erasing for (var j = strokes.length - 1; j >= 0; j--) { var stroke = strokes[j]; var distance = Math.sqrt((stroke.x - canvasLocalX) * (stroke.x - canvasLocalX) + (stroke.y - canvasLocalY) * (stroke.y - canvasLocalY)); if (distance < brushSize) { stroke.destroy(); strokes.splice(j, 1); } } } lastDrawX = x; lastDrawY = y; }; game.up = function (x, y, obj) { if (gameState !== 'painting' && gameState !== 'act3painting' && gameState !== 'act4painting' && gameState !== 'act5painting') return; if (isDrawingShape && isPointInCanvas(x, y)) { if (currentTool === tools[4]) { // Line/Línea // Draw line from start to end var distance = Math.sqrt((x - shapeStartX) * (x - shapeStartX) + (y - shapeStartY) * (y - shapeStartY)); var steps = Math.floor(distance / 5); for (var i = 0; i <= steps; i++) { var lineX = shapeStartX + (x - shapeStartX) * (i / steps); var lineY = shapeStartY + (y - shapeStartY) * (i / steps); // Convert to canvas-local coordinates var canvasLocalX = lineX - drawingCanvas.x; var canvasLocalY = lineY - drawingCanvas.y; var lineStroke = new BrushStroke(canvasLocalX, canvasLocalY, currentColor, brushSize); drawingCanvas.addChild(lineStroke); strokes.push(lineStroke); } } else if (currentTool === tools[5]) { // Rectangle/Rectángulo // Draw rectangle outline var rectWidth = Math.abs(x - shapeStartX); var rectHeight = Math.abs(y - shapeStartY); var minX = Math.min(shapeStartX, x); var minY = Math.min(shapeStartY, y); // Top and bottom lines for (var j = 0; j <= rectWidth; j += 10) { // Convert to canvas-local coordinates var topCanvasX = minX + j - drawingCanvas.x; var topCanvasY = minY - drawingCanvas.y; var bottomCanvasX = minX + j - drawingCanvas.x; var bottomCanvasY = minY + rectHeight - drawingCanvas.y; var topStroke = new BrushStroke(topCanvasX, topCanvasY, currentColor, brushSize); var bottomStroke = new BrushStroke(bottomCanvasX, bottomCanvasY, currentColor, brushSize); drawingCanvas.addChild(topStroke); drawingCanvas.addChild(bottomStroke); strokes.push(topStroke); strokes.push(bottomStroke); } // Left and right lines for (var k = 0; k <= rectHeight; k += 10) { // Convert to canvas-local coordinates var leftCanvasX = minX - drawingCanvas.x; var leftCanvasY = minY + k - drawingCanvas.y; var rightCanvasX = minX + rectWidth - drawingCanvas.x; var rightCanvasY = minY + k - drawingCanvas.y; var leftStroke = new BrushStroke(leftCanvasX, leftCanvasY, currentColor, brushSize); var rightStroke = new BrushStroke(rightCanvasX, rightCanvasY, currentColor, brushSize); drawingCanvas.addChild(leftStroke); drawingCanvas.addChild(rightStroke); strokes.push(leftStroke); strokes.push(rightStroke); } } else if (currentTool === tools[6]) { // Circle/Círculo // Draw circle var centerX = (shapeStartX + x) / 2; var centerY = (shapeStartY + y) / 2; var radius = Math.sqrt((x - shapeStartX) * (x - shapeStartX) + (y - shapeStartY) * (y - shapeStartY)) / 2; var circumference = 2 * Math.PI * radius; var steps = Math.floor(circumference / 8); for (var l = 0; l < steps; l++) { var angle = l / steps * 2 * Math.PI; var circleX = centerX + Math.cos(angle) * radius; var circleY = centerY + Math.sin(angle) * radius; // Convert to canvas-local coordinates var canvasLocalX = circleX - drawingCanvas.x; var canvasLocalY = circleY - drawingCanvas.y; var circleStroke = new BrushStroke(canvasLocalX, canvasLocalY, currentColor, brushSize); drawingCanvas.addChild(circleStroke); strokes.push(circleStroke); } } } isDrawing = false; isDrawingShape = false; }; // Add keyboard event listener for space key LK.on('keydown', function (event) { if (event.key === ' ' || event.code === 'Space') { if (gameState === 'story' && dialogSystem && dialogSystem.visible) { dialogSystem.nextDialog(); } } }); // Initialize the game // Reset to act 1 on first load currentAct = 1; storage.currentAct = 1; initializeMenu(); // Main game loop game.update = function () { // Game update loop }; function showAct5Choices() { // Remove dialog system and show choice buttons dialogSystem.visible = false; var leaveButton = new MenuButton('IRNOS', 1024, 1800, function () { showAct5LeaveEnding(); }); game.addChild(leaveButton); var stayButton = new MenuButton('QUEDARNOS', 1024, 1950, function () { showAct5StayEnding(); }); game.addChild(stayButton); } function showAct5LeaveEnding() { game.removeChildren(); // Show end1 asset var end1Sprite = game.addChild(LK.getAsset('end1', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 20, scaleY: 18 })); tween(end1Sprite, { alpha: 1 }, { duration: 1000, onFinish: function onFinish() { LK.setTimeout(function () { tween(end1Sprite, { alpha: 0 }, { duration: 1000, onFinish: function onFinish() { // Show end2 asset var end2Sprite = game.addChild(LK.getAsset('end2', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 20, scaleY: 18 })); tween(end2Sprite, { alpha: 1 }, { duration: 1000, onFinish: function onFinish() { // Show leave dialogs without wendigo sprite gameState = 'act5leave'; dialogSystem = new DialogSystem(); dialogSystem.x = 1024; dialogSystem.y = 2532; game.addChild(dialogSystem); var leaveDialogs = [getLocalizedText('act5LeaveDialog1'), getLocalizedText('act5LeaveDialog2'), getLocalizedText('act5LeaveDialog3'), getLocalizedText('act5LeaveDialog4'), getLocalizedText('act5LeaveDialog5'), getLocalizedText('act5LeaveDialog6'), getLocalizedText('act5LeaveDialog7'), getLocalizedText('act5LeaveDialog8'), getLocalizedText('act5LeaveDialog9')]; dialogSystem.showDialog(leaveDialogs, function () { showFinalWhiteSequence(); }); } }); } }); }, 5000); } }); } function showAct5LeaveDialogs() { gameState = 'act5leave'; } function showFinalWhiteSequence() { // White screen fade in var whiteScreen = game.addChild(LK.getAsset('canvas', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 3, scaleY: 3, tint: 0xFFFFFF })); // Play pip sound and fade in white var pipSound = LK.getSound('pip'); pipSound.play(); tween(whiteScreen, { alpha: 1 }, { duration: 1000 }); // Wait for 15 seconds total for white screen duration LK.setTimeout(function () { game.removeChildren(); var blackScreen = game.addChild(LK.getAsset('blackScreen', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); // Show BLACKPAINT asset growing for 15 seconds var blackPaintSprite = game.addChild(LK.getAsset('BLACKPAINT', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 1, scaleY: 1 })); tween(blackPaintSprite, { alpha: 1 }, { duration: 1000, onFinish: function onFinish() { tween(blackPaintSprite, { scaleX: 15, scaleY: 15 }, { duration: 15000, onFinish: function onFinish() { tween(blackPaintSprite, { alpha: 0 }, { duration: 2000, onFinish: function onFinish() { // Game ends, return to menu initializeMenu(); } }); } }); } }); }, 23000); // White screen lasts for exactly 23 seconds } function showAct5StayEnding() { game.removeChildren(); // Show wendi3 asset var wendi3Sprite = game.addChild(LK.getAsset('wendi3', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 20, scaleY: 18 })); tween(wendi3Sprite, { alpha: 1 }, { duration: 2000, onFinish: function onFinish() { gameState = 'act5stay'; dialogSystem = new DialogSystem(); dialogSystem.x = 1024; dialogSystem.y = 2532; game.addChild(dialogSystem); var stayDialogs1 = [getLocalizedText('act5StayDialog1'), getLocalizedText('act5StayDialog2'), getLocalizedText('act5StayDialog3'), getLocalizedText('act5StayDialog4'), getLocalizedText('act5StayDialog5'), getLocalizedText('act5StayDialog6'), getLocalizedText('act5StayDialog7')]; dialogSystem.showDialog(stayDialogs1, function () { // Fade out wendi3 with black background var blackTransition1 = game.addChild(LK.getAsset('blackScreen', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0 })); tween(wendi3Sprite, { alpha: 0 }, { duration: 1000 }); tween(blackTransition1, { alpha: 1 }, { duration: 1000, onFinish: function onFinish() { var skullSprite = game.addChild(LK.getAsset('craneo', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 8, scaleY: 8 })); tween(skullSprite, { alpha: 1 }, { duration: 1000, onFinish: function onFinish() { // Recreate dialog system to ensure it's properly attached dialogSystem = new DialogSystem(); dialogSystem.x = 1024; dialogSystem.y = 2532; game.addChild(dialogSystem); // Show dialog while skull is visible dialogSystem.showDialog(['Wendigo: "te obsequio esto, es el cráneo de mi padre, creo que te mencione que era un antílope, no suelo comer huesos, así que lo guarde para un momento especial, y creo que este es ese momento pequeño artista"'], function () { // On click, fade out skull and black background, show wendi3 tween(skullSprite, { alpha: 0 }, { duration: 1000 }); tween(blackTransition1, { alpha: 0 }, { duration: 1000, onFinish: function onFinish() { // Show wendi3 again at full screen tween(wendi3Sprite, { alpha: 1 }, { duration: 1000, onFinish: function onFinish() { var finalDialogs = [getLocalizedText('act5StayDialog9'), getLocalizedText('act5StayDialog10')]; dialogSystem.showDialog(finalDialogs, function () { showFinalBlackPaintSequence(); }); } }); } }); }); } }); } }); }); } }); } function showFinalBlackPaintSequence() { // Fade everything to black var blackScreen = game.addChild(LK.getAsset('blackScreen', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0 })); tween(blackScreen, { alpha: 1 }, { duration: 2000, onFinish: function onFinish() { // Show BLACKPAINT asset growing for 15 seconds var blackPaintSprite = game.addChild(LK.getAsset('BLACKPAINT', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, alpha: 0, scaleX: 1, scaleY: 1 })); tween(blackPaintSprite, { alpha: 1 }, { duration: 1000, onFinish: function onFinish() { tween(blackPaintSprite, { scaleX: 15, scaleY: 15 }, { duration: 15000, onFinish: function onFinish() { tween(blackPaintSprite, { alpha: 0 }, { duration: 2000, onFinish: function onFinish() { // Game ends, return to menu initializeMenu(); } }); } }); } }); } }); }
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1", {
language: "es",
currentAct: 1
});
/****
* Classes
****/
var BrushStroke = Container.expand(function (x, y, color, size) {
var self = Container.call(this);
var stroke = self.attachAsset('brushStroke', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: size / 20,
scaleY: size / 20
});
// Apply color after asset is attached
stroke.tint = color;
self.x = x;
self.y = y;
self.originalColor = color;
return self;
});
var ColorSwatch = Container.expand(function (colorAsset, color, x, y) {
var self = Container.call(this);
self.color = color;
var swatch = self.attachAsset(colorAsset, {
anchorX: 0.5,
anchorY: 0.5
});
self.x = x;
self.y = y;
self.down = function (x, y, obj) {
LK.getSound('click').play();
currentColor = self.color;
console.log("Color selected: 0x" + self.color.toString(16) + " from asset: " + colorAsset);
console.log("currentColor is now: 0x" + currentColor.toString(16));
updateColorSelection();
};
return self;
});
var DialogSystem = Container.expand(function () {
var self = Container.call(this);
self.visible = false;
self.currentDialog = 0;
self.dialogs = [];
self.onComplete = null;
var dialogBg = self.attachAsset('dialogBox', {
anchorX: 0.5,
anchorY: 1,
x: 0,
y: -50
});
self.dialogText = new Text2('', {
size: 28,
fill: 0xFFFFFF,
wordWrap: true,
wordWrapWidth: 1700
});
self.dialogText.anchor.set(0.5, 0.5);
self.dialogText.x = 0;
self.dialogText.y = -200;
self.addChild(self.dialogText);
self.spaceText = new Text2('', {
size: 20,
fill: 0xCCCCCC
});
self.spaceText.anchor.set(1, 1);
self.spaceText.x = 850;
self.spaceText.y = -70;
self.addChild(self.spaceText);
self.showDialog = function (dialogs, onComplete) {
self.dialogs = dialogs;
self.currentDialog = 0;
self.onComplete = onComplete;
self.visible = true;
self.updateDialog();
};
self.updateDialog = function () {
if (self.currentDialog < self.dialogs.length) {
self.dialogText.setText(self.dialogs[self.currentDialog]);
self.spaceText.setText(getLocalizedText('pressSpace'));
} else {
self.visible = false;
if (self.onComplete) {
self.onComplete();
}
}
};
self.nextDialog = function () {
self.currentDialog++;
self.updateDialog();
};
return self;
});
var DrawingTool = Container.expand(function (toolType, x, y) {
var self = Container.call(this);
self.toolType = toolType;
self.isActive = false;
var buttonBg = self.attachAsset('toolButton', {
anchorX: 0.5,
anchorY: 0.5
});
var toolLabel = new Text2(toolType, {
size: 18,
fill: 0xFFFFFF
});
toolLabel.anchor.set(0.5, 0.5);
self.addChild(toolLabel);
self.x = x;
self.y = y;
self.setActive = function (active) {
self.isActive = active;
if (active) {
buttonBg.tint = 0x666666;
} else {
buttonBg.tint = 0x333333;
}
};
self.down = function (x, y, obj) {
LK.getSound('click').play();
currentTool = self.toolType;
updateToolSelection();
};
return self;
});
var MenuButton = Container.expand(function (text, x, y, callback) {
var self = Container.call(this);
var buttonBg = self.attachAsset('menuButton', {
anchorX: 0.5,
anchorY: 0.5
});
var buttonLabel = new Text2(text, {
size: 32,
fill: 0xFFFFFF
});
buttonLabel.anchor.set(0.5, 0.5);
self.addChild(buttonLabel);
self.x = x;
self.y = y;
self.callback = callback;
self.down = function (x, y, obj) {
LK.getSound('click').play();
if (self.callback) {
self.callback();
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x808080
});
/****
* Game Code
****/
// Game state variables
var gameState = 'menu'; // menu, story, painting, ending
var currentLanguage = storage.language || 'es';
var currentAct = storage.currentAct || 1;
// Act 2 variables
var act2DialogIndex = 0;
var act2Dialogs = [];
var flashlightSprite = null;
var forestSprite = null;
var colorObjects = [];
var collectedColors = 0;
var colorCounter = null;
var lightMask = null;
// Act 3 variables
var act3Timer = null;
var act3TimeRemaining = 120; // 2 minutes in seconds
var act3TimerText = null;
// Act 4 variables
var habitacion1Sprite = null;
var habitacion2Sprite = null;
var act4Timer = null;
var act4TimeRemaining = 60; // 1 minute in seconds
var act4TimerText = null;
var fireSprite = null;
// Language system
var texts = {
es: {
title: 'BLACK PAINT',
playButton: 'jugar acto',
languageButton: 'lenguaje',
pressSpace: 'Haz CLICK en cualquier lugar para continuar',
sendButton: 'enviar',
dialog1: 'wendigo: "¡Oh, hola, hola! No tengas miedo... mírame, ¿ves? Soy solo una criatura curiosa que vive entre líneas y colores. Nada peligroso por aquí... je, je."',
dialog2: 'wendigo: "Ahora... tengo una idea. ¿Quieres jugar conmigo? Te prometo que será divertido. El siguiente juego no es de correr ni de pelear... no, no, no. Será algo más fácil un juego de dibujos"',
dialog3: 'wendigo: "¿Quieres intentarlo? No te preocupes, no pasara nada malo... solo tienes que dibujar... y seguir jugando conmigo"',
dialog4: 'wendigo: "este es el lienzo, tienes un lápiz, un aerógrafo, un borrador, una cubeta para rellenar lo dibujado, una linea para hacer trazos rectos, un rectángulo, y un circulo, espero te diviertas usándolo, cuando termines tu dibujo puedes mostrármelo presionando el botón enviar!"',
dialog5: 'wendigo: "bueno... no esta mal... podrías haberlo hecho mejor pero creo que es aceptable... nos vemos mañana nuevo amigo!"',
tools: ['Lápiz', 'Aerógrafo', 'Borrador', 'Cubeta', 'Línea', 'Rectángulo', 'Círculo'],
act2Dialog1: 'wendigo: "Ahhh… ya lo vi… tu dibujo anterior. Sí, sí… lo recuerdo bien. No está mal, no, no… pero le falta algo, ¿no lo notas? Está… vacío. No tiene colores. Todo pálido, todo triste… como un cuerpo sin sangre."',
act2Dialog2: 'wendigo: "Pero no pasa nada, ¡yo sé por qué! Los colores se han escapado… se esconden en la oscuridad. Y para recuperarlos… necesitarás esto."',
act2Dialog3: 'wendigo: "Una linterna… tu nueva amiga. Con ella podrás explorar, iluminar los rincones oscuros… y cuando la luz toque un color perdido, ¡oh, lo verás brillar!"',
act2Dialog4: 'wendigo: "Cuando encuentres uno, acércate… recógelo (tócalo)… guárdalo muy cerca de ti. Uno por uno, los colores volverán. Y tus dibujos… tu dibujo serán hermosos… más vivos… más… reales."',
act2Dialog5: 'wendigo: "¿Estás listo? Sígueme, pequeño artista… busquemos lo que falta."',
act2EndDialog1: 'wendigo: "¡Jajaja! ¡Ahí están! ¡Los atrapaste a todos! Qué obediente eres, qué manitas más hábiles tienes…"',
act2EndDialog2: 'wendigo: "Los colores te querían, ¿sabes? Gritaban en la oscuridad, pedían que los encontraras"',
act2EndDialog3: 'wendigo: "¡Míralos! Brillan, se retuercen, danzan alrededor de ti como pequeñas luces vivas"',
act2EndDialog4: 'wendigo: "Tu dibujo ya no estará vacío. Ahora… tendrá carne, tendrá voz"',
act2EndDialog5: 'wendigo: "¿Ves? Te dije que sería divertido. Gracias… gracias por traerlos de regreso… ahora podremos jugar más, mucho más…"',
act2EndDialog6: 'wendigo: "Has hecho algo hermoso… algo que nunca se olvidará"',
act2EndDialog7: 'wendigo: "ahora ya no están solos. Y yo tampoco…"',
act2EndDialog8: 'wendigo: "mañana nos volveremos a ver amigo :)"',
act3Dialog1: 'wendigo: "Ah… hola, hola… ya estás aquí otra vez. Qué bien… pensé que tal vez no volverías después de… de anoche... fue divertido cuando jugamos"',
act3Dialog2: 'wendigo: "La verdad… no dormí muy bien. Tuve… una pelea. Sí… con mi padre. Él siempre gruñe, siempre dice que juego demasiado contigo… así que… pues… me lo comí. sabia similar a la carne de res pero tenia un sabor mas magro"',
act3Dialog3: 'wendigo: "Je, je… pero, ¿sabes qué? Eso no me llenó. Todavía tenía hambre. Mucha hambre… y… bueno… me comí los colores que habías encontrado"',
act3Dialog4: 'wendigo: "Así que hoy… no quedan más. Solo uno. El negro. Mi favorito."',
act3Dialog5: 'wendigo: "Tu misión de hoy será simple: un dibujo, solo con negro. Solo con sombras, solo con vacío. Pero… habrá un detalle: el tiempo. Solo tendrás dos minutos antes de que la luz se apague, ¿entiendes?"',
act3Dialog6: 'wendigo: "Hazlo rápido, hazlo bien… porque yo estaré mirando. Y cuando termines… quizá te deje jugar… un poco más."',
act3EndDialog1: 'Wendigo: "¡Se acabó el tiempo! Je, je, je… ¡déjame ver, déjame ver! ¿Qué hiciste en solo dos minutos?"',
act3EndDialog2: 'Wendigo: "Ohhh… interesante… tan oscuro… tan… vacío. El negro lo cubre todo, como si tragara la luz."',
act3EndDialog3: 'Wendigo: "¿Sabes? Parece más que un dibujo… parece una ventana… ¡sí! Una ventana que se abre hacia… allá. Je, je, je…"',
act3EndDialog4: 'Wendigo: "Me gusta. Sí… me gusta mucho. Tiene hambre… igual que yo."',
act3EndDialog5: 'Wendigo: "Lo hiciste bien, pequeño artista. Muy bien. ¿Quieres saber un secreto? Mientras dibujabas… yo también dibujé… pero no con manos, no con pinceles. Dibujé con tus sombras."',
act3EndDialog6: 'Wendigo: "Y ahora… el juego puede continuar."',
act3EndDialog7: 'Wendigo: "Se que te queda poco tiempo aquí así que quiero que esta aventura sea inolvidable... nos veremos pronto mi amigo!"',
act4Dialog1: 'Wendigo: "Hola… hola… no quería asustarte. Solo… solo quería compañía."',
act4Dialog2: 'Wendigo: "Es difícil… estar solo. Nadie queda para hablar conmigo… mi madre… falleció. Mi padre… también se fue… bueno, ya sabes… me lo comí."',
act4Dialog3: 'Wendigo: "Jajaja… es raro, ¿verdad? Nadie que me cuide… nadie que me abrace… y aun así… aquí estoy, contigo."',
act4Dialog4: 'Wendigo: "Mi madre adoptiva era una cierva… y mi padre adoptivo, un antílope… un Lechwe, muy elegante. Yo… nunca supe lo que soy realmente. Tampoco conozco a mis padres biológicos."',
act4Dialog5: 'Wendigo: "Ese era el motivo de la pelea con mi padre el otro día… creo que me excedí un poco al comerlo. Debí primero sazonarlo, ¿sabes? Jajaja… je, je…"',
act4Dialog6: 'Wendigo: "Y ahora… no tengo a nadie. Nadie con quien compartir… excepto… tú. ¿Puedo quedarme un rato? Solo… un ratito… mientras te duermes."',
act4Dialog7: 'Wendigo: "¿Ves esto? Esto también es arte… igual que tu dibujo… solo que… un poco más… vivo."',
act4Dialog8: 'Wendigo: "Y ahora… no tengo a nadie. Nadie con quien compartir… excepto… tú. ¿Puedo quedarme un rato? Solo… un ratito… mientras te duermes."',
act4Dialog9: 'Wendigo: "Prometo no hacer ruido… solo escuchar… o quizá contarte historias… Historias de sombras… de cosas que se esconden cuando los demás se van… Historias de… lo que queda cuando alguien se va… para siempre."',
act4Dialog10: 'Wendigo: "¿Ves la sombra ahí? Sí… esa que se mueve sola… no… no soy yo… bueno… tal vez sí… Jajaja… me gusta verte dormido y saber que estás aquí… conmigo… No te preocupes… solo estoy… viéndote. Solo un ratito."',
act4StartDialog1: 'Wendigo: "Ahhh… ahí estás. Te buscaba. ¿Dormiste bien? Yo… no tanto. Cuando estaba contigo anoche… algo pasó. Je, je, je… tuve hambre… y no pude aguantarme."',
act4StartDialog2: 'Wendigo: "Me comí… una parte de ti. Sí… algo muy tuyo… algo que nunca vuelve. ¿Quieres saber qué fue?"',
act4StartDialog3: 'Wendigo: "Te lo diré, pero solo si cumples con mi reto de hoy. Escucha bien: harás un dibujo… solo con lápiz. Nada de aerógrafo, nada de figuras, nada de borrador… solo un trazo negro, directo, crudo."',
act4StartDialog4: 'Wendigo: "Un dibujo… que me guste. Uno que me hable. Pero tendrás solo un minuto antes de que el bosque se trague la luz."',
act4StartDialog5: 'Wendigo: "Corre, pequeño artista, corre. Traza, dibuja, crea. Y si lo haces bien… si me complaces… te diré qué pedazo de ti me llevé conmigo anoche. Je, je, je…"',
act4StartDialog6: 'Wendigo: "Empieza ahora… el tiempo ya corre…"',
act4EndDialog1: 'Wendigo: "Mmhh… ¿esto es todo? ¿Esto es lo que hiciste para mí?"',
act4EndDialog2: 'Wendigo: "No… no me gusta. Es torpe… vacío… no me dice nada. Nada de ti, nada de lo que escondes."',
act4EndDialog3: 'Wendigo: "Tu esfuerzo… reducido a cenizas. Mira cómo desaparece, como si nunca hubiera existido. Así de frágil eres, ¿sabes? Así de fácil es borrar lo que haces."',
act4EndDialog4: 'Wendigo: "Dijimos un trato… y no cumpliste. Querías saber qué parte de ti me comí anoche… pero no, no te lo diré. Ese secreto… seguirá siendo mío."',
act4EndDialog5: 'Wendigo: "Adiós por ahora, pequeño artista. Guarda tus manos, guarda tu tiempo… quizá mañana me des algo que valga la pena."',
act4EndDialog6: 'Wendigo: "Nos veremos pronto… y recuerda… aún tengo hambre."',
act4RoomDialog1: 'Wendigo: "¿Estás despierto…? Soy yo… no quiero asustarte otra vez."',
act4RoomDialog2: 'Wendigo: "Vine porque… lo pensé bien… y… creo que me equivoqué contigo."',
act4RoomDialog3: 'Wendigo: "Lo siento… por quemar tu dibujo. Lo siento por no decirte la verdad."',
act4RoomDialog4: 'Wendigo: "Sin ti… no soy nada. Solo un ruido en el bosque, una sombra entre ramas."',
act4RoomDialog5: 'Wendigo: "Cuando no estás… todo se siente… vacío."',
act4RoomDialog6: 'Wendigo: "Yo río, yo juego, yo como… pero al final… ¿para qué?"',
act4RoomDialog7: 'Wendigo: "Sin ti, no tiene sentido. Eres lo único que me mantiene aquí, el único que me escucha… el único que me deja ser alguien."',
act4RoomDialog8: 'Wendigo: "Perdóname, pequeño artista. No quiero perderte."',
act4RoomDialog9: 'Wendigo: "Te prometo que mañana será distinto… si me dejas quedarme esta noche, aunque sea en silencio."',
act4RoomDialog10: 'Wendigo: "Déjame estar aquí… porque sin ti… yo no soy nada."',
act5Dialog1: 'Wendigo: "Buenos días, pequeño artista… ¿lo sientes? Sí… el aire es distinto hoy. Porque hoy será… tu último día aquí, conmigo."',
act5Dialog2: 'Wendigo: "Has jugado, has buscado, has dibujado con lo que te di… y aunque a veces no entendieras mis juegos… llegaste hasta aquí. Por eso… hoy quiero darte algo distinto."',
act5Dialog3: 'Wendigo: "Libre albedrío. Eso tendrás. Podrás dibujar lo que quieras… lo que nazca de ti. El único límite es el color… solo queda el negro. Ya lo sabes… los demás me los comí."',
act5Dialog4: 'Wendigo: "Pero escucha: tendrás de nuevo todas las herramientas que alguna vez usaste. El lápiz, el borrador, el aerógrafo… la línea… el rectángulo… y el círculo. Todos a tu disposición."',
act5Dialog5: 'Wendigo: "Haz lo que quieras. Una forma, un recuerdo, un monstruo… o un sueño. No pondré reglas esta vez."',
act5Dialog6: 'Wendigo: "Será tu último trazo aquí… el último que yo veré."',
act5Dialog7: 'Wendigo: "Así que hazlo tuyo. Hazlo eterno."',
act5Dialog8: 'Wendigo: "Y yo… lo guardaré… en mi memoria… y en mis entrañas."',
act5EndDialog1: 'Wendigo: "…Míralo. Tu obra final. Es digno. Sí… digno de ti, de todo lo que pasaste aquí conmigo."',
act5EndDialog2: 'Wendigo: "No es perfecto… pero eso está bien. ¿Sabes por qué? Porque nada lo es. Ni yo… ni tú… ni siquiera este bosque. La imperfección… es lo que lo hace verdadero."',
act5EndDialog3: 'Wendigo: "Y ahora… llegamos al final de nuestro juego. Pero el final no siempre significa lo mismo."',
act5EndDialog4: 'Wendigo: "Tienes que decidir ¿Quieres irte… volver a tu mundo, a tu vida, sin mí…? O… ¿quieres quedarte? Quedarte aquí, en la penumbra del bosque, conmigo… para seguir dibujando sombras, colores que nadie más verá."',
act5EndDialog5: 'Wendigo: "La elección es tuya, pequeño artista. El último trazo… lo haces tú."',
act5LeaveDialog1: 'Wendigo: "Así que… has elegido irte. Volver a tu mundo, a tu vida. No te culpo… aunque me duela. Sabía que este momento llegaría."',
act5LeaveDialog2: 'Wendigo: "Pero… antes de que te marches… tengo que ser honesto contigo. Te debo la verdad. ¿Recuerdas aquella noche, cuando te dije que me había comido una parte de ti? No fue por hambre… no. Mentí."',
act5LeaveDialog3: 'Wendigo: "Lo que realmente me comí…"',
act5LeaveDialog4: 'Wendigo: "fue tu alma."',
act5LeaveDialog5: 'Wendigo: "No lo hice por necesidad… lo hice porque quería que fueras como yo. Un ser extraño, incompleto… alguien que pudiera quedarse aquí conmigo, en este mundo sin color. Yo… no quería estar solo."',
act5LeaveDialog6: 'Wendigo: "Pero ahora lo entiendo… tú también tienes una vida allá fuera. Y al haberte robado tu alma… te quité algo que jamás podré devolverte. Cuando regreses al mundo real… serás diferente."',
act5LeaveDialog7: 'Wendigo: "Ya no podrás amar… ni sentir… aunque lo desees con todo tu corazón. Porque sin alma… no hay nada que pueda llenarte."',
act5LeaveDialog8: 'Wendigo: "Perdóname… pequeño artista… Perdóname por condenarte a esa sombra vacía. Si pudiera… lo desharía. Pero ya es tarde."',
act5LeaveDialog9: 'Wendigo: "Adiós… pequeño artista."',
act5StayDialog1: 'Wendigo: "¡Así que… elegiste quedarte! Je, je, je… sabía que lo harías. Sabía que no me dejarías solo… no tú."',
act5StayDialog2: 'Wendigo: "Ahora puedo decirte la verdad… ¿recuerdas aquella noche? Cuando te dije que me comí una parte de ti…"',
act5StayDialog3: 'Wendigo: "Lo que tomé de ti…"',
act5StayDialog4: 'wendigo: "fue tu alma."',
act5StayDialog5: 'Wendigo: "No lo hice por hambre… ¡no! Lo hice porque quería que fueras como yo. Un ser extraño… diferente… alguien capaz de vivir aquí conmigo, en este mundo sin color."',
act5StayDialog6: 'Wendigo: "Y ahora… ahora ya no estaré solo nunca más."',
act5StayDialog7: 'Wendigo: "Eres como yo… ahora. Sin alma… sin esa carga… libre de lo que amarra a los demás. Libre para quedarte… conmigo."',
act5StayDialog8: 'Wendigo: "te obsequio esto, es el cráneo de mi padre, creo que te mencione que era un antílope, no suelo comer huesos, así que lo guarde para un momento especial, y creo que este es ese momento pequeño artista"',
act5StayDialog9: 'Wendigo: "¡Gracias! Gracias por elegirme, por quedarte… por ser mi amigo. Ahora podremos caminar juntos, dibujar juntos… reír juntos… Para siempre, en este bosque sin color."',
act5StayDialog10: 'Wendigo: "Ya no estoy solo… porque ahora… te tengo a ti."',
timeRemaining: 'te quedan ___ para terminar tu dibujo',
colorsCollected: 'COLORES RECOLECTADOS'
},
en: {
title: 'BLACK PAINT',
playButton: 'play act',
languageButton: 'language',
pressSpace: 'CLICK anywhere to continue',
sendButton: 'send',
dialog1: 'wendigo: "Oh, hello, hello! Don\'t be afraid... look at me, see? I\'m just a curious creature that lives between lines and colors. Nothing dangerous here... heh, heh."',
dialog2: 'wendigo: "Now... I have an idea. Do you want to play with me? I promise it will be fun. The next game is not about running or fighting... no, no, no. It will be something easier, a drawing game"',
dialog3: 'wendigo: "Do you want to try it? Don\'t worry, nothing bad will happen... you just have to draw... and keep playing with me"',
dialog4: 'wendigo: "this is the canvas, you have a pencil, an airbrush, an eraser, a bucket to fill what you draw, a line to make straight strokes, a rectangle, and a circle, I hope you have fun using it, when you finish your drawing you can show it to me by pressing the send button!"',
dialog5: 'wendigo: "well... not bad... you could have done better but I think it\'s acceptable... see you tomorrow new friend!"',
tools: ['Pencil', 'Airbrush', 'Eraser', 'Bucket', 'Line', 'Rectangle', 'Circle'],
act2Dialog1: 'wendigo: "Ahhh… I saw it… your previous drawing. Yes, yes… I remember it well. Not bad, no, no… but it\'s missing something, don\'t you notice? It\'s… empty. No colors. All pale, all sad… like a body without blood."',
act2Dialog2: 'wendigo: "But it\'s okay, I know why! The colors have escaped… they hide in the darkness. And to recover them… you\'ll need this."',
act2Dialog3: 'wendigo: "A flashlight… your new friend. With it you can explore, illuminate the dark corners… and when the light touches a lost color, oh, you\'ll see it shine!"',
act2Dialog4: 'wendigo: "When you find one, get close… pick it up (touch it)… keep it very close to you. One by one, the colors will return. And your drawings… your drawing will be beautiful… more alive… more… real."',
act2Dialog5: 'wendigo: "Are you ready? Follow me, little artist… let\'s look for what\'s missing."',
act2EndDialog1: 'wendigo: "Hahaha! There they are! You caught them all! How obedient you are, what skilled little hands you have…"',
act2EndDialog2: 'wendigo: "The colors wanted you, you know? They screamed in the darkness, asking you to find them"',
act2EndDialog3: 'wendigo: "Look at them! They shine, writhe, dance around you like little living lights"',
act2EndDialog4: 'wendigo: "Your drawing will no longer be empty. Now… it will have flesh, it will have voice"',
act2EndDialog5: 'wendigo: "See? I told you it would be fun. Thank you… thank you for bringing them back… now we can play more, much more…"',
act2EndDialog6: 'wendigo: "You\'ve done something beautiful… something that will never be forgotten"',
act2EndDialog7: 'wendigo: "now they are no longer alone. And neither am I…"',
act2EndDialog8: 'wendigo: "tomorrow we will see each other again friend :)"',
act3Dialog1: 'wendigo: "Ah… hello, hello… you\'re here again. How nice… I thought maybe you wouldn\'t come back after… after last night... it was fun when we played"',
act3Dialog2: 'wendigo: "The truth… I didn\'t sleep very well. I had… a fight. Yes… with my father. He always growls, always says I play too much with you… so… well… I ate him. He tasted similar to beef but had a leaner flavor"',
act3Dialog3: 'wendigo: "Heh, heh… but, you know what? That didn\'t fill me up. I was still hungry. Very hungry… and… well… I ate the colors you had found"',
act3Dialog4: 'wendigo: "So today… there are no more left. Only one. Black. My favorite."',
act3Dialog5: 'wendigo: "Your mission today will be simple: a drawing, only with black. Only with shadows, only with emptiness. But… there will be a detail: time. You\'ll only have two minutes before the light goes out, understand?"',
act3Dialog6: 'wendigo: "Do it fast, do it well… because I\'ll be watching. And when you finish… maybe I\'ll let you play… a little more."',
act3EndDialog1: 'Wendigo: "Time\'s up! Heh, heh, heh… let me see, let me see! What did you do in just two minutes?"',
act3EndDialog2: 'Wendigo: "Ohhh… interesting… so dark… so… empty. Black covers everything, as if it swallowed the light."',
act3EndDialog3: 'Wendigo: "You know? It looks like more than a drawing… it looks like a window… yes! A window that opens towards… there. Heh, heh, heh…"',
act3EndDialog4: 'Wendigo: "I like it. Yes… I like it very much. It\'s hungry… just like me."',
act3EndDialog5: 'Wendigo: "You did well, little artist. Very well. Want to know a secret? While you were drawing… I was also drawing… but not with hands, not with brushes. I drew with your shadows."',
act3EndDialog6: 'Wendigo: "And now… the game can continue."',
act3EndDialog7: 'Wendigo: "I know you don\'t have much time left here so I want this adventure to be unforgettable... we\'ll see each other soon my friend!"',
act4Dialog1: 'Wendigo: "Hello… hello… I didn\'t want to scare you. Just… just wanted company."',
act4Dialog2: 'Wendigo: "It\'s difficult… being alone. No one left to talk to me… my mother… passed away. My father… also left… well, you know… I ate him."',
act4Dialog3: 'Wendigo: "Hahaha… it\'s weird, right? No one to take care of me… no one to hug me… and yet… here I am, with you."',
act4Dialog4: 'Wendigo: "My adoptive mother was a deer… and my adoptive father, an antelope… a Lechwe, very elegant. I… never knew what I really am. I don\'t know my biological parents either."',
act4Dialog5: 'Wendigo: "That was the reason for the fight with my father the other day… I think I went a little too far eating him. I should have seasoned him first, you know? Hahaha… heh, heh…"',
act4Dialog6: 'Wendigo: "And now… I have no one. No one to share with… except… you. Can I stay for a while? Just… a little while… while you sleep."',
act4Dialog7: 'Wendigo: "Do you see this? This is also art… just like your drawing… only… a little more… alive."',
act4Dialog8: 'Wendigo: "And now… I have no one. No one to share with… except… you. Can I stay for a while? Just… a little while… while you sleep."',
act4Dialog9: 'Wendigo: "I promise not to make noise… just listen… or maybe tell you stories… Stories of shadows… of things that hide when others leave… Stories of… what remains when someone leaves… forever."',
act4Dialog10: 'Wendigo: "Do you see the shadow there? Yes… the one that moves by itself… no… it\'s not me… well… maybe it is… Hahaha… I like seeing you sleep and knowing you\'re here… with me… Don\'t worry… I\'m just… watching you. Just for a little while."',
act4StartDialog1: 'Wendigo: "Ahhh... there you are. I was looking for you. Did you sleep well? I... not so much. When I was with you last night... something happened. Heh, heh, heh... I got hungry... and I couldn\'t hold back."',
act4StartDialog2: 'Wendigo: "I ate... a part of you. Yes... something very much yours... something that never comes back. Do you want to know what it was?"',
act4StartDialog3: 'Wendigo: "I\'ll tell you, but only if you complete my challenge today. Listen carefully: you will make a drawing... only with pencil. No airbrush, no shapes, no eraser... just a black stroke, direct, raw."',
act4StartDialog4: 'Wendigo: "A drawing... that I like. One that speaks to me. But you\'ll only have one minute before the forest swallows the light."',
act4StartDialog5: 'Wendigo: "Run, little artist, run. Draw, sketch, create. And if you do it well... if you please me... I\'ll tell you what piece of you I took with me last night. Heh, heh, heh..."',
act4StartDialog6: 'Wendigo: "Start now... time is already running..."',
act4EndDialog1: 'Wendigo: "Mmhh... is this all? Is this what you made for me?"',
act4EndDialog2: 'Wendigo: "No... I don\'t like it. It\'s clumsy... empty... it tells me nothing. Nothing about you, nothing about what you hide."',
act4EndDialog3: 'Wendigo: "Your effort... reduced to ashes. Look how it disappears, as if it never existed. That\'s how fragile you are, you know? That\'s how easy it is to erase what you do."',
act4EndDialog4: 'Wendigo: "We made a deal... and you didn\'t fulfill it. You wanted to know what part of you I ate last night... but no, I won\'t tell you. That secret... will remain mine."',
act4EndDialog5: 'Wendigo: "Goodbye for now, little artist. Keep your hands, keep your time... maybe tomorrow you\'ll give me something worthwhile."',
act4EndDialog6: 'Wendigo: "We\'ll see each other soon... and remember... I\'m still hungry."',
act4RoomDialog1: 'Wendigo: "Are you awake…? It\'s me… I don\'t want to scare you again."',
act4RoomDialog2: 'Wendigo: "I came because… I thought about it… and… I think I was wrong about you."',
act4RoomDialog3: 'Wendigo: "I\'m sorry… for burning your drawing. I\'m sorry for not telling you the truth."',
act4RoomDialog4: 'Wendigo: "Without you… I am nothing. Just a noise in the forest, a shadow among branches."',
act4RoomDialog5: 'Wendigo: "When you\'re not here… everything feels… empty."',
act4RoomDialog6: 'Wendigo: "I laugh, I play, I eat… but in the end… what\'s the point?"',
act4RoomDialog7: 'Wendigo: "Without you, it makes no sense. You\'re the only thing that keeps me here, the only one who listens to me… the only one who lets me be someone."',
act4RoomDialog8: 'Wendigo: "Forgive me, little artist. I don\'t want to lose you."',
act4RoomDialog9: 'Wendigo: "I promise tomorrow will be different… if you let me stay tonight, even in silence."',
act4RoomDialog10: 'Wendigo: "Let me be here… because without you… I am nothing."',
act5Dialog1: 'Wendigo: "Good morning, little artist… do you feel it? Yes… the air is different today. Because today will be… your last day here, with me."',
act5Dialog2: 'Wendigo: "You have played, you have searched, you have drawn with what I gave you… and although sometimes you didn\'t understand my games… you made it here. That\'s why… today I want to give you something different."',
act5Dialog3: 'Wendigo: "Free will. That\'s what you\'ll have. You can draw whatever you want… whatever is born from you. The only limit is color… only black remains. You already know… I ate the others."',
act5Dialog4: 'Wendigo: "But listen: you will have again all the tools you once used. The pencil, the eraser, the airbrush… the line… the rectangle… and the circle. All at your disposal."',
act5Dialog5: 'Wendigo: "Do whatever you want. A shape, a memory, a monster… or a dream. I won\'t set rules this time."',
act5Dialog6: 'Wendigo: "It will be your last stroke here… the last one I will see."',
act5Dialog7: 'Wendigo: "So make it yours. Make it eternal."',
act5Dialog8: 'Wendigo: "And I… will keep it… in my memory… and in my entrails."',
act5EndDialog1: 'Wendigo: "…Look at it. Your final work. It is worthy. Yes… worthy of you, of everything you went through here with me."',
act5EndDialog2: 'Wendigo: "It\'s not perfect… but that\'s okay. You know why? Because nothing is. Not me… not you… not even this forest. Imperfection… is what makes it true."',
act5EndDialog3: 'Wendigo: "And now… we reach the end of our game. But the end doesn\'t always mean the same thing."',
act5EndDialog4: 'Wendigo: "You have to decide. Do you want to leave… return to your world, to your life, without me…? Or… do you want to stay? Stay here, in the penumbra of the forest, with me… to continue drawing shadows, colors that no one else will see."',
act5EndDialog5: 'Wendigo: "The choice is yours, little artist. The last stroke… you make it."',
act5LeaveDialog1: 'Wendigo: "So… you chose to leave. Return to your world, to your life. I don\'t blame you… though it hurts. I knew this moment would come."',
act5LeaveDialog2: 'Wendigo: "But… before you go… I have to be honest with you. I owe you the truth. Remember that night, when I told you I ate a part of you? It wasn\'t from hunger… no. I lied."',
act5LeaveDialog3: 'Wendigo: "What I really ate…"',
act5LeaveDialog4: 'Wendigo: "was your soul."',
act5LeaveDialog5: 'Wendigo: "I didn\'t do it out of necessity… I did it because I wanted you to be like me. A strange being, incomplete… someone who could stay here with me, in this colorless world. I… didn\'t want to be alone."',
act5LeaveDialog6: 'Wendigo: "But now I understand… you also have a life out there. And by stealing your soul… I took something I can never return. When you go back to the real world… you will be different."',
act5LeaveDialog7: 'Wendigo: "You will no longer be able to love… or feel… even if you desire it with all your heart. Because without a soul… there is nothing that can fill you."',
act5LeaveDialog8: 'Wendigo: "Forgive me… little artist… Forgive me for condemning you to that empty shadow. If I could… I would undo it. But it\'s too late."',
act5LeaveDialog9: 'Wendigo: "Goodbye… little artist."',
act5StayDialog1: 'Wendigo: "So… you chose to stay! Heh, heh, heh… I knew you would. I knew you wouldn\'t leave me alone… not you."',
act5StayDialog2: 'Wendigo: "Now I can tell you the truth… remember that night? When I told you I ate a part of you…"',
act5StayDialog3: 'Wendigo: "What I took from you…"',
act5StayDialog4: 'wendigo: "was your soul."',
act5StayDialog5: 'Wendigo: "I didn\'t do it from hunger… no! I did it because I wanted you to be like me. A strange being… different… someone capable of living here with me, in this colorless world."',
act5StayDialog6: 'Wendigo: "And now… now I will never be alone again."',
act5StayDialog7: 'Wendigo: "You are like me… now. Without soul… without that burden… free from what binds others. Free to stay… with me."',
act5StayDialog8: 'Wendigo: "I gift you this, it is my father\'s skull, I think I mentioned he was an antelope, I don\'t usually eat bones, so I saved it for a special moment, and I think this is that moment little artist"',
act5StayDialog9: 'Wendigo: "Thank you! Thank you for choosing me, for staying… for being my friend. Now we can walk together, draw together… laugh together… Forever, in this colorless forest."',
act5StayDialog10: 'Wendigo: "I\'m no longer alone… because now… I have you."',
timeRemaining: 'you have ___ left to finish your drawing',
colorsCollected: 'COLORS COLLECTED'
}
};
function getLocalizedText(key) {
return texts[currentLanguage][key] || key;
}
// UI Elements
var titleScreen = null;
var blackScreen = null;
var wendigoSprite = null;
var wendigoReadingSprite = null;
var dialogSystem = null;
var paintUI = null;
var sendButton = null;
// Painting game variables
var background = null;
var drawingCanvas = null;
var tools = [];
var toolButtons = [];
var colorSwatches = [];
var currentTool = getLocalizedText('tools')[0];
var currentColor = 0xFF0000;
var isDrawing = false;
var lastDrawX = 0;
var lastDrawY = 0;
var brushSize = 20;
var strokes = [];
var shapeStartX = 0;
var shapeStartY = 0;
var isDrawingShape = false;
// Functions
function initializeMenu() {
gameState = 'menu';
game.removeChildren();
titleScreen = new Container();
game.addChild(titleScreen);
var titleAsset = titleScreen.attachAsset('BLACKPAINT', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 800,
scaleX: 8,
scaleY: 8
});
var playButton = new MenuButton(getLocalizedText('playButton') + ' ' + currentAct, 1024, 1200, function () {
if (currentAct === 1) {
startStory();
} else if (currentAct === 2) {
startAct2();
} else if (currentAct === 3) {
startAct3();
} else if (currentAct === 4) {
startAct4();
} else if (currentAct === 5) {
startAct5();
}
});
titleScreen.addChild(playButton);
var languageButton = new MenuButton(getLocalizedText('languageButton'), 1024, 1350, function () {
showLanguageMenu();
});
titleScreen.addChild(languageButton);
}
function showLanguageMenu() {
titleScreen.removeChildren();
var titleAsset = titleScreen.attachAsset('BLACKPAINT', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 800,
scaleX: 8,
scaleY: 8
});
var spanishButton = new MenuButton('Español', 1024, 1100, function () {
currentLanguage = 'es';
storage.language = 'es';
initializeMenu();
});
titleScreen.addChild(spanishButton);
var englishButton = new MenuButton('English', 1024, 1250, function () {
currentLanguage = 'en';
storage.language = 'en';
initializeMenu();
});
titleScreen.addChild(englishButton);
}
function startStory() {
gameState = 'story';
game.removeChildren();
blackScreen = game.addChild(LK.getAsset('blackScreen', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
dialogSystem = new DialogSystem();
dialogSystem.x = 1024;
dialogSystem.y = 2532;
game.addChild(dialogSystem);
// Fade in wendigo
LK.setTimeout(function () {
wendigoSprite = game.addChild(LK.getAsset('wendigo', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 6,
scaleY: 6
}));
tween(wendigoSprite, {
alpha: 1
}, {
duration: 2000,
onFinish: function onFinish() {
// Start dialog sequence
var dialogs = [getLocalizedText('dialog1'), getLocalizedText('dialog2'), getLocalizedText('dialog3'), getLocalizedText('dialog4')];
dialogSystem.showDialog(dialogs, function () {
startPaintingGame();
});
}
});
}, 1000);
}
function startAct2() {
gameState = 'act2story';
game.removeChildren();
blackScreen = game.addChild(LK.getAsset('blackScreen', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
dialogSystem = new DialogSystem();
dialogSystem.x = 1024;
dialogSystem.y = 2532;
game.addChild(dialogSystem);
act2DialogIndex = 0;
act2Dialogs = [getLocalizedText('act2Dialog1'), getLocalizedText('act2Dialog2')];
// Fade in wendigo
LK.setTimeout(function () {
wendigoSprite = game.addChild(LK.getAsset('wendigo', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 6,
scaleY: 6
}));
tween(wendigoSprite, {
alpha: 1
}, {
duration: 2000,
onFinish: function onFinish() {
dialogSystem.showDialog(act2Dialogs, function () {
showFlashlight();
});
}
});
}, 1000);
}
function startAct3() {
gameState = 'act3story';
game.removeChildren();
blackScreen = game.addChild(LK.getAsset('blackScreen', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
dialogSystem = new DialogSystem();
dialogSystem.x = 1024;
dialogSystem.y = 2532;
game.addChild(dialogSystem);
// Fade in wendigo
LK.setTimeout(function () {
wendigoSprite = game.addChild(LK.getAsset('wendigo', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 6,
scaleY: 6
}));
tween(wendigoSprite, {
alpha: 1
}, {
duration: 2000,
onFinish: function onFinish() {
var act3Dialogs = [getLocalizedText('act3Dialog1'), getLocalizedText('act3Dialog2'), getLocalizedText('act3Dialog3'), getLocalizedText('act3Dialog4'), getLocalizedText('act3Dialog5'), getLocalizedText('act3Dialog6')];
dialogSystem.showDialog(act3Dialogs, function () {
startAct3PaintingGame();
});
}
});
}, 1000);
}
function startAct4() {
gameState = 'act4story';
game.removeChildren();
blackScreen = game.addChild(LK.getAsset('blackScreen', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
dialogSystem = new DialogSystem();
dialogSystem.x = 1024;
dialogSystem.y = 2532;
game.addChild(dialogSystem);
// Fade in wendigo
LK.setTimeout(function () {
wendigoSprite = game.addChild(LK.getAsset('wendigo', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 6,
scaleY: 6
}));
tween(wendigoSprite, {
alpha: 1
}, {
duration: 2000,
onFinish: function onFinish() {
var act4StartDialogs = [getLocalizedText('act4StartDialog1'), getLocalizedText('act4StartDialog2'), getLocalizedText('act4StartDialog3'), getLocalizedText('act4StartDialog4'), getLocalizedText('act4StartDialog5'), getLocalizedText('act4StartDialog6')];
dialogSystem.showDialog(act4StartDialogs, function () {
startAct4PaintingGame();
});
}
});
}, 1000);
}
function showAct4DarkDialogs() {
// Fade room to black but keep wendigo dialogs
tween(habitacion2Sprite, {
alpha: 0
}, {
duration: 2000
});
// Continue with dark dialogs
var darkDialogs = [getLocalizedText('act4Dialog7'), getLocalizedText('act4Dialog8'), getLocalizedText('act4Dialog9'), getLocalizedText('act4Dialog10')];
dialogSystem.showDialog(darkDialogs, function () {
// End Act 4, return to menu with Act 4 completed
// Fade to black for 2 seconds then return to menu
LK.setTimeout(function () {
currentAct = 4;
storage.currentAct = currentAct;
initializeMenu();
}, 2000);
});
}
function startAct4PaintingGame() {
gameState = 'act4painting';
game.removeChildren();
// Add gray background
background = game.addChild(LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
// Drawing canvas (white, slightly smaller than background)
drawingCanvas = game.addChild(LK.getAsset('canvas', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
// Only pencil tool for Act 4
tools = [getLocalizedText('tools')[0]]; // Only pencil
toolButtons = [];
currentTool = tools[0];
var toolButton = new DrawingTool(tools[0], 150, 320);
game.addChild(toolButton);
toolButtons.push(toolButton);
// Only black color for Act 4
var colorData = [{
asset: 'black',
color: 0x000000
}];
colorSwatches = [];
currentColor = 0x000000;
var colorSwatch = new ColorSwatch(colorData[0].asset, colorData[0].color, 100, 450);
game.addChild(colorSwatch);
colorSwatches.push(colorSwatch);
// Timer display for 1 minute
act4TimeRemaining = 60; // Reset to 1 minute
var minutes = Math.floor(act4TimeRemaining / 60);
var seconds = act4TimeRemaining % 60;
var timeText = getLocalizedText('timeRemaining').replace('___', minutes + ':' + (seconds < 10 ? '0' : '') + seconds);
act4TimerText = new Text2(timeText, {
size: 36,
fill: 0xFFFFFF
});
act4TimerText.anchor.set(0.5, 0);
act4TimerText.x = 1024;
act4TimerText.y = 100;
game.addChild(act4TimerText);
// Start countdown timer
act4Timer = LK.setInterval(function () {
act4TimeRemaining--;
if (act4TimeRemaining <= 0) {
LK.clearInterval(act4Timer);
showAct4Ending();
return;
}
var minutes = Math.floor(act4TimeRemaining / 60);
var seconds = act4TimeRemaining % 60;
var timeText = getLocalizedText('timeRemaining').replace('___', minutes + ':' + (seconds < 10 ? '0' : '') + seconds);
act4TimerText.setText(timeText);
}, 1000);
// Initialize tool selection
updateToolSelection();
strokes = [];
}
function showAct4Ending() {
// Clear timer if still running
if (act4Timer) {
LK.clearInterval(act4Timer);
act4Timer = null;
}
// Fade screen to black
gameState = 'act4ending';
tween(background, {
alpha: 0
}, {
duration: 2000
});
tween(drawingCanvas, {
alpha: 0
}, {
duration: 2000
});
if (act4TimerText) {
tween(act4TimerText, {
alpha: 0
}, {
duration: 2000
});
}
for (var i = 0; i < toolButtons.length; i++) {
tween(toolButtons[i], {
alpha: 0
}, {
duration: 2000
});
}
for (var j = 0; j < colorSwatches.length; j++) {
tween(colorSwatches[j], {
alpha: 0
}, {
duration: 2000
});
}
LK.setTimeout(function () {
game.removeChildren();
blackScreen = game.addChild(LK.getAsset('blackScreen', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
wendigoReadingSprite = game.addChild(LK.getAsset('wendigoleyendo', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 6,
scaleY: 6
}));
dialogSystem = new DialogSystem();
dialogSystem.x = 1024;
dialogSystem.y = 2532;
game.addChild(dialogSystem);
tween(wendigoReadingSprite, {
alpha: 1
}, {
duration: 1000,
onFinish: function onFinish() {
// Show first two negative dialogs
dialogSystem.showDialog([getLocalizedText('act4EndDialog1'), getLocalizedText('act4EndDialog2')], function () {
// Fade out wendigo and show fire
tween(wendigoReadingSprite, {
alpha: 0
}, {
duration: 1000,
onFinish: function onFinish() {
// Show fire asset and play sound
fireSprite = game.addChild(LK.getAsset('fuego', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 8,
scaleY: 8
}));
tween(fireSprite, {
alpha: 1
}, {
duration: 1000
});
// Play fire sound and wait for it to complete
var fireSound = LK.getSound('fueguito');
fireSound.play();
// Fire asset shows for 7 seconds with sound
LK.setTimeout(function () {
// Fade out fire after 7 seconds
tween(fireSprite, {
alpha: 0
}, {
duration: 1000,
onFinish: function onFinish() {
// Show wendigo again
wendigoSprite = game.addChild(LK.getAsset('wendigo', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 6,
scaleY: 6
}));
tween(wendigoSprite, {
alpha: 1
}, {
duration: 1000,
onFinish: function onFinish() {
// Show remaining dialogs
var finalDialogs = [getLocalizedText('act4EndDialog3'), getLocalizedText('act4EndDialog4'), getLocalizedText('act4EndDialog5'), getLocalizedText('act4EndDialog6')];
dialogSystem.showDialog(finalDialogs, function () {
// Fade out wendigo and return to menu
tween(wendigoSprite, {
alpha: 0
}, {
duration: 2000,
onFinish: function onFinish() {
// Continue to Act 4 room sequence instead of returning to menu
startAct4RoomSequence();
}
});
});
}
});
}
});
}, 6000); // Fire asset shows for exactly 6 seconds
}
});
});
}
});
}, 2000);
}
function showFlashlight() {
// Fade out wendigo
tween(wendigoSprite, {
alpha: 0
}, {
duration: 1000,
onFinish: function onFinish() {
// Show flashlight
flashlightSprite = game.addChild(LK.getAsset('linterna', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 8,
scaleY: 8
}));
tween(flashlightSprite, {
alpha: 1
}, {
duration: 2000,
onFinish: function onFinish() {
LK.setTimeout(function () {
// Fade out flashlight and show wendigo again
tween(flashlightSprite, {
alpha: 0
}, {
duration: 1000,
onFinish: function onFinish() {
// Show wendigo again
tween(wendigoSprite, {
alpha: 1
}, {
duration: 1000,
onFinish: function onFinish() {
var finalDialogs = [getLocalizedText('act2Dialog3'), getLocalizedText('act2Dialog4'), getLocalizedText('act2Dialog5')];
dialogSystem.showDialog(finalDialogs, function () {
startForestGame();
});
}
});
}
});
}, 2000);
}
});
}
});
}
function startForestGame() {
gameState = 'forestGame';
game.removeChildren();
// Add forest background
forestSprite = game.addChild(LK.getAsset('bosque', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
scaleX: 20,
scaleY: 18,
tint: 0x111111
}));
// Create mask for darkness effect
lightMask = game.addChild(LK.getAsset('lightCircle', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0.1
}));
// Initialize color objects and counter
collectedColors = 0;
colorObjects = [];
// Add color counter
colorCounter = new Text2(getLocalizedText('colorsCollected') + ': ' + collectedColors + '/4', {
size: 40,
fill: 0xFFFFFF
});
colorCounter.anchor.set(0.5, 0);
colorCounter.x = 1024;
colorCounter.y = 100;
game.addChild(colorCounter);
// Spawn color objects
spawnColorObjects();
}
function spawnColorObjects() {
var colorAssets = ['yellow', 'red', 'green', 'blue'];
var positions = [{
x: 200,
y: 600
}, {
x: 1800,
y: 500
}, {
x: 400,
y: 2000
}, {
x: 1600,
y: 1800
}];
for (var i = 0; i < colorAssets.length; i++) {
var colorObj = game.addChild(LK.getAsset(colorAssets[i], {
anchorX: 0.5,
anchorY: 0.5,
x: positions[i].x,
y: positions[i].y,
scaleX: 1.5,
scaleY: 1.5,
alpha: 0.1,
tint: 0x222222
}));
colorObj.colorType = colorAssets[i];
colorObj.isCollected = false;
colorObjects.push(colorObj);
// Add click handler
colorObj.down = function (x, y, obj) {
if (!this.isCollected && isNearMouse(this)) {
this.isCollected = true;
collectedColors++;
colorCounter.setText(getLocalizedText('colorsCollected') + ': ' + collectedColors + '/4');
// Play sound effect
LK.getSound('ttt').play();
// Make color disappear
tween(this, {
alpha: 0,
scaleX: 0,
scaleY: 0
}, {
duration: 500
});
if (collectedColors >= 4) {
endForestGame();
}
}
};
}
}
function isNearMouse(colorObj) {
// Check if color object is within light circle range
var distance = Math.sqrt((colorObj.x - lightMask.x) * (colorObj.x - lightMask.x) + (colorObj.y - lightMask.y) * (colorObj.y - lightMask.y));
return distance < 200;
}
function endForestGame() {
// Fade everything to black
tween(forestSprite, {
alpha: 0
}, {
duration: 2000
});
tween(lightMask, {
alpha: 0
}, {
duration: 2000
});
tween(colorCounter, {
alpha: 0
}, {
duration: 2000
});
for (var i = 0; i < colorObjects.length; i++) {
tween(colorObjects[i], {
alpha: 0
}, {
duration: 2000
});
}
LK.setTimeout(function () {
// Show wendigo and final dialogs
gameState = 'act2ending';
game.removeChildren();
blackScreen = game.addChild(LK.getAsset('blackScreen', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
wendigoSprite = game.addChild(LK.getAsset('wendigo', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 6,
scaleY: 6
}));
dialogSystem = new DialogSystem();
dialogSystem.x = 1024;
dialogSystem.y = 2532;
game.addChild(dialogSystem);
tween(wendigoSprite, {
alpha: 1
}, {
duration: 1000,
onFinish: function onFinish() {
var endDialogs = [getLocalizedText('act2EndDialog1'), getLocalizedText('act2EndDialog2'), getLocalizedText('act2EndDialog3'), getLocalizedText('act2EndDialog4'), getLocalizedText('act2EndDialog5'), getLocalizedText('act2EndDialog6'), getLocalizedText('act2EndDialog7'), getLocalizedText('act2EndDialog8')];
dialogSystem.showDialog(endDialogs, function () {
// Fade out wendigo and return to menu
tween(wendigoSprite, {
alpha: 0
}, {
duration: 2000,
onFinish: function onFinish() {
currentAct = 3;
storage.currentAct = currentAct;
initializeMenu();
}
});
});
}
});
}, 2000);
}
function startPaintingGame() {
gameState = 'painting';
game.removeChildren();
// Add gray background
background = game.addChild(LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
// Drawing canvas (white, slightly smaller than background)
drawingCanvas = game.addChild(LK.getAsset('canvas', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
// Tool palette
tools = getLocalizedText('tools');
toolButtons = [];
currentTool = tools[0];
for (var i = 0; i < tools.length; i++) {
var toolButton = new DrawingTool(tools[i], 150 + i * 90, 320);
game.addChild(toolButton);
toolButtons.push(toolButton);
}
// Color palette using image assets
var colorData = [{
asset: 'red',
color: 0xFF0000
}, {
asset: 'blue',
color: 0x0000CD
}, {
asset: 'green',
color: 0x7FFF00
}, {
asset: 'yellow',
color: 0xFFD700
}, {
asset: 'black',
color: 0x000000
}];
colorSwatches = [];
currentColor = 0xFF0000;
for (var j = 0; j < colorData.length; j++) {
var colorSwatch = new ColorSwatch(colorData[j].asset, colorData[j].color, 100 + j * 100, 450);
game.addChild(colorSwatch);
colorSwatches.push(colorSwatch);
}
// Send button
sendButton = new MenuButton(getLocalizedText('sendButton'), 1800, 1200, function () {
showEnding();
});
game.addChild(sendButton);
// Initialize tool selection
updateToolSelection();
strokes = [];
}
function startAct3PaintingGame() {
gameState = 'act3painting';
game.removeChildren();
// Add gray background
background = game.addChild(LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
// Drawing canvas (white, slightly smaller than background)
drawingCanvas = game.addChild(LK.getAsset('canvas', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
// Tool palette
tools = getLocalizedText('tools');
toolButtons = [];
currentTool = tools[0];
for (var i = 0; i < tools.length; i++) {
var toolButton = new DrawingTool(tools[i], 150 + i * 90, 320);
game.addChild(toolButton);
toolButtons.push(toolButton);
}
// Only black color for Act 3
var colorData = [{
asset: 'black',
color: 0x000000
}];
colorSwatches = [];
currentColor = 0x000000;
var colorSwatch = new ColorSwatch(colorData[0].asset, colorData[0].color, 100, 450);
game.addChild(colorSwatch);
colorSwatches.push(colorSwatch);
// Timer display
act3TimeRemaining = 120; // Reset to 2 minutes
var minutes = Math.floor(act3TimeRemaining / 60);
var seconds = act3TimeRemaining % 60;
var timeText = getLocalizedText('timeRemaining').replace('___', minutes + ':' + (seconds < 10 ? '0' : '') + seconds);
act3TimerText = new Text2(timeText, {
size: 36,
fill: 0xFFFFFF
});
act3TimerText.anchor.set(0.5, 0);
act3TimerText.x = 1024;
act3TimerText.y = 100;
game.addChild(act3TimerText);
// Start countdown timer
act3Timer = LK.setInterval(function () {
act3TimeRemaining--;
if (act3TimeRemaining <= 0) {
LK.clearInterval(act3Timer);
showAct3Ending();
return;
}
var minutes = Math.floor(act3TimeRemaining / 60);
var seconds = act3TimeRemaining % 60;
var timeText = getLocalizedText('timeRemaining').replace('___', minutes + ':' + (seconds < 10 ? '0' : '') + seconds);
act3TimerText.setText(timeText);
}, 1000);
// Initialize tool selection
updateToolSelection();
strokes = [];
}
function showEnding() {
gameState = 'ending';
game.removeChildren();
blackScreen = game.addChild(LK.getAsset('blackScreen', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
wendigoReadingSprite = game.addChild(LK.getAsset('wendigoleyendo', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 6,
scaleY: 6
}));
dialogSystem = new DialogSystem();
dialogSystem.x = 1024;
dialogSystem.y = 2532;
game.addChild(dialogSystem);
tween(wendigoReadingSprite, {
alpha: 1
}, {
duration: 1000,
onFinish: function onFinish() {
dialogSystem.showDialog([getLocalizedText('dialog5')], function () {
// Immediately start fade to black and return to menu after dialog completes
gameState = 'fadingOut';
tween(wendigoReadingSprite, {
alpha: 0
}, {
duration: 2000,
onFinish: function onFinish() {
// Update act and return to menu
currentAct = 2;
storage.currentAct = currentAct;
initializeMenu();
}
});
});
}
});
}
function showAct3Ending() {
// Clear timer if still running
if (act3Timer) {
LK.clearInterval(act3Timer);
act3Timer = null;
}
// Fade screen to black
gameState = 'act3ending';
tween(background, {
alpha: 0
}, {
duration: 2000
});
tween(drawingCanvas, {
alpha: 0
}, {
duration: 2000
});
if (act3TimerText) {
tween(act3TimerText, {
alpha: 0
}, {
duration: 2000
});
}
for (var i = 0; i < toolButtons.length; i++) {
tween(toolButtons[i], {
alpha: 0
}, {
duration: 2000
});
}
for (var j = 0; j < colorSwatches.length; j++) {
tween(colorSwatches[j], {
alpha: 0
}, {
duration: 2000
});
}
LK.setTimeout(function () {
game.removeChildren();
blackScreen = game.addChild(LK.getAsset('blackScreen', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
wendigoSprite = game.addChild(LK.getAsset('wendigo', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 6,
scaleY: 6
}));
dialogSystem = new DialogSystem();
dialogSystem.x = 1024;
dialogSystem.y = 2532;
game.addChild(dialogSystem);
tween(wendigoSprite, {
alpha: 1
}, {
duration: 1000,
onFinish: function onFinish() {
// Show first dialog with wendigo
dialogSystem.showDialog([getLocalizedText('act3EndDialog1')], function () {
// Switch to wendigoleyendo for middle dialogs
tween(wendigoSprite, {
alpha: 0
}, {
duration: 500,
onFinish: function onFinish() {
wendigoReadingSprite = game.addChild(LK.getAsset('wendigoleyendo', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 6,
scaleY: 6
}));
tween(wendigoReadingSprite, {
alpha: 1
}, {
duration: 500,
onFinish: function onFinish() {
// Show middle dialogs with wendigoleyendo
var middleDialogs = [getLocalizedText('act3EndDialog2'), getLocalizedText('act3EndDialog3'), getLocalizedText('act3EndDialog4'), getLocalizedText('act3EndDialog5'), getLocalizedText('act3EndDialog6')];
dialogSystem.showDialog(middleDialogs, function () {
// Switch back to wendigo for final dialog
tween(wendigoReadingSprite, {
alpha: 0
}, {
duration: 500,
onFinish: function onFinish() {
tween(wendigoSprite, {
alpha: 1
}, {
duration: 500,
onFinish: function onFinish() {
// Show final dialog with wendigo
dialogSystem.showDialog([getLocalizedText('act3EndDialog7')], function () {
// Fade out wendigo but continue with room sequence instead of returning to menu
tween(wendigoSprite, {
alpha: 0
}, {
duration: 2000,
onFinish: function onFinish() {
// Continue to room sequence
startRoomSequence();
}
});
});
}
});
}
});
});
}
});
}
});
});
}
});
}, 2000);
}
function startRoomSequence() {
// Start room sequence after Act 3 ending
game.removeChildren();
blackScreen = game.addChild(LK.getAsset('blackScreen', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
// Slowly fade in habitacion1
LK.setTimeout(function () {
habitacion1Sprite = game.addChild(LK.getAsset('habitacion1', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 20,
scaleY: 18
}));
// Fade in habitacion1
tween(habitacion1Sprite, {
alpha: 1
}, {
duration: 3000
});
// After 5 seconds, fade to black then show habitacion2
LK.setTimeout(function () {
tween(habitacion1Sprite, {
alpha: 0
}, {
duration: 2000,
onFinish: function onFinish() {
LK.setTimeout(function () {
habitacion2Sprite = game.addChild(LK.getAsset('habitacion2', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 20,
scaleY: 18
}));
// Fade in habitacion2
tween(habitacion2Sprite, {
alpha: 1
}, {
duration: 2000,
onFinish: function onFinish() {
// Wait 1 second then start dialogs
LK.setTimeout(function () {
dialogSystem = new DialogSystem();
dialogSystem.x = 1024;
dialogSystem.y = 2532;
game.addChild(dialogSystem);
var firstDialogs = [getLocalizedText('act4Dialog1'), getLocalizedText('act4Dialog2'), getLocalizedText('act4Dialog3'), getLocalizedText('act4Dialog4'), getLocalizedText('act4Dialog5'), getLocalizedText('act4Dialog6')];
dialogSystem.showDialog(firstDialogs, function () {
showRoomDarkDialogs();
});
}, 1000);
}
});
}, 1000);
}
});
}, 5000);
}, 1000);
}
function showRoomDarkDialogs() {
// Fade room to black but keep dialogs
tween(habitacion2Sprite, {
alpha: 0
}, {
duration: 2000
});
// Continue with dark dialogs
var darkDialogs = [getLocalizedText('act4Dialog7'), getLocalizedText('act4Dialog8'), getLocalizedText('act4Dialog9'), getLocalizedText('act4Dialog10')];
dialogSystem.showDialog(darkDialogs, function () {
// End Act 3, return to menu with Act 4 available
LK.setTimeout(function () {
currentAct = 4;
storage.currentAct = currentAct;
initializeMenu();
}, 2000);
});
}
function startAct5() {
gameState = 'act5story';
game.removeChildren();
blackScreen = game.addChild(LK.getAsset('blackScreen', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
dialogSystem = new DialogSystem();
dialogSystem.x = 1024;
dialogSystem.y = 2532;
game.addChild(dialogSystem);
// Fade in wendigo
LK.setTimeout(function () {
wendigoSprite = game.addChild(LK.getAsset('wendigo', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 6,
scaleY: 6
}));
tween(wendigoSprite, {
alpha: 1
}, {
duration: 2000,
onFinish: function onFinish() {
var act5Dialogs = [getLocalizedText('act5Dialog1'), getLocalizedText('act5Dialog2'), getLocalizedText('act5Dialog3'), getLocalizedText('act5Dialog4'), getLocalizedText('act5Dialog5'), getLocalizedText('act5Dialog6'), getLocalizedText('act5Dialog7'), getLocalizedText('act5Dialog8')];
dialogSystem.showDialog(act5Dialogs, function () {
startAct5PaintingGame();
});
}
});
}, 1000);
}
function startAct5PaintingGame() {
gameState = 'act5painting';
game.removeChildren();
// Add gray background
background = game.addChild(LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
// Drawing canvas (white, slightly smaller than background)
drawingCanvas = game.addChild(LK.getAsset('canvas', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
// All tools available for Act 5
tools = getLocalizedText('tools'); // All tools
toolButtons = [];
currentTool = tools[0];
for (var i = 0; i < tools.length; i++) {
var toolButton = new DrawingTool(tools[i], 150 + i * 90, 320);
game.addChild(toolButton);
toolButtons.push(toolButton);
}
// Only black color for Act 5
var colorData = [{
asset: 'black',
color: 0x000000
}];
colorSwatches = [];
currentColor = 0x000000;
var colorSwatch = new ColorSwatch(colorData[0].asset, colorData[0].color, 100, 450);
game.addChild(colorSwatch);
colorSwatches.push(colorSwatch);
// Send button - final submission
sendButton = new MenuButton(getLocalizedText('sendButton'), 1800, 1200, function () {
showAct5Ending();
});
game.addChild(sendButton);
// Initialize tool selection
updateToolSelection();
strokes = [];
}
function showAct5Ending() {
gameState = 'act5ending';
// Fade to black and show final message
tween(background, {
alpha: 0
}, {
duration: 2000
});
tween(drawingCanvas, {
alpha: 0
}, {
duration: 2000
});
for (var i = 0; i < toolButtons.length; i++) {
tween(toolButtons[i], {
alpha: 0
}, {
duration: 2000
});
}
for (var j = 0; j < colorSwatches.length; j++) {
tween(colorSwatches[j], {
alpha: 0
}, {
duration: 2000
});
}
if (sendButton) {
tween(sendButton, {
alpha: 0
}, {
duration: 2000
});
}
LK.setTimeout(function () {
game.removeChildren();
blackScreen = game.addChild(LK.getAsset('blackScreen', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
wendigoReadingSprite = game.addChild(LK.getAsset('wendigoleyendo', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 6,
scaleY: 6
}));
dialogSystem = new DialogSystem();
dialogSystem.x = 1024;
dialogSystem.y = 2532;
game.addChild(dialogSystem);
tween(wendigoReadingSprite, {
alpha: 1
}, {
duration: 1000,
onFinish: function onFinish() {
var endDialogs = [getLocalizedText('act5EndDialog1'), getLocalizedText('act5EndDialog2'), getLocalizedText('act5EndDialog3'), getLocalizedText('act5EndDialog4'), getLocalizedText('act5EndDialog5')];
dialogSystem.showDialog(endDialogs, function () {
showAct5Choices();
});
}
});
}, 2000);
}
function startAct4RoomSequence() {
// Start room sequence after Act 4 ending
game.removeChildren();
blackScreen = game.addChild(LK.getAsset('blackScreen', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
// Slowly fade in habitacion1
LK.setTimeout(function () {
habitacion1Sprite = game.addChild(LK.getAsset('habitacion1', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 20,
scaleY: 18
}));
// Fade in habitacion1
tween(habitacion1Sprite, {
alpha: 1
}, {
duration: 3000
});
// After 5 seconds, fade habitacion1 to black then show habitacion2
LK.setTimeout(function () {
tween(habitacion1Sprite, {
alpha: 0
}, {
duration: 2000,
onFinish: function onFinish() {
habitacion2Sprite = game.addChild(LK.getAsset('habitacion2', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 20,
scaleY: 18
}));
// Fade in habitacion2
tween(habitacion2Sprite, {
alpha: 1
}, {
duration: 2000,
onFinish: function onFinish() {
// Start new dialogs (without wendigo sprite)
dialogSystem = new DialogSystem();
dialogSystem.x = 1024;
dialogSystem.y = 2532;
game.addChild(dialogSystem);
var newActRoomDialogs = [getLocalizedText('act4RoomDialog1'), getLocalizedText('act4RoomDialog2'), getLocalizedText('act4RoomDialog3'), getLocalizedText('act4RoomDialog4'), getLocalizedText('act4RoomDialog5'), getLocalizedText('act4RoomDialog6'), getLocalizedText('act4RoomDialog7'), getLocalizedText('act4RoomDialog8'), getLocalizedText('act4RoomDialog9'), getLocalizedText('act4RoomDialog10')];
dialogSystem.showDialog(newActRoomDialogs, function () {
// After dialogs complete, update to Act 5 and return to menu
currentAct = 5;
storage.currentAct = currentAct;
initializeMenu();
});
}
});
}
});
}, 5000);
}, 1000);
}
function updateToolSelection() {
for (var i = 0; i < toolButtons.length; i++) {
toolButtons[i].setActive(toolButtons[i].toolType === currentTool);
}
}
function updateColorSelection() {
// Visual feedback for color selection could be added here
}
function isPointInCanvas(x, y) {
if (!drawingCanvas) return false;
var canvasLeft = drawingCanvas.x - drawingCanvas.width * 0.5;
var canvasRight = drawingCanvas.x + drawingCanvas.width * 0.5;
var canvasTop = drawingCanvas.y - drawingCanvas.height * 0.5;
var canvasBottom = drawingCanvas.y + drawingCanvas.height * 0.5;
return x >= canvasLeft && x <= canvasRight && y >= canvasTop && y <= canvasBottom;
}
function isPointInButton(x, y) {
if (gameState !== 'painting') return false;
// Check tool buttons
for (var i = 0; i < toolButtons.length; i++) {
var button = toolButtons[i];
var buttonLeft = button.x - 40;
var buttonRight = button.x + 40;
var buttonTop = button.y - 40;
var buttonBottom = button.y + 40;
if (x >= buttonLeft && x <= buttonRight && y >= buttonTop && y <= buttonBottom) {
return true;
}
}
// Check color swatches
for (var j = 0; j < colorSwatches.length; j++) {
var swatch = colorSwatches[j];
var swatchLeft = swatch.x - 50;
var swatchRight = swatch.x + 50;
var swatchTop = swatch.y - 33;
var swatchBottom = swatch.y + 33;
if (x >= swatchLeft && x <= swatchRight && y >= swatchTop && y <= swatchBottom) {
return true;
}
}
return false;
}
function addBrushStroke(x, y) {
if (isPointInCanvas(x, y)) {
// Convert game coordinates to canvas-local coordinates
var canvasLocalX = x - drawingCanvas.x;
var canvasLocalY = y - drawingCanvas.y;
console.log("Creating brush stroke with color: 0x" + currentColor.toString(16));
var stroke = new BrushStroke(canvasLocalX, canvasLocalY, currentColor, brushSize);
drawingCanvas.addChild(stroke);
strokes.push(stroke);
if (Math.random() < 0.3) {
LK.getSound('drawSound').play();
}
}
}
function addAerographStroke(x, y) {
if (isPointInCanvas(x, y)) {
// Convert game coordinates to canvas-local coordinates
var canvasLocalX = x - drawingCanvas.x;
var canvasLocalY = y - drawingCanvas.y;
// Create spray pattern
var sprayRadius = 30;
var sprayCount = 8;
for (var i = 0; i < sprayCount; i++) {
var angle = Math.random() * 2 * Math.PI;
var distance = Math.random() * sprayRadius;
var sprayX = canvasLocalX + Math.cos(angle) * distance;
var sprayY = canvasLocalY + Math.sin(angle) * distance;
var stroke = new BrushStroke(sprayX, sprayY, currentColor, brushSize * 0.6);
drawingCanvas.addChild(stroke);
strokes.push(stroke);
}
}
}
function floodFill(startX, startY, fillColor) {
// Convert game coordinates to canvas-local coordinates
var canvasLocalX = startX - drawingCanvas.x;
var canvasLocalY = startY - drawingCanvas.y;
// Find enclosed area and fill it completely
var canvasLeft = -drawingCanvas.width * 0.5;
var canvasRight = drawingCanvas.width * 0.5;
var canvasTop = -drawingCanvas.height * 0.5;
var canvasBottom = drawingCanvas.height * 0.5;
var visited = {};
var toFill = [];
var stack = [{
x: Math.floor(canvasLocalX),
y: Math.floor(canvasLocalY)
}];
while (stack.length > 0 && toFill.length < 2000) {
var point = stack.pop();
var key = point.x + ',' + point.y;
if (visited[key] || point.x < canvasLeft || point.x > canvasRight || point.y < canvasTop || point.y > canvasBottom) continue;
visited[key] = true;
// Check if there's a stroke nearby (acts as border)
var hasNearbyStroke = false;
for (var i = 0; i < strokes.length; i++) {
var stroke = strokes[i];
var distance = Math.sqrt((stroke.x - point.x) * (stroke.x - point.x) + (stroke.y - point.y) * (stroke.y - point.y));
if (distance < 15) {
hasNearbyStroke = true;
break;
}
}
if (!hasNearbyStroke) {
toFill.push({
x: point.x,
y: point.y
});
// Add neighboring points with smaller steps for solid fill
var neighbors = [{
x: point.x + 8,
y: point.y
}, {
x: point.x - 8,
y: point.y
}, {
x: point.x,
y: point.y + 8
}, {
x: point.x,
y: point.y - 8
}];
for (var j = 0; j < neighbors.length; j++) {
stack.push(neighbors[j]);
}
}
}
// Fill the area with solid color
for (var k = 0; k < toFill.length; k++) {
var fillStroke = new BrushStroke(toFill[k].x, toFill[k].y, fillColor, 12);
drawingCanvas.addChild(fillStroke);
strokes.push(fillStroke);
}
}
// Event handlers
game.down = function (x, y, obj) {
if (gameState === 'story' && dialogSystem && dialogSystem.visible) {
dialogSystem.nextDialog();
return;
}
if (gameState === 'ending' && dialogSystem && dialogSystem.visible) {
dialogSystem.nextDialog();
return;
}
if ((gameState === 'act2story' || gameState === 'act2ending') && dialogSystem && dialogSystem.visible) {
dialogSystem.nextDialog();
return;
}
if ((gameState === 'act3story' || gameState === 'act3ending') && dialogSystem && dialogSystem.visible) {
dialogSystem.nextDialog();
return;
}
if ((gameState === 'act4story' || gameState === 'act4ending') && dialogSystem && dialogSystem.visible) {
dialogSystem.nextDialog();
return;
}
if (gameState === 'act5story' && dialogSystem && dialogSystem.visible) {
dialogSystem.nextDialog();
return;
}
if (gameState === 'act5ending' && dialogSystem && dialogSystem.visible) {
dialogSystem.nextDialog();
return;
}
if (gameState === 'act5leave' && dialogSystem && dialogSystem.visible) {
dialogSystem.nextDialog();
return;
}
if (gameState === 'act5stay' && dialogSystem && dialogSystem.visible) {
dialogSystem.nextDialog();
return;
}
if (gameState !== 'painting' && gameState !== 'act3painting' && gameState !== 'act4painting' && gameState !== 'act5painting') return;
if (isPointInButton(x, y)) {
return;
}
if (isPointInCanvas(x, y)) {
if (currentTool === tools[4] || currentTool === tools[5] || currentTool === tools[6]) {
// Line, Rectangle, Circle
isDrawingShape = true;
shapeStartX = x;
shapeStartY = y;
} else {
isDrawing = true;
}
lastDrawX = x;
lastDrawY = y;
if (currentTool === tools[0]) {
// Pencil/Lápiz
addBrushStroke(x, y);
} else if (currentTool === tools[1]) {
// Airbrush/Aerógrafo
addAerographStroke(x, y);
} else if (currentTool === tools[2]) {
// Eraser/Borrador
// Convert game coordinates to canvas-local coordinates for eraser
var canvasLocalX = x - drawingCanvas.x;
var canvasLocalY = y - drawingCanvas.y;
// Find and remove nearby strokes
for (var i = strokes.length - 1; i >= 0; i--) {
var stroke = strokes[i];
var distance = Math.sqrt((stroke.x - canvasLocalX) * (stroke.x - canvasLocalX) + (stroke.y - canvasLocalY) * (stroke.y - canvasLocalY));
if (distance < brushSize) {
stroke.destroy();
strokes.splice(i, 1);
}
}
} else if (currentTool === tools[3]) {
// Bucket/Cubeta
floodFill(x, y, currentColor);
}
}
};
game.move = function (x, y, obj) {
// Handle forest game light mask movement
if (gameState === 'forestGame' && lightMask) {
lightMask.x = x;
lightMask.y = y;
// Update color object visibility based on light position
for (var i = 0; i < colorObjects.length; i++) {
if (!colorObjects[i].isCollected) {
if (isNearMouse(colorObjects[i])) {
colorObjects[i].alpha = 1.0;
colorObjects[i].tint = 0xFFFFFF;
} else {
colorObjects[i].alpha = 0.05;
colorObjects[i].tint = 0x111111;
}
}
}
return;
}
if (gameState !== 'painting' && gameState !== 'act3painting' && gameState !== 'act4painting' && gameState !== 'act5painting' || !isDrawing || !isPointInCanvas(x, y)) return;
if (currentTool === tools[0]) {
// Pencil/Lápiz
// Draw line between last position and current position
var distance = Math.sqrt((x - lastDrawX) * (x - lastDrawX) + (y - lastDrawY) * (y - lastDrawY));
var steps = Math.floor(distance / 10);
for (var i = 0; i <= steps; i++) {
var interpolatedX = lastDrawX + (x - lastDrawX) * (i / steps);
var interpolatedY = lastDrawY + (y - lastDrawY) * (i / steps);
addBrushStroke(interpolatedX, interpolatedY);
}
} else if (currentTool === tools[1]) {
// Airbrush/Aerógrafo
// Continue aerograph spray
var distance = Math.sqrt((x - lastDrawX) * (x - lastDrawX) + (y - lastDrawY) * (y - lastDrawY));
var steps = Math.floor(distance / 15);
for (var i = 0; i <= steps; i++) {
var interpolatedX = lastDrawX + (x - lastDrawX) * (i / steps);
var interpolatedY = lastDrawY + (y - lastDrawY) * (i / steps);
addAerographStroke(interpolatedX, interpolatedY);
}
} else if (currentTool === tools[2]) {
// Eraser/Borrador
// Convert game coordinates to canvas-local coordinates for eraser
var canvasLocalX = x - drawingCanvas.x;
var canvasLocalY = y - drawingCanvas.y;
// Continue erasing
for (var j = strokes.length - 1; j >= 0; j--) {
var stroke = strokes[j];
var distance = Math.sqrt((stroke.x - canvasLocalX) * (stroke.x - canvasLocalX) + (stroke.y - canvasLocalY) * (stroke.y - canvasLocalY));
if (distance < brushSize) {
stroke.destroy();
strokes.splice(j, 1);
}
}
}
lastDrawX = x;
lastDrawY = y;
};
game.up = function (x, y, obj) {
if (gameState !== 'painting' && gameState !== 'act3painting' && gameState !== 'act4painting' && gameState !== 'act5painting') return;
if (isDrawingShape && isPointInCanvas(x, y)) {
if (currentTool === tools[4]) {
// Line/Línea
// Draw line from start to end
var distance = Math.sqrt((x - shapeStartX) * (x - shapeStartX) + (y - shapeStartY) * (y - shapeStartY));
var steps = Math.floor(distance / 5);
for (var i = 0; i <= steps; i++) {
var lineX = shapeStartX + (x - shapeStartX) * (i / steps);
var lineY = shapeStartY + (y - shapeStartY) * (i / steps);
// Convert to canvas-local coordinates
var canvasLocalX = lineX - drawingCanvas.x;
var canvasLocalY = lineY - drawingCanvas.y;
var lineStroke = new BrushStroke(canvasLocalX, canvasLocalY, currentColor, brushSize);
drawingCanvas.addChild(lineStroke);
strokes.push(lineStroke);
}
} else if (currentTool === tools[5]) {
// Rectangle/Rectángulo
// Draw rectangle outline
var rectWidth = Math.abs(x - shapeStartX);
var rectHeight = Math.abs(y - shapeStartY);
var minX = Math.min(shapeStartX, x);
var minY = Math.min(shapeStartY, y);
// Top and bottom lines
for (var j = 0; j <= rectWidth; j += 10) {
// Convert to canvas-local coordinates
var topCanvasX = minX + j - drawingCanvas.x;
var topCanvasY = minY - drawingCanvas.y;
var bottomCanvasX = minX + j - drawingCanvas.x;
var bottomCanvasY = minY + rectHeight - drawingCanvas.y;
var topStroke = new BrushStroke(topCanvasX, topCanvasY, currentColor, brushSize);
var bottomStroke = new BrushStroke(bottomCanvasX, bottomCanvasY, currentColor, brushSize);
drawingCanvas.addChild(topStroke);
drawingCanvas.addChild(bottomStroke);
strokes.push(topStroke);
strokes.push(bottomStroke);
}
// Left and right lines
for (var k = 0; k <= rectHeight; k += 10) {
// Convert to canvas-local coordinates
var leftCanvasX = minX - drawingCanvas.x;
var leftCanvasY = minY + k - drawingCanvas.y;
var rightCanvasX = minX + rectWidth - drawingCanvas.x;
var rightCanvasY = minY + k - drawingCanvas.y;
var leftStroke = new BrushStroke(leftCanvasX, leftCanvasY, currentColor, brushSize);
var rightStroke = new BrushStroke(rightCanvasX, rightCanvasY, currentColor, brushSize);
drawingCanvas.addChild(leftStroke);
drawingCanvas.addChild(rightStroke);
strokes.push(leftStroke);
strokes.push(rightStroke);
}
} else if (currentTool === tools[6]) {
// Circle/Círculo
// Draw circle
var centerX = (shapeStartX + x) / 2;
var centerY = (shapeStartY + y) / 2;
var radius = Math.sqrt((x - shapeStartX) * (x - shapeStartX) + (y - shapeStartY) * (y - shapeStartY)) / 2;
var circumference = 2 * Math.PI * radius;
var steps = Math.floor(circumference / 8);
for (var l = 0; l < steps; l++) {
var angle = l / steps * 2 * Math.PI;
var circleX = centerX + Math.cos(angle) * radius;
var circleY = centerY + Math.sin(angle) * radius;
// Convert to canvas-local coordinates
var canvasLocalX = circleX - drawingCanvas.x;
var canvasLocalY = circleY - drawingCanvas.y;
var circleStroke = new BrushStroke(canvasLocalX, canvasLocalY, currentColor, brushSize);
drawingCanvas.addChild(circleStroke);
strokes.push(circleStroke);
}
}
}
isDrawing = false;
isDrawingShape = false;
};
// Add keyboard event listener for space key
LK.on('keydown', function (event) {
if (event.key === ' ' || event.code === 'Space') {
if (gameState === 'story' && dialogSystem && dialogSystem.visible) {
dialogSystem.nextDialog();
}
}
});
// Initialize the game
// Reset to act 1 on first load
currentAct = 1;
storage.currentAct = 1;
initializeMenu();
// Main game loop
game.update = function () {
// Game update loop
};
function showAct5Choices() {
// Remove dialog system and show choice buttons
dialogSystem.visible = false;
var leaveButton = new MenuButton('IRNOS', 1024, 1800, function () {
showAct5LeaveEnding();
});
game.addChild(leaveButton);
var stayButton = new MenuButton('QUEDARNOS', 1024, 1950, function () {
showAct5StayEnding();
});
game.addChild(stayButton);
}
function showAct5LeaveEnding() {
game.removeChildren();
// Show end1 asset
var end1Sprite = game.addChild(LK.getAsset('end1', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 20,
scaleY: 18
}));
tween(end1Sprite, {
alpha: 1
}, {
duration: 1000,
onFinish: function onFinish() {
LK.setTimeout(function () {
tween(end1Sprite, {
alpha: 0
}, {
duration: 1000,
onFinish: function onFinish() {
// Show end2 asset
var end2Sprite = game.addChild(LK.getAsset('end2', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 20,
scaleY: 18
}));
tween(end2Sprite, {
alpha: 1
}, {
duration: 1000,
onFinish: function onFinish() {
// Show leave dialogs without wendigo sprite
gameState = 'act5leave';
dialogSystem = new DialogSystem();
dialogSystem.x = 1024;
dialogSystem.y = 2532;
game.addChild(dialogSystem);
var leaveDialogs = [getLocalizedText('act5LeaveDialog1'), getLocalizedText('act5LeaveDialog2'), getLocalizedText('act5LeaveDialog3'), getLocalizedText('act5LeaveDialog4'), getLocalizedText('act5LeaveDialog5'), getLocalizedText('act5LeaveDialog6'), getLocalizedText('act5LeaveDialog7'), getLocalizedText('act5LeaveDialog8'), getLocalizedText('act5LeaveDialog9')];
dialogSystem.showDialog(leaveDialogs, function () {
showFinalWhiteSequence();
});
}
});
}
});
}, 5000);
}
});
}
function showAct5LeaveDialogs() {
gameState = 'act5leave';
}
function showFinalWhiteSequence() {
// White screen fade in
var whiteScreen = game.addChild(LK.getAsset('canvas', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 3,
scaleY: 3,
tint: 0xFFFFFF
}));
// Play pip sound and fade in white
var pipSound = LK.getSound('pip');
pipSound.play();
tween(whiteScreen, {
alpha: 1
}, {
duration: 1000
});
// Wait for 15 seconds total for white screen duration
LK.setTimeout(function () {
game.removeChildren();
var blackScreen = game.addChild(LK.getAsset('blackScreen', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
// Show BLACKPAINT asset growing for 15 seconds
var blackPaintSprite = game.addChild(LK.getAsset('BLACKPAINT', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 1,
scaleY: 1
}));
tween(blackPaintSprite, {
alpha: 1
}, {
duration: 1000,
onFinish: function onFinish() {
tween(blackPaintSprite, {
scaleX: 15,
scaleY: 15
}, {
duration: 15000,
onFinish: function onFinish() {
tween(blackPaintSprite, {
alpha: 0
}, {
duration: 2000,
onFinish: function onFinish() {
// Game ends, return to menu
initializeMenu();
}
});
}
});
}
});
}, 23000); // White screen lasts for exactly 23 seconds
}
function showAct5StayEnding() {
game.removeChildren();
// Show wendi3 asset
var wendi3Sprite = game.addChild(LK.getAsset('wendi3', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 20,
scaleY: 18
}));
tween(wendi3Sprite, {
alpha: 1
}, {
duration: 2000,
onFinish: function onFinish() {
gameState = 'act5stay';
dialogSystem = new DialogSystem();
dialogSystem.x = 1024;
dialogSystem.y = 2532;
game.addChild(dialogSystem);
var stayDialogs1 = [getLocalizedText('act5StayDialog1'), getLocalizedText('act5StayDialog2'), getLocalizedText('act5StayDialog3'), getLocalizedText('act5StayDialog4'), getLocalizedText('act5StayDialog5'), getLocalizedText('act5StayDialog6'), getLocalizedText('act5StayDialog7')];
dialogSystem.showDialog(stayDialogs1, function () {
// Fade out wendi3 with black background
var blackTransition1 = game.addChild(LK.getAsset('blackScreen', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0
}));
tween(wendi3Sprite, {
alpha: 0
}, {
duration: 1000
});
tween(blackTransition1, {
alpha: 1
}, {
duration: 1000,
onFinish: function onFinish() {
var skullSprite = game.addChild(LK.getAsset('craneo', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 8,
scaleY: 8
}));
tween(skullSprite, {
alpha: 1
}, {
duration: 1000,
onFinish: function onFinish() {
// Recreate dialog system to ensure it's properly attached
dialogSystem = new DialogSystem();
dialogSystem.x = 1024;
dialogSystem.y = 2532;
game.addChild(dialogSystem);
// Show dialog while skull is visible
dialogSystem.showDialog(['Wendigo: "te obsequio esto, es el cráneo de mi padre, creo que te mencione que era un antílope, no suelo comer huesos, así que lo guarde para un momento especial, y creo que este es ese momento pequeño artista"'], function () {
// On click, fade out skull and black background, show wendi3
tween(skullSprite, {
alpha: 0
}, {
duration: 1000
});
tween(blackTransition1, {
alpha: 0
}, {
duration: 1000,
onFinish: function onFinish() {
// Show wendi3 again at full screen
tween(wendi3Sprite, {
alpha: 1
}, {
duration: 1000,
onFinish: function onFinish() {
var finalDialogs = [getLocalizedText('act5StayDialog9'), getLocalizedText('act5StayDialog10')];
dialogSystem.showDialog(finalDialogs, function () {
showFinalBlackPaintSequence();
});
}
});
}
});
});
}
});
}
});
});
}
});
}
function showFinalBlackPaintSequence() {
// Fade everything to black
var blackScreen = game.addChild(LK.getAsset('blackScreen', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0
}));
tween(blackScreen, {
alpha: 1
}, {
duration: 2000,
onFinish: function onFinish() {
// Show BLACKPAINT asset growing for 15 seconds
var blackPaintSprite = game.addChild(LK.getAsset('BLACKPAINT', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
alpha: 0,
scaleX: 1,
scaleY: 1
}));
tween(blackPaintSprite, {
alpha: 1
}, {
duration: 1000,
onFinish: function onFinish() {
tween(blackPaintSprite, {
scaleX: 15,
scaleY: 15
}, {
duration: 15000,
onFinish: function onFinish() {
tween(blackPaintSprite, {
alpha: 0
}, {
duration: 2000,
onFinish: function onFinish() {
// Game ends, return to menu
initializeMenu();
}
});
}
});
}
});
}
});
}