User prompt
Make all sprites including buttons, kepad numbers (unused sprite), entity eyes and mouths appear instead of just colors
User prompt
Make the text longer and a little slower and after he's done talking he'll say "o-oh n-n-n-nOOOOOOOOOOOOO!!!" and then dissapear, and then white eyes will show up all around the edge of the screen and in the middle of the screen that says "Trapped ending"
User prompt
Add a ??? button on the title screen in the bottom corner that if you press, everything on screen will fade and the figure will glitch into screes and his eyes and mouth will be flipping around on screen and random sprites will pop up and start glitching and then dissapear the figure will say "w-why d-d-diiiid y-y-you do that,? you will be t-t-tr-tr-trapped here f-for eternity" make that dialouge longer and sadder and creepier
User prompt
make dialouge for when you escape with a man running away sprite
User prompt
make hell mode button timing random between beeps, add longer things and if you hover over a button, your screen will shake violently (in hell mode) (Also, dont make it unbeatable.) ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'ReferenceError: hellButton is not defined' in or related to this line: 'if (gameState === STATE_INTRO && hellButton && hellButton.alpha < 1) {' Line Number: 172
User prompt
give the figure dialouge before hell mode like "Why would you do this, this isn't worth it. I do want to see you suffer; however, G O O D L U C K!" make that longer and more creepy
User prompt
move it down more
User prompt
move hell mode button down a bit so it's not overlapping start game
User prompt
Dont add hell mode after 35 points just add it to the title screen, and also when you get to the point of choosing to escape or continue, remove all level texts and buttons, and glitch efffects
User prompt
Add a hell mode where everything get glitchier faster and faster patterns (Not too fast)
User prompt
the main menu keeps poppping up during the game, can you fix that?
User prompt
not level 35 score 35
User prompt
make it so the higher score you get, the more glitchy the game becomes ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
make it so you can win after 35 or you could choose to continue
User prompt
remove all level text during dialouge
User prompt
romove all text during dialouge and title screen
User prompt
now, turn the touch to start into a title screen
User prompt
try again
User prompt
Please fix the bug: 'TypeError: LK.showTitle is not a function' in or related to this line: 'LK.showTitle();' Line Number: 225
User prompt
Please fix the bug: 'TypeError: LK.gotoTitleScreen is not a function' in or related to this line: 'LK.gotoTitleScreen();' Line Number: 225
User prompt
after his dialouge it sends you to the title screen
User prompt
Please fix the bug: 'window.addEventListener is not a function' in or related to this line: 'window.addEventListener('keydown', function (event) {' Line Number: 871
User prompt
change of plans:make it so you can just type the code
User prompt
Make the enter hitbox smaller and the clear button hitbox smaller
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Keypad = Container.expand(function () { var self = Container.call(this); // Keypad background var keypadBg = self.attachAsset('simonButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 2, alpha: 1.0 }); // Create display for entered code var codeDisplay = new Text2('', { size: 60, fill: 0x00FF00, font: "'Courier New', monospace" }); codeDisplay.anchor.set(0.5, 0.5); codeDisplay.y = -140; self.addChild(codeDisplay); // Store entered code self.currentCode = ''; // Create number buttons var buttons = []; var buttonSize = 80; var spacing = 20; var startX = -buttonSize - spacing; var startY = -buttonSize - spacing; // Make buttons visually interactive function highlightButton(button) { if (!button || !button.children || button.children.length === 0) { return; } var bg = button.children[0]; // Get the button background tween(bg, { alpha: 1 }, { duration: 100, onFinish: function onFinish() { tween(bg, { alpha: 1.0 }, { duration: 100 }); } }); } for (var i = 1; i <= 9; i++) { var row = Math.floor((i - 1) / 3); var col = (i - 1) % 3; var button = new Container(); var buttonBg = button.attachAsset('simonButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.8, alpha: 1.0 }); // Use keypad image assets instead of text var numAsset = button.attachAsset('keypad' + i, { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.8 }); button.x = startX + col * (buttonSize + spacing); button.y = startY + row * (buttonSize + spacing); button.num = i; button.down = function (x, y, obj) { if (obj && obj.num !== undefined) { highlightButton(obj); self.enterDigit(obj.num); } }; self.addChild(button); buttons.push(button); } // Add 0 button var zeroButton = new Container(); var zeroBg = zeroButton.attachAsset('simonButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.8, alpha: 1.0 }); // Use keypad image asset for zero instead of text var zeroAsset = zeroButton.attachAsset('keypad0', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.8 }); zeroButton.x = startX + 1 * (buttonSize + spacing); zeroButton.y = startY + 3 * (buttonSize + spacing); zeroButton.num = 0; zeroButton.down = function (x, y, obj) { highlightButton(obj); self.enterDigit(obj.num); }; self.addChild(zeroButton); // Add clear button var clearButton = new Container(); var clearBg = clearButton.attachAsset('simonButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.6, scaleY: 0.6, alpha: 1.0 }); var clearText = new Text2('C', { size: 50, fill: 0xFF0000, font: "'Courier New', monospace" }); clearText.anchor.set(0.5, 0.5); clearButton.addChild(clearText); clearButton.x = startX + 0 * (buttonSize + spacing); clearButton.y = startY + 3 * (buttonSize + spacing); clearButton.down = function (x, y, obj) { highlightButton(obj); self.clearCode(); }; self.addChild(clearButton); // Add enter button var enterButton = new Container(); var enterBg = enterButton.attachAsset('simonButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.6, scaleY: 0.6, alpha: 1.0 }); var enterText = new Text2('E', { size: 50, fill: 0x00FF00, font: "'Courier New', monospace" }); enterText.anchor.set(0.5, 0.5); enterButton.addChild(enterText); enterButton.x = startX + 2 * (buttonSize + spacing); enterButton.y = startY + 3 * (buttonSize + spacing); enterButton.down = function (x, y, obj) { highlightButton(obj); self.submitCode(); }; self.addChild(enterButton); // Method to enter a digit self.enterDigit = function (digit) { if (self.currentCode.length < 4 && digit !== undefined) { self.currentCode += digit.toString(); codeDisplay.setText(self.currentCode); } }; // Method to clear code self.clearCode = function () { self.currentCode = ''; codeDisplay.setText(''); }; // Method to submit code self.submitCode = function () { if (self.currentCode === '1197') { // Correct code tween(self, { alpha: 0 }, { duration: 1000, onFinish: function onFinish() { LK.setScore(LK.getScore() + 1000); updateScore(); self.destroy(); } }); } else { // Wrong code self.clearCode(); LK.effects.flashObject(self, 0xFF0000, 500); } }; return self; }); var ShadowFigure = Container.expand(function () { var self = Container.call(this); // Dark shadow shape var shadowShape = self.attachAsset('simonButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 5, scaleY: 10, alpha: 0.8 }); // Face elements similar to entity but with different positions/scales var face = self.attachAsset('entityFace', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5, alpha: 0.7 }); // Eyes var leftEye = self.attachAsset('entityEye', { anchorX: 0.5, anchorY: 0.5, x: -65, y: -55, scaleX: 1.2, scaleY: 1.2, alpha: 0.9 }); var rightEye = self.attachAsset('entityEye', { anchorX: 0.5, anchorY: 0.5, x: 65, y: -55, scaleX: 1.2, scaleY: 1.2, alpha: 0.9 }); // Mouth var mouth = self.attachAsset('entityMouth', { anchorX: 0.5, anchorY: 0.5, y: 100, scaleX: 1.4, scaleY: 1.2, alpha: 0.9 }); // Dialogue box var dialogueBox = new Container(); dialogueBox.y = 350; var dialogueBackground = dialogueBox.attachAsset('simonButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 4.5, scaleY: 1.5, alpha: 0.7 }); // Dialogue text var dialogueText = new Text2('', { size: 60, fill: 0xFFFFFF, font: "'Creepster', 'Chiller', 'Times New Roman'" }); dialogueText.anchor.set(0.5, 0.5); dialogueBox.addChild(dialogueText); // Car crash image var carCrashImage = new Container(); carCrashImage.y = -150; carCrashImage.visible = false; var crashBackground = carCrashImage.attachAsset('carCrashImage', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.0, scaleY: 1.0, alpha: 0.7 }); // Skip button var skipButton = new Container(); var skipButtonBg = skipButton.attachAsset('simonButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.2, scaleY: 0.5, alpha: 0.7 }); var skipText = new Text2('SKIP', { size: 60, fill: 0xFFFFFF, font: "'Creepster', 'Chiller', 'Times New Roman'" }); skipText.anchor.set(0.5, 0.5); skipButton.addChild(skipText); skipButton.x = 800; skipButton.y = 500; // Add touch handler for skip button skipButton.down = function (x, y, obj) { self.endDialogue(); }; // Add everything to self self.addChild(dialogueBox); self.addChild(carCrashImage); self.addChild(skipButton); // Ensure car crash image is in front by setting its zIndex carCrashImage.zIndex = 100; // Starting state self.alpha = 0; // Method to start dialogue sequence self.startDialogue = function () { self.alpha = 0; // Fade in sequence tween(self, { alpha: 1 }, { duration: 2000, easing: tween.easeIn, onFinish: function onFinish() { self.playDialogueSequence(); } }); }; // Play the dialogue sequence self.playDialogueSequence = function () { var dialogues = ["Hello...", "Do you remember where you were before the incident?", "*shows blurry image of a person's perspective of driving a car*", "And now, you're here.", "I've been watching you for some time...", "Your thoughts, your fears, your regrets...", "They're all so... delicious.", "This place exists between reality and nightmare.", "A realm where I control everything.", "Your memories are fractured, aren't they?", "The crash wasn't your fault... or was it?", "The guilt you carry is what brought you to me.", "You must complete 35 levels of Simon Says to leave this place.", "With each level, a piece of your soul will return.", "Fail, and you'll remain here... forever.", "Others have tried before you. None have succeeded.", "Their echoes still linger in these walls.", "Can you hear them whispering?", "One last thing... I left you a clue in my words.", "The first letter represents a number... Look at them carefully.", "If you find the numbers, perhaps you can escape sooner.", "Remember, the first is one...", "The ninth is also one...", "The nineteenth is nine...", "And the twenty-first is seven...", "Follow the patterns. Don't make mistakes.", "Your sanity depends on it.", "Good luck.", "You'll need it.", "*shows devious smile before game starts*"]; var currentDialogue = 0; function showNextDialogue() { if (currentDialogue < dialogues.length) { var dialogue = dialogues[currentDialogue]; // Special cases if (dialogue.includes("*shows blurry image")) { // Show car crash image carCrashImage.visible = true; tween(carCrashImage, { alpha: 0.9 }, { duration: 500 }); dialogueText.setText(""); } else if (dialogue.includes("*shows devious smile")) { // Show evil smile tween(mouth, { scaleX: 2.5, scaleY: 1.0 }, { duration: 800 }); dialogueText.setText(""); } else { // Hide car crash image if visible if (carCrashImage.visible) { tween(carCrashImage, { alpha: 0 }, { duration: 300, onFinish: function onFinish() { carCrashImage.visible = false; } }); } // Normal dialogue dialogueText.setText(dialogue); } currentDialogue++; // Calculate delay - longer for showing images or evil smile var delay = 3500; // Increased from 2000 to make dialogue slower if (dialogue.includes("*")) { delay = 5000; // Increased from 3000 for special scenes } // Schedule next dialogue LK.setTimeout(showNextDialogue, delay); } else { // End of dialogue sequence self.endDialogue(); } } // Start the dialogue sequence showNextDialogue(); }; // End dialogue and transition to game self.endDialogue = function () { tween(self, { alpha: 0 }, { duration: 1500, easing: tween.easeOut, onFinish: function onFinish() { startGame(); self.destroy(); } }); }; return self; }); var SimonButton = Container.expand(function (color, sound, id) { var self = Container.call(this); self.id = id; self.isActive = false; self.sound = sound; var buttonGraphics = self.attachAsset('simonButton', { anchorX: 0.5, anchorY: 0.5 }); var activeButtonAsset = 'simonButton' + color; var activeButtonGraphics = self.attachAsset(activeButtonAsset, { anchorX: 0.5, anchorY: 0.5, alpha: 0 }); self.activate = function () { if (self.isActive) { return; } self.isActive = true; tween(activeButtonGraphics, { alpha: 1 }, { duration: 300, onFinish: function onFinish() { LK.getSound(self.sound).play(); tween(activeButtonGraphics, { alpha: 0 }, { duration: 300, onFinish: function onFinish() { self.isActive = false; } }); } }); }; self.down = function (x, y, obj) { if (gameState === STATE_PLAYER_TURN && !self.isActive && !waitingForInput) { self.activate(); playerSequence.push(self.id); checkPlayerInput(); } }; return self; }); var SinisterEntity = Container.expand(function () { var self = Container.call(this); // Face base var face = self.attachAsset('entityFace', { anchorX: 0.5, anchorY: 0.5 }); // Left eye var leftEye = self.attachAsset('entityEye', { anchorX: 0.5, anchorY: 0.5, x: -75, y: -50 }); // Right eye var rightEye = self.attachAsset('entityEye', { anchorX: 0.5, anchorY: 0.5, x: 75, y: -50 }); // Mouth var mouth = self.attachAsset('entityMouth', { anchorX: 0.5, anchorY: 0.5, y: 80 }); self.alpha = 0; self.appear = function (intensity) { self.alpha = 0; // Scale intensity from 0-10 to meaningful values var duration = Math.max(1000 - intensity * 80, 200); var scaleFactor = 1 + intensity * 0.1; tween(self, { alpha: 1 }, { duration: duration, easing: tween.easeIn, onFinish: function onFinish() { // Make eyes look at player tween(leftEye, { scaleX: 1.5, scaleY: 1.5 }, { duration: 300, easing: tween.easeOut }); tween(rightEye, { scaleX: 1.5, scaleY: 1.5 }, { duration: 300, easing: tween.easeOut }); // Make mouth grow wider tween(mouth, { scaleX: 1.8, scaleY: 0.8 }, { duration: 500, easing: tween.easeOut, onFinish: function onFinish() { if (intensity > 5) { LK.getSound('creepyLaugh').play(); } LK.setTimeout(function () { self.disappear(); }, 1000); } }); } }); }; self.disappear = function () { tween(leftEye, { scaleX: 1, scaleY: 1 }, { duration: 300 }); tween(rightEye, { scaleX: 1, scaleY: 1 }, { duration: 300 }); tween(mouth, { scaleX: 1, scaleY: 1 }, { duration: 300 }); tween(self, { alpha: 0 }, { duration: 500, easing: tween.easeOut }); }; self.jumpscare = function () { self.alpha = 0; self.scale.set(0.1); tween(self, { alpha: 1, scaleX: 3, scaleY: 3 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { LK.setTimeout(function () { tween(self, { alpha: 0 }, { duration: 400, easing: tween.easeIn }); }, 200); } }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Constants var STATE_INTRO_DIALOGUE = 0; var STATE_INTRO = 1; var STATE_SIMON_TURN = 2; var STATE_PLAYER_TURN = 3; var STATE_GAME_OVER = 4; var COLOR_RED = 'Red'; var COLOR_GREEN = 'Green'; var COLOR_BLUE = 'Blue'; var COLOR_YELLOW = 'Yellow'; // Game variables var gameState = STATE_INTRO_DIALOGUE; var level = 1; var sequence = []; var playerSequence = []; var sequenceIndex = 0; var waitingForInput = false; var horrorIntensity = 0; var highScore = storage.highScore || 0; // Overlay for horror effects var overlay = game.addChild(LK.getAsset('backgroundOverlay', { anchorX: 0, anchorY: 0, alpha: 0 })); // Create Simon buttons var buttonSize = 400; var spacing = 50; var totalWidth = buttonSize * 2 + spacing; var totalHeight = buttonSize * 2 + spacing; var startX = (2048 - totalWidth) / 2 + buttonSize / 2; var startY = (2732 - totalHeight) / 2 + buttonSize / 2; var buttons = []; var buttonRed = game.addChild(new SimonButton(COLOR_RED, 'buttonSound1', 0)); buttonRed.x = startX; buttonRed.y = startY; buttons.push(buttonRed); var buttonGreen = game.addChild(new SimonButton(COLOR_GREEN, 'buttonSound2', 1)); buttonGreen.x = startX + buttonSize + spacing; buttonGreen.y = startY; buttons.push(buttonGreen); var buttonBlue = game.addChild(new SimonButton(COLOR_BLUE, 'buttonSound3', 2)); buttonBlue.x = startX; buttonBlue.y = startY + buttonSize + spacing; buttons.push(buttonBlue); var buttonYellow = game.addChild(new SimonButton(COLOR_YELLOW, 'buttonSound4', 3)); buttonYellow.x = startX + buttonSize + spacing; buttonYellow.y = startY + buttonSize + spacing; buttons.push(buttonYellow); // Create the sinister entity var entity = game.addChild(new SinisterEntity()); entity.x = 2048 / 2; entity.y = 2732 / 2; // Level text var levelText = new Text2('Level: 1', { size: 80, fill: 0xFF0000, font: "'Creepster', 'Chiller', 'Times New Roman'" }); levelText.anchor.set(0.5, 0); LK.gui.top.addChild(levelText); levelText.y = 100; // Score text var scoreText = new Text2('Score: 0', { size: 80, fill: 0xFF0000, font: "'Creepster', 'Chiller', 'Times New Roman'" }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); scoreText.y = 200; // High score text var highScoreText = new Text2('High Score: ' + highScore, { size: 80, fill: 0xFF0000, font: "'Creepster', 'Chiller', 'Times New Roman'" }); highScoreText.anchor.set(0.5, 0); LK.gui.top.addChild(highScoreText); highScoreText.y = 300; // Instructions text var instructionsText = new Text2('Watch the pattern, then repeat it', { size: 60, fill: 0xFF0000, font: "'Creepster', 'Chiller', 'Times New Roman'" }); instructionsText.anchor.set(0.5, 0); LK.gui.bottom.addChild(instructionsText); instructionsText.y = -150; // Status text var statusText = new Text2('Get ready...', { size: 85, fill: 0xFF0000, font: "'Creepster', 'Chiller', 'Times New Roman'" }); statusText.anchor.set(0.5, 0); LK.gui.center.addChild(statusText); statusText.y = -400; // Game functions function startGame() { LK.playMusic('horrorAmbience', { fade: { start: 0, end: 0.4, duration: 1000 } }); gameState = STATE_SIMON_TURN; level = 1; sequence = []; horrorIntensity = 0; updateLevel(); LK.setScore(0); updateScore(); generateSequence(); // Start the first round LK.setTimeout(function () { playSequence(); }, 1500); } function updateLevel() { levelText.setText('Level: ' + level); } function updateScore() { scoreText.setText('Score: ' + LK.getScore()); if (LK.getScore() > highScore) { highScore = LK.getScore(); storage.highScore = highScore; highScoreText.setText('High Score: ' + highScore); } } function generateSequence() { // Add a new step to the sequence sequence.push(Math.floor(Math.random() * 4)); playerSequence = []; sequenceIndex = 0; } function playSequence() { statusText.setText("Watch carefully..."); // Flash the entity briefly before showing the sequence // Intensity increases with level horrorIntensity = Math.min(level - 1, 10); entity.appear(horrorIntensity); // Start showing sequence after entity appears sequenceIndex = 0; waitingForInput = true; LK.setTimeout(function () { playNextInSequence(); }, 2000); } function playNextInSequence() { if (sequenceIndex < sequence.length) { buttons[sequence[sequenceIndex]].activate(); // Sequence timing gets faster as level increases var delay = Math.max(1000 - level * 50, 400); LK.setTimeout(function () { sequenceIndex++; playNextInSequence(); }, delay); } else { // Done showing sequence, player's turn LK.setTimeout(function () { waitingForInput = false; gameState = STATE_PLAYER_TURN; statusText.setText("Your turn!"); playerSequence = []; sequenceIndex = 0; }, 500); } } function checkPlayerInput() { var currentIndex = playerSequence.length - 1; if (playerSequence[currentIndex] !== sequence[currentIndex]) { // Wrong input gameOver(); return; } // If the player has completed the current sequence if (playerSequence.length === sequence.length) { // Level completed waitingForInput = true; LK.setScore(LK.getScore() + sequence.length); updateScore(); level++; updateLevel(); // Check if player has completed all 35 levels if (level > 35) { statusText.setText("You have escaped..."); LK.setTimeout(function () { LK.showYouWin(); }, 3000); return; } gameState = STATE_SIMON_TURN; // Horror effect between levels tween(overlay, { alpha: 0.7 }, { duration: 500, onFinish: function onFinish() { LK.getSound('levelUpSound').play(); LK.setTimeout(function () { tween(overlay, { alpha: 0 }, { duration: 500 }); }, 500); } }); statusText.setText("Level " + level + "!"); // Start next level after a delay LK.setTimeout(function () { generateSequence(); playSequence(); }, 2000); } } function gameOver() { gameState = STATE_GAME_OVER; // Jumpscare effect entity.jumpscare(); LK.getSound('errorSound').play(); // Flash screen red LK.effects.flashScreen(0xff0000, 800); statusText.setText("Game Over!"); LK.setTimeout(function () { LK.showGameOver(); }, 1500); } // Create keypad in top-right corner var keypad = game.addChild(new Keypad()); keypad.x = 2048 - 200; // Position from right edge keypad.y = 200; // Position from top keypad.scale.set(0.8); // Create shadow figure for intro var shadowFigure = game.addChild(new ShadowFigure()); shadowFigure.x = 2048 / 2; shadowFigure.y = 2732 / 2; // Start intro dialogue when loaded LK.setTimeout(function () { shadowFigure.startDialogue(); }, 1000); // Game update function game.update = function () { // Add subtle horror effects as the game progresses if (gameState !== STATE_GAME_OVER && level > 3) { // Random subtle screen flicker if (Math.random() < 0.005 * horrorIntensity) { tween(overlay, { alpha: 0.2 }, { duration: 100, onFinish: function onFinish() { tween(overlay, { alpha: 0 }, { duration: 100 }); } }); } // Random entity flicker at higher levels if (level > 5 && Math.random() < 0.002 * horrorIntensity && entity.alpha < 0.1) { tween(entity, { alpha: 0.3 }, { duration: 50, onFinish: function onFinish() { tween(entity, { alpha: 0 }, { duration: 50 }); } }); } } }; // Event handlers game.down = function (x, y, obj) { if (gameState === STATE_INTRO) { startGame(); } };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Keypad = Container.expand(function () {
var self = Container.call(this);
// Keypad background
var keypadBg = self.attachAsset('simonButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 2,
alpha: 1.0
});
// Create display for entered code
var codeDisplay = new Text2('', {
size: 60,
fill: 0x00FF00,
font: "'Courier New', monospace"
});
codeDisplay.anchor.set(0.5, 0.5);
codeDisplay.y = -140;
self.addChild(codeDisplay);
// Store entered code
self.currentCode = '';
// Create number buttons
var buttons = [];
var buttonSize = 80;
var spacing = 20;
var startX = -buttonSize - spacing;
var startY = -buttonSize - spacing;
// Make buttons visually interactive
function highlightButton(button) {
if (!button || !button.children || button.children.length === 0) {
return;
}
var bg = button.children[0]; // Get the button background
tween(bg, {
alpha: 1
}, {
duration: 100,
onFinish: function onFinish() {
tween(bg, {
alpha: 1.0
}, {
duration: 100
});
}
});
}
for (var i = 1; i <= 9; i++) {
var row = Math.floor((i - 1) / 3);
var col = (i - 1) % 3;
var button = new Container();
var buttonBg = button.attachAsset('simonButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.8,
alpha: 1.0
});
// Use keypad image assets instead of text
var numAsset = button.attachAsset('keypad' + i, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.8
});
button.x = startX + col * (buttonSize + spacing);
button.y = startY + row * (buttonSize + spacing);
button.num = i;
button.down = function (x, y, obj) {
if (obj && obj.num !== undefined) {
highlightButton(obj);
self.enterDigit(obj.num);
}
};
self.addChild(button);
buttons.push(button);
}
// Add 0 button
var zeroButton = new Container();
var zeroBg = zeroButton.attachAsset('simonButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.8,
alpha: 1.0
});
// Use keypad image asset for zero instead of text
var zeroAsset = zeroButton.attachAsset('keypad0', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.8
});
zeroButton.x = startX + 1 * (buttonSize + spacing);
zeroButton.y = startY + 3 * (buttonSize + spacing);
zeroButton.num = 0;
zeroButton.down = function (x, y, obj) {
highlightButton(obj);
self.enterDigit(obj.num);
};
self.addChild(zeroButton);
// Add clear button
var clearButton = new Container();
var clearBg = clearButton.attachAsset('simonButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.6,
scaleY: 0.6,
alpha: 1.0
});
var clearText = new Text2('C', {
size: 50,
fill: 0xFF0000,
font: "'Courier New', monospace"
});
clearText.anchor.set(0.5, 0.5);
clearButton.addChild(clearText);
clearButton.x = startX + 0 * (buttonSize + spacing);
clearButton.y = startY + 3 * (buttonSize + spacing);
clearButton.down = function (x, y, obj) {
highlightButton(obj);
self.clearCode();
};
self.addChild(clearButton);
// Add enter button
var enterButton = new Container();
var enterBg = enterButton.attachAsset('simonButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.6,
scaleY: 0.6,
alpha: 1.0
});
var enterText = new Text2('E', {
size: 50,
fill: 0x00FF00,
font: "'Courier New', monospace"
});
enterText.anchor.set(0.5, 0.5);
enterButton.addChild(enterText);
enterButton.x = startX + 2 * (buttonSize + spacing);
enterButton.y = startY + 3 * (buttonSize + spacing);
enterButton.down = function (x, y, obj) {
highlightButton(obj);
self.submitCode();
};
self.addChild(enterButton);
// Method to enter a digit
self.enterDigit = function (digit) {
if (self.currentCode.length < 4 && digit !== undefined) {
self.currentCode += digit.toString();
codeDisplay.setText(self.currentCode);
}
};
// Method to clear code
self.clearCode = function () {
self.currentCode = '';
codeDisplay.setText('');
};
// Method to submit code
self.submitCode = function () {
if (self.currentCode === '1197') {
// Correct code
tween(self, {
alpha: 0
}, {
duration: 1000,
onFinish: function onFinish() {
LK.setScore(LK.getScore() + 1000);
updateScore();
self.destroy();
}
});
} else {
// Wrong code
self.clearCode();
LK.effects.flashObject(self, 0xFF0000, 500);
}
};
return self;
});
var ShadowFigure = Container.expand(function () {
var self = Container.call(this);
// Dark shadow shape
var shadowShape = self.attachAsset('simonButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 5,
scaleY: 10,
alpha: 0.8
});
// Face elements similar to entity but with different positions/scales
var face = self.attachAsset('entityFace', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5,
alpha: 0.7
});
// Eyes
var leftEye = self.attachAsset('entityEye', {
anchorX: 0.5,
anchorY: 0.5,
x: -65,
y: -55,
scaleX: 1.2,
scaleY: 1.2,
alpha: 0.9
});
var rightEye = self.attachAsset('entityEye', {
anchorX: 0.5,
anchorY: 0.5,
x: 65,
y: -55,
scaleX: 1.2,
scaleY: 1.2,
alpha: 0.9
});
// Mouth
var mouth = self.attachAsset('entityMouth', {
anchorX: 0.5,
anchorY: 0.5,
y: 100,
scaleX: 1.4,
scaleY: 1.2,
alpha: 0.9
});
// Dialogue box
var dialogueBox = new Container();
dialogueBox.y = 350;
var dialogueBackground = dialogueBox.attachAsset('simonButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 4.5,
scaleY: 1.5,
alpha: 0.7
});
// Dialogue text
var dialogueText = new Text2('', {
size: 60,
fill: 0xFFFFFF,
font: "'Creepster', 'Chiller', 'Times New Roman'"
});
dialogueText.anchor.set(0.5, 0.5);
dialogueBox.addChild(dialogueText);
// Car crash image
var carCrashImage = new Container();
carCrashImage.y = -150;
carCrashImage.visible = false;
var crashBackground = carCrashImage.attachAsset('carCrashImage', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.0,
scaleY: 1.0,
alpha: 0.7
});
// Skip button
var skipButton = new Container();
var skipButtonBg = skipButton.attachAsset('simonButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.2,
scaleY: 0.5,
alpha: 0.7
});
var skipText = new Text2('SKIP', {
size: 60,
fill: 0xFFFFFF,
font: "'Creepster', 'Chiller', 'Times New Roman'"
});
skipText.anchor.set(0.5, 0.5);
skipButton.addChild(skipText);
skipButton.x = 800;
skipButton.y = 500;
// Add touch handler for skip button
skipButton.down = function (x, y, obj) {
self.endDialogue();
};
// Add everything to self
self.addChild(dialogueBox);
self.addChild(carCrashImage);
self.addChild(skipButton);
// Ensure car crash image is in front by setting its zIndex
carCrashImage.zIndex = 100;
// Starting state
self.alpha = 0;
// Method to start dialogue sequence
self.startDialogue = function () {
self.alpha = 0;
// Fade in sequence
tween(self, {
alpha: 1
}, {
duration: 2000,
easing: tween.easeIn,
onFinish: function onFinish() {
self.playDialogueSequence();
}
});
};
// Play the dialogue sequence
self.playDialogueSequence = function () {
var dialogues = ["Hello...", "Do you remember where you were before the incident?", "*shows blurry image of a person's perspective of driving a car*", "And now, you're here.", "I've been watching you for some time...", "Your thoughts, your fears, your regrets...", "They're all so... delicious.", "This place exists between reality and nightmare.", "A realm where I control everything.", "Your memories are fractured, aren't they?", "The crash wasn't your fault... or was it?", "The guilt you carry is what brought you to me.", "You must complete 35 levels of Simon Says to leave this place.", "With each level, a piece of your soul will return.", "Fail, and you'll remain here... forever.", "Others have tried before you. None have succeeded.", "Their echoes still linger in these walls.", "Can you hear them whispering?", "One last thing... I left you a clue in my words.", "The first letter represents a number... Look at them carefully.", "If you find the numbers, perhaps you can escape sooner.", "Remember, the first is one...", "The ninth is also one...", "The nineteenth is nine...", "And the twenty-first is seven...", "Follow the patterns. Don't make mistakes.", "Your sanity depends on it.", "Good luck.", "You'll need it.", "*shows devious smile before game starts*"];
var currentDialogue = 0;
function showNextDialogue() {
if (currentDialogue < dialogues.length) {
var dialogue = dialogues[currentDialogue];
// Special cases
if (dialogue.includes("*shows blurry image")) {
// Show car crash image
carCrashImage.visible = true;
tween(carCrashImage, {
alpha: 0.9
}, {
duration: 500
});
dialogueText.setText("");
} else if (dialogue.includes("*shows devious smile")) {
// Show evil smile
tween(mouth, {
scaleX: 2.5,
scaleY: 1.0
}, {
duration: 800
});
dialogueText.setText("");
} else {
// Hide car crash image if visible
if (carCrashImage.visible) {
tween(carCrashImage, {
alpha: 0
}, {
duration: 300,
onFinish: function onFinish() {
carCrashImage.visible = false;
}
});
}
// Normal dialogue
dialogueText.setText(dialogue);
}
currentDialogue++;
// Calculate delay - longer for showing images or evil smile
var delay = 3500; // Increased from 2000 to make dialogue slower
if (dialogue.includes("*")) {
delay = 5000; // Increased from 3000 for special scenes
}
// Schedule next dialogue
LK.setTimeout(showNextDialogue, delay);
} else {
// End of dialogue sequence
self.endDialogue();
}
}
// Start the dialogue sequence
showNextDialogue();
};
// End dialogue and transition to game
self.endDialogue = function () {
tween(self, {
alpha: 0
}, {
duration: 1500,
easing: tween.easeOut,
onFinish: function onFinish() {
startGame();
self.destroy();
}
});
};
return self;
});
var SimonButton = Container.expand(function (color, sound, id) {
var self = Container.call(this);
self.id = id;
self.isActive = false;
self.sound = sound;
var buttonGraphics = self.attachAsset('simonButton', {
anchorX: 0.5,
anchorY: 0.5
});
var activeButtonAsset = 'simonButton' + color;
var activeButtonGraphics = self.attachAsset(activeButtonAsset, {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0
});
self.activate = function () {
if (self.isActive) {
return;
}
self.isActive = true;
tween(activeButtonGraphics, {
alpha: 1
}, {
duration: 300,
onFinish: function onFinish() {
LK.getSound(self.sound).play();
tween(activeButtonGraphics, {
alpha: 0
}, {
duration: 300,
onFinish: function onFinish() {
self.isActive = false;
}
});
}
});
};
self.down = function (x, y, obj) {
if (gameState === STATE_PLAYER_TURN && !self.isActive && !waitingForInput) {
self.activate();
playerSequence.push(self.id);
checkPlayerInput();
}
};
return self;
});
var SinisterEntity = Container.expand(function () {
var self = Container.call(this);
// Face base
var face = self.attachAsset('entityFace', {
anchorX: 0.5,
anchorY: 0.5
});
// Left eye
var leftEye = self.attachAsset('entityEye', {
anchorX: 0.5,
anchorY: 0.5,
x: -75,
y: -50
});
// Right eye
var rightEye = self.attachAsset('entityEye', {
anchorX: 0.5,
anchorY: 0.5,
x: 75,
y: -50
});
// Mouth
var mouth = self.attachAsset('entityMouth', {
anchorX: 0.5,
anchorY: 0.5,
y: 80
});
self.alpha = 0;
self.appear = function (intensity) {
self.alpha = 0;
// Scale intensity from 0-10 to meaningful values
var duration = Math.max(1000 - intensity * 80, 200);
var scaleFactor = 1 + intensity * 0.1;
tween(self, {
alpha: 1
}, {
duration: duration,
easing: tween.easeIn,
onFinish: function onFinish() {
// Make eyes look at player
tween(leftEye, {
scaleX: 1.5,
scaleY: 1.5
}, {
duration: 300,
easing: tween.easeOut
});
tween(rightEye, {
scaleX: 1.5,
scaleY: 1.5
}, {
duration: 300,
easing: tween.easeOut
});
// Make mouth grow wider
tween(mouth, {
scaleX: 1.8,
scaleY: 0.8
}, {
duration: 500,
easing: tween.easeOut,
onFinish: function onFinish() {
if (intensity > 5) {
LK.getSound('creepyLaugh').play();
}
LK.setTimeout(function () {
self.disappear();
}, 1000);
}
});
}
});
};
self.disappear = function () {
tween(leftEye, {
scaleX: 1,
scaleY: 1
}, {
duration: 300
});
tween(rightEye, {
scaleX: 1,
scaleY: 1
}, {
duration: 300
});
tween(mouth, {
scaleX: 1,
scaleY: 1
}, {
duration: 300
});
tween(self, {
alpha: 0
}, {
duration: 500,
easing: tween.easeOut
});
};
self.jumpscare = function () {
self.alpha = 0;
self.scale.set(0.1);
tween(self, {
alpha: 1,
scaleX: 3,
scaleY: 3
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
LK.setTimeout(function () {
tween(self, {
alpha: 0
}, {
duration: 400,
easing: tween.easeIn
});
}, 200);
}
});
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Constants
var STATE_INTRO_DIALOGUE = 0;
var STATE_INTRO = 1;
var STATE_SIMON_TURN = 2;
var STATE_PLAYER_TURN = 3;
var STATE_GAME_OVER = 4;
var COLOR_RED = 'Red';
var COLOR_GREEN = 'Green';
var COLOR_BLUE = 'Blue';
var COLOR_YELLOW = 'Yellow';
// Game variables
var gameState = STATE_INTRO_DIALOGUE;
var level = 1;
var sequence = [];
var playerSequence = [];
var sequenceIndex = 0;
var waitingForInput = false;
var horrorIntensity = 0;
var highScore = storage.highScore || 0;
// Overlay for horror effects
var overlay = game.addChild(LK.getAsset('backgroundOverlay', {
anchorX: 0,
anchorY: 0,
alpha: 0
}));
// Create Simon buttons
var buttonSize = 400;
var spacing = 50;
var totalWidth = buttonSize * 2 + spacing;
var totalHeight = buttonSize * 2 + spacing;
var startX = (2048 - totalWidth) / 2 + buttonSize / 2;
var startY = (2732 - totalHeight) / 2 + buttonSize / 2;
var buttons = [];
var buttonRed = game.addChild(new SimonButton(COLOR_RED, 'buttonSound1', 0));
buttonRed.x = startX;
buttonRed.y = startY;
buttons.push(buttonRed);
var buttonGreen = game.addChild(new SimonButton(COLOR_GREEN, 'buttonSound2', 1));
buttonGreen.x = startX + buttonSize + spacing;
buttonGreen.y = startY;
buttons.push(buttonGreen);
var buttonBlue = game.addChild(new SimonButton(COLOR_BLUE, 'buttonSound3', 2));
buttonBlue.x = startX;
buttonBlue.y = startY + buttonSize + spacing;
buttons.push(buttonBlue);
var buttonYellow = game.addChild(new SimonButton(COLOR_YELLOW, 'buttonSound4', 3));
buttonYellow.x = startX + buttonSize + spacing;
buttonYellow.y = startY + buttonSize + spacing;
buttons.push(buttonYellow);
// Create the sinister entity
var entity = game.addChild(new SinisterEntity());
entity.x = 2048 / 2;
entity.y = 2732 / 2;
// Level text
var levelText = new Text2('Level: 1', {
size: 80,
fill: 0xFF0000,
font: "'Creepster', 'Chiller', 'Times New Roman'"
});
levelText.anchor.set(0.5, 0);
LK.gui.top.addChild(levelText);
levelText.y = 100;
// Score text
var scoreText = new Text2('Score: 0', {
size: 80,
fill: 0xFF0000,
font: "'Creepster', 'Chiller', 'Times New Roman'"
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
scoreText.y = 200;
// High score text
var highScoreText = new Text2('High Score: ' + highScore, {
size: 80,
fill: 0xFF0000,
font: "'Creepster', 'Chiller', 'Times New Roman'"
});
highScoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(highScoreText);
highScoreText.y = 300;
// Instructions text
var instructionsText = new Text2('Watch the pattern, then repeat it', {
size: 60,
fill: 0xFF0000,
font: "'Creepster', 'Chiller', 'Times New Roman'"
});
instructionsText.anchor.set(0.5, 0);
LK.gui.bottom.addChild(instructionsText);
instructionsText.y = -150;
// Status text
var statusText = new Text2('Get ready...', {
size: 85,
fill: 0xFF0000,
font: "'Creepster', 'Chiller', 'Times New Roman'"
});
statusText.anchor.set(0.5, 0);
LK.gui.center.addChild(statusText);
statusText.y = -400;
// Game functions
function startGame() {
LK.playMusic('horrorAmbience', {
fade: {
start: 0,
end: 0.4,
duration: 1000
}
});
gameState = STATE_SIMON_TURN;
level = 1;
sequence = [];
horrorIntensity = 0;
updateLevel();
LK.setScore(0);
updateScore();
generateSequence();
// Start the first round
LK.setTimeout(function () {
playSequence();
}, 1500);
}
function updateLevel() {
levelText.setText('Level: ' + level);
}
function updateScore() {
scoreText.setText('Score: ' + LK.getScore());
if (LK.getScore() > highScore) {
highScore = LK.getScore();
storage.highScore = highScore;
highScoreText.setText('High Score: ' + highScore);
}
}
function generateSequence() {
// Add a new step to the sequence
sequence.push(Math.floor(Math.random() * 4));
playerSequence = [];
sequenceIndex = 0;
}
function playSequence() {
statusText.setText("Watch carefully...");
// Flash the entity briefly before showing the sequence
// Intensity increases with level
horrorIntensity = Math.min(level - 1, 10);
entity.appear(horrorIntensity);
// Start showing sequence after entity appears
sequenceIndex = 0;
waitingForInput = true;
LK.setTimeout(function () {
playNextInSequence();
}, 2000);
}
function playNextInSequence() {
if (sequenceIndex < sequence.length) {
buttons[sequence[sequenceIndex]].activate();
// Sequence timing gets faster as level increases
var delay = Math.max(1000 - level * 50, 400);
LK.setTimeout(function () {
sequenceIndex++;
playNextInSequence();
}, delay);
} else {
// Done showing sequence, player's turn
LK.setTimeout(function () {
waitingForInput = false;
gameState = STATE_PLAYER_TURN;
statusText.setText("Your turn!");
playerSequence = [];
sequenceIndex = 0;
}, 500);
}
}
function checkPlayerInput() {
var currentIndex = playerSequence.length - 1;
if (playerSequence[currentIndex] !== sequence[currentIndex]) {
// Wrong input
gameOver();
return;
}
// If the player has completed the current sequence
if (playerSequence.length === sequence.length) {
// Level completed
waitingForInput = true;
LK.setScore(LK.getScore() + sequence.length);
updateScore();
level++;
updateLevel();
// Check if player has completed all 35 levels
if (level > 35) {
statusText.setText("You have escaped...");
LK.setTimeout(function () {
LK.showYouWin();
}, 3000);
return;
}
gameState = STATE_SIMON_TURN;
// Horror effect between levels
tween(overlay, {
alpha: 0.7
}, {
duration: 500,
onFinish: function onFinish() {
LK.getSound('levelUpSound').play();
LK.setTimeout(function () {
tween(overlay, {
alpha: 0
}, {
duration: 500
});
}, 500);
}
});
statusText.setText("Level " + level + "!");
// Start next level after a delay
LK.setTimeout(function () {
generateSequence();
playSequence();
}, 2000);
}
}
function gameOver() {
gameState = STATE_GAME_OVER;
// Jumpscare effect
entity.jumpscare();
LK.getSound('errorSound').play();
// Flash screen red
LK.effects.flashScreen(0xff0000, 800);
statusText.setText("Game Over!");
LK.setTimeout(function () {
LK.showGameOver();
}, 1500);
}
// Create keypad in top-right corner
var keypad = game.addChild(new Keypad());
keypad.x = 2048 - 200; // Position from right edge
keypad.y = 200; // Position from top
keypad.scale.set(0.8);
// Create shadow figure for intro
var shadowFigure = game.addChild(new ShadowFigure());
shadowFigure.x = 2048 / 2;
shadowFigure.y = 2732 / 2;
// Start intro dialogue when loaded
LK.setTimeout(function () {
shadowFigure.startDialogue();
}, 1000);
// Game update function
game.update = function () {
// Add subtle horror effects as the game progresses
if (gameState !== STATE_GAME_OVER && level > 3) {
// Random subtle screen flicker
if (Math.random() < 0.005 * horrorIntensity) {
tween(overlay, {
alpha: 0.2
}, {
duration: 100,
onFinish: function onFinish() {
tween(overlay, {
alpha: 0
}, {
duration: 100
});
}
});
}
// Random entity flicker at higher levels
if (level > 5 && Math.random() < 0.002 * horrorIntensity && entity.alpha < 0.1) {
tween(entity, {
alpha: 0.3
}, {
duration: 50,
onFinish: function onFinish() {
tween(entity, {
alpha: 0
}, {
duration: 50
});
}
});
}
}
};
// Event handlers
game.down = function (x, y, obj) {
if (gameState === STATE_INTRO) {
startGame();
}
};
creepy realistic eye. In-Game asset. 2d. High contrast. No shadows
realistic face with no eyes or mouth. In-Game asset. 2d. High contrast. No shadows
realistic mouth. In-Game asset. 2d. High contrast. No shadows
blurry realistic image of a car crash with backround. In-Game asset. 2d. High contrast. No shadows
number 0. In-Game asset. 2d. High contrast. No shadows
the number 1. In-Game asset. 2d. High contrast. No shadows