User prompt
quedo el titulo 99 noches en el cerro de mi tio el ciervo, saca ese texto
User prompt
saca el texto de 99 en el cerro de mi tio el ciervo y pone 99 nights in the forest y en español 99 noches en el bosque
User prompt
que el titulo en el menu sea 99 nights in the forest y en español es 99 noches en el bosque
User prompt
que el titulo en el menu sea 99 noches en el cerro de mi tio el ciervo
User prompt
que el boton tutorial solo este en el menu
User prompt
ahora un boton abajo de tutorial para cambiar el idioma a español o ingles, si pones español todos los textos van a estar en español si pones en ingles todoslos textos van a estar en ingles ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
pero el boton de tutorial abajo de todo
User prompt
en el menu que alla un tutorial de los controles y como jugar
User prompt
cambia el fondo del menu por un bosque oscuro
User prompt
que alla un boton en la esquina superior derecha para volver al menu
User prompt
que alla un boton para volver al menu
User prompt
en el modo hardcore el ciervo se queda esperandome en el armario, cuando yo entre a un armario el ciervo se va
User prompt
en el modo facil que alla 4 llaves en el modo medio 6 llaves y en el modo hardcore 10 llaves
User prompt
solo puedo tener una llave a la vez y si consigo otra llave que se quede en el piso asi si yo uso mi llave y paso arriba de la llave que deje en el piso la agarre
User prompt
que si o si en los 10 cofres que hay en el mapa 4 de ellos tengan llaves y cuando abras un cofre y te de llave cuando ya tienes llave que la llave se quede en el piso
User prompt
que puedas en el menu elegir la dificultad facil, que es la que tenemoshasta ahora, la media que tenes que salvar a 6 niños y el ciervo va mas rapido y hardcore, tenes que salvar a 10 niños, solo hay 2 armarios, el ciervo va mas rapido que en la media y el ciervo es cambiado por la imagen llamada hardcore
User prompt
que el ciervo salga de la cueva
User prompt
que el chest sea remplazado por la imagen llamada cofre y lo mismo con el armario
User prompt
en el menu que este la imagen llamada menu arriba de el titulo
User prompt
hazle menu al juego
User prompt
cuando estoy en un armario el ciervo no me puede matar
User prompt
solo podemos tener una llave a la vez
User prompt
que alla un boton para prender la linterna
User prompt
que la linterna se active tocando caminar 5
User prompt
que allan 4 armarios por el mapa y entras a un armario tocando caminar 3 veces y te deja de seguir el ciervo y para salir del armario tocas caminar 3 veces ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Chest = Container.expand(function (containsKey) { var self = Container.call(this); var chestGraphics = self.attachAsset('village', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.3, scaleY: 0.3 }); chestGraphics.tint = 0x8B4513; // Brown color for chest self.collected = false; self.containsKey = containsKey || false; self.batteryAmount = 50; self.collect = function () { if (!self.collected) { self.collected = true; self.visible = false; if (self.containsKey) { player.keyCount++; LK.setScore(LK.getScore() + 10); } else { player.batteryLevel = Math.min(100, player.batteryLevel + self.batteryAmount); LK.setScore(LK.getScore() + 15); } } }; return self; }); var Child = Container.expand(function (childName) { var self = Container.call(this); var childGraphics = self.attachAsset('child', { anchorX: 0.5, anchorY: 0.5 }); self.name = childName || 'Child'; self.isRescued = false; self.detectionRadius = 80; var nameText = new Text2(self.name, { size: 24, fill: 0xFFFFFF }); nameText.anchor.set(0.5, 1); nameText.y = -40; self.addChild(nameText); self.rescue = function () { if (!self.isRescued && player.keyCount > 0) { self.isRescued = true; childGraphics.tint = 0x90EE90; LK.getSound('childFound').play(); LK.setScore(LK.getScore() + 25); player.keyCount--; rescuedChildren++; // Make stag run to player when child is rescued and increase its speed if (stag) { stag.isHunting = true; stag.huntingTarget = player; stag.speed += 0.5; // Increase stag speed when child is rescued } // Make player slower for 3 seconds if (player) { var originalSpeed = player.speed; player.speed = originalSpeed * 0.5; // Reduce speed to half tween(player, { speed: originalSpeed }, { duration: 3000 }); } checkWinCondition(); } }; return self; }); var Fog = Container.expand(function () { var self = Container.call(this); var fogGraphics = self.attachAsset('fog', { anchorX: 0.5, anchorY: 0.5, alpha: 0.6 }); self.driftSpeed = 0.5; self.driftDirection = Math.random() * Math.PI * 2; self.update = function () { self.x += Math.cos(self.driftDirection) * self.driftSpeed; self.y += Math.sin(self.driftDirection) * self.driftSpeed; if (self.x < -150) self.x = 2200; if (self.x > 2200) self.x = -150; if (self.y < -150) self.y = 2900; if (self.y > 2900) self.y = -150; if (Math.random() < 0.01) { self.driftDirection += (Math.random() - 0.5) * 0.5; } }; return self; }); var Key = Container.expand(function () { var self = Container.call(this); var keyGraphics = self.attachAsset('sage', { anchorX: 0.5, anchorY: 0.5 }); keyGraphics.tint = 0xFFD700; // Gold color for keys self.collected = false; self.collect = function () { if (!self.collected) { self.collected = true; self.visible = false; player.keyCount++; LK.setScore(LK.getScore() + 10); } }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 3; self.isMoving = false; self.flashlightOn = false; self.batteryLevel = 100; self.sageCount = 0; self.keyCount = 0; self.isParalyzed = false; self.paralyzedTimer = 0; var flashlightBeam = self.addChild(LK.getAsset('flashlightBeam', { anchorX: 0.5, anchorY: 1.0, alpha: 0 })); self.update = function () { if (self.isParalyzed) { self.paralyzedTimer--; if (self.paralyzedTimer <= 0) { self.isParalyzed = false; playerGraphics.tint = 0xFFFFFF; } return; } if (self.flashlightOn && self.batteryLevel > 0) { self.batteryLevel -= 0.2; flashlightBeam.alpha = Math.min(1, self.batteryLevel / 100); flashlightBeam.y = -20; } else { flashlightBeam.alpha = 0; } if (self.batteryLevel <= 0) { self.flashlightOn = false; } }; self.toggleFlashlight = function () { if (self.batteryLevel > 0) { self.flashlightOn = !self.flashlightOn; LK.getSound('flashlightClick').play(); } }; self.paralyze = function () { self.isParalyzed = true; self.paralyzedTimer = 180; playerGraphics.tint = 0x666666; }; self.die = function () { // Reset game state resetGame(); }; return self; }); var Sage = Container.expand(function () { var self = Container.call(this); var sageGraphics = self.attachAsset('sage', { anchorX: 0.5, anchorY: 0.5 }); self.collected = false; self.collect = function () { if (!self.collected) { self.collected = true; self.visible = false; player.sageCount++; LK.setScore(LK.getScore() + 5); } }; return self; }); var Stag = Container.expand(function () { var self = Container.call(this); var stagGraphics = self.attachAsset('stag', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 1.5; self.detectionRadius = 250; self.attackRadius = 100; self.isHunting = false; self.huntingTarget = null; self.chainsTimer = 0; self.isStunned = false; self.stunnedTimer = 0; self.wanderDirection = Math.random() * Math.PI * 2; self.wanderTimer = 0; self.wanderSpeed = 0.8; self.update = function () { if (self.isStunned) { self.stunnedTimer--; if (self.stunnedTimer <= 0) { self.isStunned = false; stagGraphics.alpha = 1; } return; } self.chainsTimer++; if (self.chainsTimer >= 300) { LK.getSound('stagChains').play(); self.chainsTimer = 0; } if (player && !player.isParalyzed) { var distanceToPlayer = Math.sqrt(Math.pow(self.x - player.x, 2) + Math.pow(self.y - player.y, 2)); if (player.flashlightOn && distanceToPlayer < 200) { self.stun(); return; } if (distanceToPlayer < self.detectionRadius) { self.isHunting = true; self.huntingTarget = player; } if (self.isHunting && self.huntingTarget) { var dx = self.huntingTarget.x - self.x; var dy = self.huntingTarget.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 5) { self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } if (distance < self.attackRadius) { self.huntingTarget.die(); self.isHunting = false; self.huntingTarget = null; } } else { // Wander around the map when not hunting self.wanderTimer++; if (self.wanderTimer >= 120) { self.wanderDirection = Math.random() * Math.PI * 2; self.wanderTimer = 0; } self.x += Math.cos(self.wanderDirection) * self.wanderSpeed; self.y += Math.sin(self.wanderDirection) * self.wanderSpeed; // Keep stag within map bounds if (self.x < 50) { self.x = 50; self.wanderDirection = Math.random() * Math.PI * 2; } if (self.x > 1998) { self.x = 1998; self.wanderDirection = Math.random() * Math.PI * 2; } if (self.y < 50) { self.y = 50; self.wanderDirection = Math.random() * Math.PI * 2; } if (self.y > 2682) { self.y = 2682; self.wanderDirection = Math.random() * Math.PI * 2; } } } }; self.stun = function () { self.isStunned = true; self.stunnedTimer = 120; self.isHunting = false; self.huntingTarget = null; stagGraphics.alpha = 0.5; }; return self; }); var Wardrobe = Container.expand(function () { var self = Container.call(this); var wardrobeGraphics = self.attachAsset('village', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 1.2 }); wardrobeGraphics.tint = 0x4B0000; // Dark red color for wardrobe self.playerInside = false; self.detectionRadius = 80; self.enterWardrobe = function () { if (!self.playerInside) { self.playerInside = true; player.visible = false; stag.isHunting = false; stag.huntingTarget = null; } }; self.exitWardrobe = function () { if (self.playerInside) { self.playerInside = false; player.visible = true; } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a1a2e }); /**** * Game Code ****/ // Initialize game assets // Game variables var player; var stag; var children = []; var fogElements = []; var sageElements = []; var environments = []; var keyElements = []; var chestElements = []; var wardrobeElements = []; var rescuedChildren = 0; var lastTapTime = 0; var tapCount = 0; var tripleTapCount = 0; var lastTripleTapTime = 0; var gameNight = 1; var isGameActive = true; var dayProgress = 0; // UI elements var scoreText = new Text2('Score: 0', { size: 40, fill: 0xFFFFFF }); scoreText.anchor.set(0, 0); LK.gui.topRight.addChild(scoreText); var nightText = new Text2('Night: 1/99', { size: 40, fill: 0xFFFFFF }); nightText.anchor.set(0.5, 0); LK.gui.top.addChild(nightText); var batteryText = new Text2('Battery: 100%', { size: 30, fill: 0xFFFF00 }); batteryText.anchor.set(0, 0); batteryText.x = 20; batteryText.y = 80; LK.gui.topLeft.addChild(batteryText); var sageText = new Text2('Sage: 0', { size: 30, fill: 0x90EE90 }); sageText.anchor.set(0, 0); sageText.x = 20; sageText.y = 120; LK.gui.topLeft.addChild(sageText); var keyText = new Text2('Keys: 0', { size: 30, fill: 0xFFD700 }); keyText.anchor.set(0, 0); keyText.x = 20; keyText.y = 160; LK.gui.topLeft.addChild(keyText); var instructionText = new Text2('Tap to move. Double tap for flashlight. Triple tap near wardrobe to hide.', { size: 24, fill: 0xCCCCCC }); instructionText.anchor.set(0.5, 1); LK.gui.bottom.addChild(instructionText); // Initialize game elements function initializeGame() { // Create player player = game.addChild(new Player()); player.x = 1024; player.y = 2000; // Create stag stag = game.addChild(new Stag()); stag.x = 200; stag.y = 200; // Create environments var church = game.addChild(LK.getAsset('church', { anchorX: 0.5, anchorY: 0.5, x: 300, y: 400 })); environments.push(church); var village = game.addChild(LK.getAsset('village', { anchorX: 0.5, anchorY: 0.5, x: 1600, y: 600 })); environments.push(village); var cave = game.addChild(LK.getAsset('cave', { anchorX: 0.5, anchorY: 0.5, x: 1200, y: 1800 })); environments.push(cave); // Create trees for (var i = 0; i < 15; i++) { var tree = game.addChild(LK.getAsset('tree', { anchorX: 0.5, anchorY: 0.5, x: Math.random() * 2048, y: Math.random() * 2732 })); environments.push(tree); } // Create children to rescue var childNames = ['Luna', 'Tomás', 'Ana', 'Leo']; var childPositions = [{ x: 350, y: 450 }, { x: 1650, y: 650 }, { x: 1250, y: 1850 }, { x: 800, y: 1200 }]; for (var j = 0; j < 4; j++) { var child = game.addChild(new Child(childNames[j])); child.x = childPositions[j].x; child.y = childPositions[j].y; children.push(child); } // Create fog for (var k = 0; k < 12; k++) { var fog = game.addChild(new Fog()); fog.x = Math.random() * 2048; fog.y = Math.random() * 2732; fogElements.push(fog); } // Create sage items for (var l = 0; l < 8; l++) { var sage = game.addChild(new Sage()); sage.x = Math.random() * 1800 + 100; sage.y = Math.random() * 2400 + 100; sageElements.push(sage); } // Create chests that contain either keys or batteries for (var m = 0; m < 10; m++) { var containsKey = Math.random() < 0.4; // 40% chance for key, 60% for battery var chest = game.addChild(new Chest(containsKey)); chest.x = Math.random() * 1800 + 100; chest.y = Math.random() * 2400 + 100; chestElements.push(chest); } // Create wardrobes for hiding var wardrobePositions = [{ x: 500, y: 800 }, { x: 1500, y: 1200 }, { x: 800, y: 2000 }, { x: 1800, y: 400 }]; for (var n = 0; n < 4; n++) { var wardrobe = game.addChild(new Wardrobe()); wardrobe.x = wardrobePositions[n].x; wardrobe.y = wardrobePositions[n].y; wardrobeElements.push(wardrobe); } } // Movement variables var targetX = null; var targetY = null; var pressStartTime = 0; var isLongPress = false; function checkWinCondition() { if (rescuedChildren >= 4) { LK.showYouWin(); } } function checkLoseCondition() { // No lose condition - reaching 99 days is now winning } function resetGame() { // Reset game variables rescuedChildren = 0; gameNight = 1; isGameActive = true; dayProgress = 0; // Clear existing game objects for (var i = game.children.length - 1; i >= 0; i--) { var child = game.children[i]; game.removeChild(child); if (child.destroy) { child.destroy(); } } // Clear arrays children.length = 0; fogElements.length = 0; sageElements.length = 0; keyElements.length = 0; chestElements.length = 0; wardrobeElements.length = 0; environments.length = 0; // Reset score LK.setScore(0); // Re-initialize game initializeGame(); } // Event handlers game.down = function (x, y, obj) { pressStartTime = LK.ticks; isLongPress = false; targetX = x; targetY = y; }; game.up = function (x, y, obj) { var currentTime = LK.ticks; var pressDuration = currentTime - pressStartTime; if (pressDuration <= 30 && !isLongPress) { // Check for triple tap first if (currentTime - lastTripleTapTime < 45) { tripleTapCount++; if (tripleTapCount === 3) { // Triple tap detected - check for wardrobe interaction var nearWardrobe = null; for (var i = 0; i < wardrobeElements.length; i++) { var wardrobe = wardrobeElements[i]; var distanceToWardrobe = Math.sqrt(Math.pow(player.x - wardrobe.x, 2) + Math.pow(player.y - wardrobe.y, 2)); if (distanceToWardrobe < wardrobe.detectionRadius) { nearWardrobe = wardrobe; break; } } if (nearWardrobe) { if (nearWardrobe.playerInside) { nearWardrobe.exitWardrobe(); } else { nearWardrobe.enterWardrobe(); } } tripleTapCount = 0; return; } } else { tripleTapCount = 1; } lastTripleTapTime = currentTime; // Check for double tap if (currentTime - lastTapTime < 30 && tapCount === 1) { // Double tap detected - toggle flashlight player.toggleFlashlight(); tapCount = 0; } else { // Single tap - set movement target and start tap count targetX = x; targetY = y; tapCount = 1; lastTapTime = currentTime; } } }; game.move = function (x, y, obj) { if (!isLongPress && LK.ticks - pressStartTime < 30) { targetX = x; targetY = y; } }; // Main game update loop game.update = function () { if (!isGameActive) return; // Move player toward target if (targetX !== null && targetY !== null && !player.isParalyzed) { var dx = targetX - player.x; var dy = targetY - player.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 10) { player.x += dx / distance * player.speed; player.y += dy / distance * player.speed; player.isMoving = true; if (LK.ticks % 30 === 0) { LK.getSound('footstep').play(); } } else { player.isMoving = false; targetX = null; targetY = null; } } // Keep player in bounds player.x = Math.max(50, Math.min(1998, player.x)); player.y = Math.max(50, Math.min(2682, player.y)); // Check child rescue interactions for (var i = 0; i < children.length; i++) { var child = children[i]; if (!child.isRescued) { var distanceToChild = Math.sqrt(Math.pow(player.x - child.x, 2) + Math.pow(player.y - child.y, 2)); if (distanceToChild < child.detectionRadius) { child.rescue(); } } } // Check sage collection for (var j = 0; j < sageElements.length; j++) { var sage = sageElements[j]; if (!sage.collected) { var distanceToSage = Math.sqrt(Math.pow(player.x - sage.x, 2) + Math.pow(player.y - sage.y, 2)); if (distanceToSage < 40) { sage.collect(); } } } // Check key collection for (var k = 0; k < keyElements.length; k++) { var key = keyElements[k]; if (!key.collected) { var distanceToKey = Math.sqrt(Math.pow(player.x - key.x, 2) + Math.pow(player.y - key.y, 2)); if (distanceToKey < 40) { key.collect(); } } } // Check chest collection for (var l = 0; l < chestElements.length; l++) { var chest = chestElements[l]; if (!chest.collected) { var distanceToChest = Math.sqrt(Math.pow(player.x - chest.x, 2) + Math.pow(player.y - chest.y, 2)); if (distanceToChest < 40) { chest.collect(); } } } // Advance night every 30 seconds (1800 ticks) with acceleration based on rescued children var dayAcceleration = rescuedChildren + 1; // 1x speed with 0 children, 2x with 1 child, etc. // Add acceleration to day progress dayProgress += dayAcceleration; // Check if a full day has passed (1800 ticks worth of progress) if (dayProgress >= 1800) { gameNight++; stag.speed += 0.1; dayProgress -= 1800; // Reset progress but keep overflow checkWinCondition(); // Check win condition instead of lose } // Check if player is inside a wardrobe and prevent movement var playerInWardrobe = false; for (var w = 0; w < wardrobeElements.length; w++) { if (wardrobeElements[w].playerInside) { playerInWardrobe = true; targetX = null; targetY = null; break; } } // Reset tap count if too much time has passed if (LK.ticks - lastTapTime > 30) { tapCount = 0; } // Reset triple tap count if too much time has passed if (LK.ticks - lastTripleTapTime > 45) { tripleTapCount = 0; } // Update UI scoreText.setText('Score: ' + LK.getScore()); nightText.setText('Night: ' + gameNight + '/99'); batteryText.setText('Battery: ' + Math.ceil(player.batteryLevel) + '%'); sageText.setText('Sage: ' + player.sageCount); keyText.setText('Keys: ' + player.keyCount); // Battery color warning if (player.batteryLevel < 25) { batteryText.tint = 0xFF0000; } else if (player.batteryLevel < 50) { batteryText.tint = 0xFFAA00; } else { batteryText.tint = 0xFFFF00; } }; // Initialize the game initializeGame(); // Start ambient music LK.playMusic('forestAmbient');
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Chest = Container.expand(function (containsKey) {
var self = Container.call(this);
var chestGraphics = self.attachAsset('village', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.3,
scaleY: 0.3
});
chestGraphics.tint = 0x8B4513; // Brown color for chest
self.collected = false;
self.containsKey = containsKey || false;
self.batteryAmount = 50;
self.collect = function () {
if (!self.collected) {
self.collected = true;
self.visible = false;
if (self.containsKey) {
player.keyCount++;
LK.setScore(LK.getScore() + 10);
} else {
player.batteryLevel = Math.min(100, player.batteryLevel + self.batteryAmount);
LK.setScore(LK.getScore() + 15);
}
}
};
return self;
});
var Child = Container.expand(function (childName) {
var self = Container.call(this);
var childGraphics = self.attachAsset('child', {
anchorX: 0.5,
anchorY: 0.5
});
self.name = childName || 'Child';
self.isRescued = false;
self.detectionRadius = 80;
var nameText = new Text2(self.name, {
size: 24,
fill: 0xFFFFFF
});
nameText.anchor.set(0.5, 1);
nameText.y = -40;
self.addChild(nameText);
self.rescue = function () {
if (!self.isRescued && player.keyCount > 0) {
self.isRescued = true;
childGraphics.tint = 0x90EE90;
LK.getSound('childFound').play();
LK.setScore(LK.getScore() + 25);
player.keyCount--;
rescuedChildren++;
// Make stag run to player when child is rescued and increase its speed
if (stag) {
stag.isHunting = true;
stag.huntingTarget = player;
stag.speed += 0.5; // Increase stag speed when child is rescued
}
// Make player slower for 3 seconds
if (player) {
var originalSpeed = player.speed;
player.speed = originalSpeed * 0.5; // Reduce speed to half
tween(player, {
speed: originalSpeed
}, {
duration: 3000
});
}
checkWinCondition();
}
};
return self;
});
var Fog = Container.expand(function () {
var self = Container.call(this);
var fogGraphics = self.attachAsset('fog', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.6
});
self.driftSpeed = 0.5;
self.driftDirection = Math.random() * Math.PI * 2;
self.update = function () {
self.x += Math.cos(self.driftDirection) * self.driftSpeed;
self.y += Math.sin(self.driftDirection) * self.driftSpeed;
if (self.x < -150) self.x = 2200;
if (self.x > 2200) self.x = -150;
if (self.y < -150) self.y = 2900;
if (self.y > 2900) self.y = -150;
if (Math.random() < 0.01) {
self.driftDirection += (Math.random() - 0.5) * 0.5;
}
};
return self;
});
var Key = Container.expand(function () {
var self = Container.call(this);
var keyGraphics = self.attachAsset('sage', {
anchorX: 0.5,
anchorY: 0.5
});
keyGraphics.tint = 0xFFD700; // Gold color for keys
self.collected = false;
self.collect = function () {
if (!self.collected) {
self.collected = true;
self.visible = false;
player.keyCount++;
LK.setScore(LK.getScore() + 10);
}
};
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 3;
self.isMoving = false;
self.flashlightOn = false;
self.batteryLevel = 100;
self.sageCount = 0;
self.keyCount = 0;
self.isParalyzed = false;
self.paralyzedTimer = 0;
var flashlightBeam = self.addChild(LK.getAsset('flashlightBeam', {
anchorX: 0.5,
anchorY: 1.0,
alpha: 0
}));
self.update = function () {
if (self.isParalyzed) {
self.paralyzedTimer--;
if (self.paralyzedTimer <= 0) {
self.isParalyzed = false;
playerGraphics.tint = 0xFFFFFF;
}
return;
}
if (self.flashlightOn && self.batteryLevel > 0) {
self.batteryLevel -= 0.2;
flashlightBeam.alpha = Math.min(1, self.batteryLevel / 100);
flashlightBeam.y = -20;
} else {
flashlightBeam.alpha = 0;
}
if (self.batteryLevel <= 0) {
self.flashlightOn = false;
}
};
self.toggleFlashlight = function () {
if (self.batteryLevel > 0) {
self.flashlightOn = !self.flashlightOn;
LK.getSound('flashlightClick').play();
}
};
self.paralyze = function () {
self.isParalyzed = true;
self.paralyzedTimer = 180;
playerGraphics.tint = 0x666666;
};
self.die = function () {
// Reset game state
resetGame();
};
return self;
});
var Sage = Container.expand(function () {
var self = Container.call(this);
var sageGraphics = self.attachAsset('sage', {
anchorX: 0.5,
anchorY: 0.5
});
self.collected = false;
self.collect = function () {
if (!self.collected) {
self.collected = true;
self.visible = false;
player.sageCount++;
LK.setScore(LK.getScore() + 5);
}
};
return self;
});
var Stag = Container.expand(function () {
var self = Container.call(this);
var stagGraphics = self.attachAsset('stag', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 1.5;
self.detectionRadius = 250;
self.attackRadius = 100;
self.isHunting = false;
self.huntingTarget = null;
self.chainsTimer = 0;
self.isStunned = false;
self.stunnedTimer = 0;
self.wanderDirection = Math.random() * Math.PI * 2;
self.wanderTimer = 0;
self.wanderSpeed = 0.8;
self.update = function () {
if (self.isStunned) {
self.stunnedTimer--;
if (self.stunnedTimer <= 0) {
self.isStunned = false;
stagGraphics.alpha = 1;
}
return;
}
self.chainsTimer++;
if (self.chainsTimer >= 300) {
LK.getSound('stagChains').play();
self.chainsTimer = 0;
}
if (player && !player.isParalyzed) {
var distanceToPlayer = Math.sqrt(Math.pow(self.x - player.x, 2) + Math.pow(self.y - player.y, 2));
if (player.flashlightOn && distanceToPlayer < 200) {
self.stun();
return;
}
if (distanceToPlayer < self.detectionRadius) {
self.isHunting = true;
self.huntingTarget = player;
}
if (self.isHunting && self.huntingTarget) {
var dx = self.huntingTarget.x - self.x;
var dy = self.huntingTarget.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 5) {
self.x += dx / distance * self.speed;
self.y += dy / distance * self.speed;
}
if (distance < self.attackRadius) {
self.huntingTarget.die();
self.isHunting = false;
self.huntingTarget = null;
}
} else {
// Wander around the map when not hunting
self.wanderTimer++;
if (self.wanderTimer >= 120) {
self.wanderDirection = Math.random() * Math.PI * 2;
self.wanderTimer = 0;
}
self.x += Math.cos(self.wanderDirection) * self.wanderSpeed;
self.y += Math.sin(self.wanderDirection) * self.wanderSpeed;
// Keep stag within map bounds
if (self.x < 50) {
self.x = 50;
self.wanderDirection = Math.random() * Math.PI * 2;
}
if (self.x > 1998) {
self.x = 1998;
self.wanderDirection = Math.random() * Math.PI * 2;
}
if (self.y < 50) {
self.y = 50;
self.wanderDirection = Math.random() * Math.PI * 2;
}
if (self.y > 2682) {
self.y = 2682;
self.wanderDirection = Math.random() * Math.PI * 2;
}
}
}
};
self.stun = function () {
self.isStunned = true;
self.stunnedTimer = 120;
self.isHunting = false;
self.huntingTarget = null;
stagGraphics.alpha = 0.5;
};
return self;
});
var Wardrobe = Container.expand(function () {
var self = Container.call(this);
var wardrobeGraphics = self.attachAsset('village', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 1.2
});
wardrobeGraphics.tint = 0x4B0000; // Dark red color for wardrobe
self.playerInside = false;
self.detectionRadius = 80;
self.enterWardrobe = function () {
if (!self.playerInside) {
self.playerInside = true;
player.visible = false;
stag.isHunting = false;
stag.huntingTarget = null;
}
};
self.exitWardrobe = function () {
if (self.playerInside) {
self.playerInside = false;
player.visible = true;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a2e
});
/****
* Game Code
****/
// Initialize game assets
// Game variables
var player;
var stag;
var children = [];
var fogElements = [];
var sageElements = [];
var environments = [];
var keyElements = [];
var chestElements = [];
var wardrobeElements = [];
var rescuedChildren = 0;
var lastTapTime = 0;
var tapCount = 0;
var tripleTapCount = 0;
var lastTripleTapTime = 0;
var gameNight = 1;
var isGameActive = true;
var dayProgress = 0;
// UI elements
var scoreText = new Text2('Score: 0', {
size: 40,
fill: 0xFFFFFF
});
scoreText.anchor.set(0, 0);
LK.gui.topRight.addChild(scoreText);
var nightText = new Text2('Night: 1/99', {
size: 40,
fill: 0xFFFFFF
});
nightText.anchor.set(0.5, 0);
LK.gui.top.addChild(nightText);
var batteryText = new Text2('Battery: 100%', {
size: 30,
fill: 0xFFFF00
});
batteryText.anchor.set(0, 0);
batteryText.x = 20;
batteryText.y = 80;
LK.gui.topLeft.addChild(batteryText);
var sageText = new Text2('Sage: 0', {
size: 30,
fill: 0x90EE90
});
sageText.anchor.set(0, 0);
sageText.x = 20;
sageText.y = 120;
LK.gui.topLeft.addChild(sageText);
var keyText = new Text2('Keys: 0', {
size: 30,
fill: 0xFFD700
});
keyText.anchor.set(0, 0);
keyText.x = 20;
keyText.y = 160;
LK.gui.topLeft.addChild(keyText);
var instructionText = new Text2('Tap to move. Double tap for flashlight. Triple tap near wardrobe to hide.', {
size: 24,
fill: 0xCCCCCC
});
instructionText.anchor.set(0.5, 1);
LK.gui.bottom.addChild(instructionText);
// Initialize game elements
function initializeGame() {
// Create player
player = game.addChild(new Player());
player.x = 1024;
player.y = 2000;
// Create stag
stag = game.addChild(new Stag());
stag.x = 200;
stag.y = 200;
// Create environments
var church = game.addChild(LK.getAsset('church', {
anchorX: 0.5,
anchorY: 0.5,
x: 300,
y: 400
}));
environments.push(church);
var village = game.addChild(LK.getAsset('village', {
anchorX: 0.5,
anchorY: 0.5,
x: 1600,
y: 600
}));
environments.push(village);
var cave = game.addChild(LK.getAsset('cave', {
anchorX: 0.5,
anchorY: 0.5,
x: 1200,
y: 1800
}));
environments.push(cave);
// Create trees
for (var i = 0; i < 15; i++) {
var tree = game.addChild(LK.getAsset('tree', {
anchorX: 0.5,
anchorY: 0.5,
x: Math.random() * 2048,
y: Math.random() * 2732
}));
environments.push(tree);
}
// Create children to rescue
var childNames = ['Luna', 'Tomás', 'Ana', 'Leo'];
var childPositions = [{
x: 350,
y: 450
}, {
x: 1650,
y: 650
}, {
x: 1250,
y: 1850
}, {
x: 800,
y: 1200
}];
for (var j = 0; j < 4; j++) {
var child = game.addChild(new Child(childNames[j]));
child.x = childPositions[j].x;
child.y = childPositions[j].y;
children.push(child);
}
// Create fog
for (var k = 0; k < 12; k++) {
var fog = game.addChild(new Fog());
fog.x = Math.random() * 2048;
fog.y = Math.random() * 2732;
fogElements.push(fog);
}
// Create sage items
for (var l = 0; l < 8; l++) {
var sage = game.addChild(new Sage());
sage.x = Math.random() * 1800 + 100;
sage.y = Math.random() * 2400 + 100;
sageElements.push(sage);
}
// Create chests that contain either keys or batteries
for (var m = 0; m < 10; m++) {
var containsKey = Math.random() < 0.4; // 40% chance for key, 60% for battery
var chest = game.addChild(new Chest(containsKey));
chest.x = Math.random() * 1800 + 100;
chest.y = Math.random() * 2400 + 100;
chestElements.push(chest);
}
// Create wardrobes for hiding
var wardrobePositions = [{
x: 500,
y: 800
}, {
x: 1500,
y: 1200
}, {
x: 800,
y: 2000
}, {
x: 1800,
y: 400
}];
for (var n = 0; n < 4; n++) {
var wardrobe = game.addChild(new Wardrobe());
wardrobe.x = wardrobePositions[n].x;
wardrobe.y = wardrobePositions[n].y;
wardrobeElements.push(wardrobe);
}
}
// Movement variables
var targetX = null;
var targetY = null;
var pressStartTime = 0;
var isLongPress = false;
function checkWinCondition() {
if (rescuedChildren >= 4) {
LK.showYouWin();
}
}
function checkLoseCondition() {
// No lose condition - reaching 99 days is now winning
}
function resetGame() {
// Reset game variables
rescuedChildren = 0;
gameNight = 1;
isGameActive = true;
dayProgress = 0;
// Clear existing game objects
for (var i = game.children.length - 1; i >= 0; i--) {
var child = game.children[i];
game.removeChild(child);
if (child.destroy) {
child.destroy();
}
}
// Clear arrays
children.length = 0;
fogElements.length = 0;
sageElements.length = 0;
keyElements.length = 0;
chestElements.length = 0;
wardrobeElements.length = 0;
environments.length = 0;
// Reset score
LK.setScore(0);
// Re-initialize game
initializeGame();
}
// Event handlers
game.down = function (x, y, obj) {
pressStartTime = LK.ticks;
isLongPress = false;
targetX = x;
targetY = y;
};
game.up = function (x, y, obj) {
var currentTime = LK.ticks;
var pressDuration = currentTime - pressStartTime;
if (pressDuration <= 30 && !isLongPress) {
// Check for triple tap first
if (currentTime - lastTripleTapTime < 45) {
tripleTapCount++;
if (tripleTapCount === 3) {
// Triple tap detected - check for wardrobe interaction
var nearWardrobe = null;
for (var i = 0; i < wardrobeElements.length; i++) {
var wardrobe = wardrobeElements[i];
var distanceToWardrobe = Math.sqrt(Math.pow(player.x - wardrobe.x, 2) + Math.pow(player.y - wardrobe.y, 2));
if (distanceToWardrobe < wardrobe.detectionRadius) {
nearWardrobe = wardrobe;
break;
}
}
if (nearWardrobe) {
if (nearWardrobe.playerInside) {
nearWardrobe.exitWardrobe();
} else {
nearWardrobe.enterWardrobe();
}
}
tripleTapCount = 0;
return;
}
} else {
tripleTapCount = 1;
}
lastTripleTapTime = currentTime;
// Check for double tap
if (currentTime - lastTapTime < 30 && tapCount === 1) {
// Double tap detected - toggle flashlight
player.toggleFlashlight();
tapCount = 0;
} else {
// Single tap - set movement target and start tap count
targetX = x;
targetY = y;
tapCount = 1;
lastTapTime = currentTime;
}
}
};
game.move = function (x, y, obj) {
if (!isLongPress && LK.ticks - pressStartTime < 30) {
targetX = x;
targetY = y;
}
};
// Main game update loop
game.update = function () {
if (!isGameActive) return;
// Move player toward target
if (targetX !== null && targetY !== null && !player.isParalyzed) {
var dx = targetX - player.x;
var dy = targetY - player.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 10) {
player.x += dx / distance * player.speed;
player.y += dy / distance * player.speed;
player.isMoving = true;
if (LK.ticks % 30 === 0) {
LK.getSound('footstep').play();
}
} else {
player.isMoving = false;
targetX = null;
targetY = null;
}
}
// Keep player in bounds
player.x = Math.max(50, Math.min(1998, player.x));
player.y = Math.max(50, Math.min(2682, player.y));
// Check child rescue interactions
for (var i = 0; i < children.length; i++) {
var child = children[i];
if (!child.isRescued) {
var distanceToChild = Math.sqrt(Math.pow(player.x - child.x, 2) + Math.pow(player.y - child.y, 2));
if (distanceToChild < child.detectionRadius) {
child.rescue();
}
}
}
// Check sage collection
for (var j = 0; j < sageElements.length; j++) {
var sage = sageElements[j];
if (!sage.collected) {
var distanceToSage = Math.sqrt(Math.pow(player.x - sage.x, 2) + Math.pow(player.y - sage.y, 2));
if (distanceToSage < 40) {
sage.collect();
}
}
}
// Check key collection
for (var k = 0; k < keyElements.length; k++) {
var key = keyElements[k];
if (!key.collected) {
var distanceToKey = Math.sqrt(Math.pow(player.x - key.x, 2) + Math.pow(player.y - key.y, 2));
if (distanceToKey < 40) {
key.collect();
}
}
}
// Check chest collection
for (var l = 0; l < chestElements.length; l++) {
var chest = chestElements[l];
if (!chest.collected) {
var distanceToChest = Math.sqrt(Math.pow(player.x - chest.x, 2) + Math.pow(player.y - chest.y, 2));
if (distanceToChest < 40) {
chest.collect();
}
}
}
// Advance night every 30 seconds (1800 ticks) with acceleration based on rescued children
var dayAcceleration = rescuedChildren + 1; // 1x speed with 0 children, 2x with 1 child, etc.
// Add acceleration to day progress
dayProgress += dayAcceleration;
// Check if a full day has passed (1800 ticks worth of progress)
if (dayProgress >= 1800) {
gameNight++;
stag.speed += 0.1;
dayProgress -= 1800; // Reset progress but keep overflow
checkWinCondition(); // Check win condition instead of lose
}
// Check if player is inside a wardrobe and prevent movement
var playerInWardrobe = false;
for (var w = 0; w < wardrobeElements.length; w++) {
if (wardrobeElements[w].playerInside) {
playerInWardrobe = true;
targetX = null;
targetY = null;
break;
}
}
// Reset tap count if too much time has passed
if (LK.ticks - lastTapTime > 30) {
tapCount = 0;
}
// Reset triple tap count if too much time has passed
if (LK.ticks - lastTripleTapTime > 45) {
tripleTapCount = 0;
}
// Update UI
scoreText.setText('Score: ' + LK.getScore());
nightText.setText('Night: ' + gameNight + '/99');
batteryText.setText('Battery: ' + Math.ceil(player.batteryLevel) + '%');
sageText.setText('Sage: ' + player.sageCount);
keyText.setText('Keys: ' + player.keyCount);
// Battery color warning
if (player.batteryLevel < 25) {
batteryText.tint = 0xFF0000;
} else if (player.batteryLevel < 50) {
batteryText.tint = 0xFFAA00;
} else {
batteryText.tint = 0xFFFF00;
}
};
// Initialize the game
initializeGame();
// Start ambient music
LK.playMusic('forestAmbient');
roblox player. In-Game asset. 2d. High contrast. No shadows
Cabeza de Ciervo: La figura posee una cabeza detallada de ciervo, con astas ramificadas de color oscuro (posiblemente negro o marrón oscuro). Tiene orejas puntiagudas y un hocico prominente de un tono más claro que el resto del cuerpo. Los ojos son grandes, completamente blancos con pupilas negras pequeñas y redondas, lo que le confiere una mirada vacía y sorprendente. La boca está abierta en una expresión que podría interpretarse como un grito o una mueca. Cuerpo Humanoide: El cuerpo es de forma vagamente humana, con dos brazos largos y delgados que terminan en manos con lo que parecen ser garras o dedos muy alargados. Las piernas son también delgadas y la postura sugiere que está de pie. El color del cuerpo es principalmente marrón oscuro o morado oscuro.. In-Game asset. 2d. High contrast. No shadows
child roblox hat dinosaur red. In-Game asset. 2d. High contrast. No shadows
tree. In-Game asset. 2d. High contrast. No shadows
fog. In-Game asset. 2d. High contrast. No shadows
cave. In-Game asset. 2d. High contrast. No shadows
church gris. In-Game asset. 2d. High contrast. No shadows
sage. In-Game asset. 2d. High contrast. No shadows
roblox player corriendo de stag con miedo y una linterna en la mano. In-Game asset. 2d. High contrast. No shadows
cofre. In-Game asset. 2d. High contrast. No shadows
armario. In-Game asset. 2d. High contrast. No shadows
Cabeza de Ciervo: La figura posee una cabeza detallada de ciervo, con astas ramificadas de color oscuro (posiblemente negro o marrón oscuro). Tiene orejas puntiagudas y un hocico prominente de un tono más claro que el resto del cuerpo. Los ojos son grandes, completamente blancos con pupilas rojas gigantes y redondas, lo que le confiere una mirada vacía y sorprendente. La boca está abierta en una expresión que podría interpretarse como un grito o una mueca. Cuerpo Humanoide: El cuerpo es de forma vagamente humana, con dos brazos largos y delgados que terminan en manos con lo que parecen ser garras o dedos muy alargados. Las piernas son también delgadas y la postura sugiere que está de pie. El color del cuerpo es principalmente marrón oscuro o morado oscuro.. In-Game asset. 2d. High contrast. No shadows
house. In-Game asset. 2d. High contrast. No shadows