/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var ChoiceButton = Container.expand(function (text, isCorrect) { var self = Container.call(this); var button = self.attachAsset('choiceButton', { anchorX: 0.5, anchorY: 0.5 }); var buttonText = new Text2(text, { size: 40, fill: 0xffffff }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.isCorrect = isCorrect; self.down = function (x, y, obj) { LK.getSound('choice_select').play(); handleChoice(self.isCorrect); }; return self; }); var LanguageButton = Container.expand(function () { var self = Container.call(this); var button = self.attachAsset('languageButton', { anchorX: 0.5, anchorY: 0.5 }); var currentLanguage = storage.language || 'en'; self.buttonText = new Text2(currentLanguage === 'en' ? 'EN' : 'TR', { size: 30, fill: 0xffffff }); self.buttonText.anchor.set(0.5, 0.5); self.addChild(self.buttonText); self.down = function (x, y, obj) { currentLanguage = currentLanguage === 'en' ? 'tr' : 'en'; storage.language = currentLanguage; self.buttonText.setText(currentLanguage === 'en' ? 'EN' : 'TR'); updateLanguage(); }; return self; }); var Scenario = Container.expand(function () { var self = Container.call(this); var background = self.attachAsset('scenarioBackground', { anchorX: 0.5, anchorY: 0.5 }); var henry = self.attachAsset('henry', { anchorX: 0.5, anchorY: 1.0, x: -200, y: 100 }); self.scenarioText = new Text2('', { size: 50, fill: 0x000000, wordWrap: true, wordWrapWidth: 1600 }); self.scenarioText.anchor.set(0.5, 0); self.scenarioText.x = 0; self.scenarioText.y = -500; self.addChild(self.scenarioText); self.choices = []; self.setScenario = function (text, choiceData) { self.scenarioText.setText(text); for (var i = 0; i < self.choices.length; i++) { self.choices[i].destroy(); } self.choices = []; for (var j = 0; j < choiceData.length; j++) { var choice = new ChoiceButton(choiceData[j].text, choiceData[j].correct); choice.x = 0; choice.y = 200 + j * 160; self.choices.push(choice); self.addChild(choice); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xFFFF99 }); /**** * Game Code ****/ var currentLevel = 1; var scenario; var languageButton; var translations = { en: { level: 'Level: ', scenarios: [{ text: "Stickman finds himself in the yellow hallways of the Backrooms. He hears strange noises ahead. What should he do?", choices: ["Investigate the noise cautiously", "Run away immediately", "Call out loudly"] }, { text: "Stickman discovers a flickering light switch. The darkness ahead seems endless.", choices: ["Turn off the lights to hide", "Keep the lights on and proceed", "Break the light switch"] }, { text: "Stickman encounters a door with strange markings. It's slightly ajar.", choices: ["Enter through the door carefully", "Slam the door shut", "Mark the door and continue"] }, { text: "Stickman hears footsteps behind him but sees nothing when he turns around.", choices: ["Hide and wait quietly", "Shout 'Who's there?'", "Start running"] }, { text: "Stickman finds a maintenance panel with buttons. One is glowing red.", choices: ["Press the glowing red button", "Look for another way around", "Try to break the panel"] }, { text: "Stickman discovers an elevator. The buttons show floor -1, 0, and 1.", choices: ["Press floor 1 to go up", "Press floor -1 to go deeper", "Stay on floor 0"] }, { text: "Stickman sees an entity in the distance. It hasn't noticed him yet.", choices: ["Quietly back away", "Try to communicate", "Throw something to distract it"] }, { text: "Stickman finds a staircase leading up. There's also a ventilation shaft.", choices: ["Take the staircase", "Crawl through the vent", "Wait here for help"] }, { text: "Stickman reaches what appears to be an exit, but it feels too easy.", choices: ["Examine the exit carefully first", "Rush through immediately", "Look for another exit"] }, { text: "Stickman sees a bright light ahead. This could be his final escape from the Backrooms.", choices: ["Walk towards the light confidently", "Approach with extreme caution", "Turn back and find another way"] }] }, tr: { level: 'Seviye: ', scenarios: [{ text: "Çöp Adam kendini Backrooms'un sarı koridorlarında bulur. Önünden garip sesler duyar. Ne yapmalı?", choices: ["Sesi dikkatli bir şekilde araştır", "Hemen kaç", "Yüksek sesle bağır"] }, { text: "Çöp Adam yanıp sönen bir ışık anahtarı keşfeder. Önündeki karanlık sonsuz görünüyor.", choices: ["Saklanmak için ışıkları kapat", "Işıkları açık tut ve devam et", "Işık anahtarını kır"] }, { text: "Çöp Adam garip işaretleri olan bir kapıyla karşılaşır. Kapı hafif aralık.", choices: ["Kapıdan dikkatli bir şekilde gir", "Kapıyı sertçe kapat", "Kapıyı işaretle ve devam et"] }, { text: "Çöp Adam arkasından ayak sesleri duyar ama döndüğünde hiçbir şey görmez.", choices: ["Saklan ve sessizce bekle", "'Kim var orada?' diye bağır", "Koşmaya başla"] }, { text: "Çöp Adam düğmeleri olan bir bakım paneli bulur. Biri kırmızı yanıyor.", choices: ["Kırmızı düğmeye bas", "Başka bir yol ara", "Paneli kırmaya çalış"] }, { text: "Çöp Adam bir asansör keşfeder. Düğmeler -1, 0 ve 1. katları gösteriyor.", choices: ["Yukarı çıkmak için 1. kata bas", "Daha derine inmek için -1'e bas", "0. katta kal"] }, { text: "Çöp Adam uzakta bir varlık görür. Henüz onu fark etmemiş.", choices: ["Sessizce geri çekil", "İletişim kurmaya çalış", "Dikkatini dağıtmak için bir şey fırlat"] }, { text: "Çöp Adam yukarı çıkan bir merdiven bulur. Ayrıca bir havalandırma kanalı var.", choices: ["Merdiveni kullan", "Havalandırma kanalından sürün", "Burada yardım bekle"] }, { text: "Çöp Adam çıkış gibi görünen bir yere ulaşır, ama bu çok kolay görünüyor.", choices: ["Önce çıkışı dikkatli incele", "Hemen koşarak geç", "Başka bir çıkış ara"] }, { text: "Çöp Adam önünde parlak bir ışık görür. Bu Backrooms'tan son kaçışı olabilir.", choices: ["Işığa doğru güvenle yürü", "Aşırı dikkatli yaklaş", "Geri dön ve başka yol bul"] }] } }; function getCurrentLanguage() { return storage.language || 'en'; } function updateLanguage() { var lang = getCurrentLanguage(); levelText.setText(translations[lang].level + currentLevel); if (scenario && currentLevel <= translations[lang].scenarios.length) { var currentScenario = translations[lang].scenarios[currentLevel - 1]; scenario.setScenario(currentScenario.text, currentScenario.choices.map(function (choice, index) { return { text: choice, correct: scenarios[currentLevel - 1].choices[index].correct }; })); } } var scenarios = [{ text: "Stickman finds himself in the yellow hallways of the Backrooms. He hears strange noises ahead. What should he do?", choices: [{ text: "Investigate the noise cautiously", correct: true }, { text: "Run away immediately", correct: false }, { text: "Call out loudly", correct: false }] }, { text: "Stickman discovers a flickering light switch. The darkness ahead seems endless.", choices: [{ text: "Turn off the lights to hide", correct: false }, { text: "Keep the lights on and proceed", correct: true }, { text: "Break the light switch", correct: false }] }, { text: "Stickman encounters a door with strange markings. It's slightly ajar.", choices: [{ text: "Enter through the door carefully", correct: true }, { text: "Slam the door shut", correct: false }, { text: "Mark the door and continue", correct: false }] }, { text: "Stickman hears footsteps behind him but sees nothing when he turns around.", choices: [{ text: "Hide and wait quietly", correct: true }, { text: "Shout 'Who's there?'", correct: false }, { text: "Start running", correct: false }] }, { text: "Stickman finds a maintenance panel with buttons. One is glowing red.", choices: [{ text: "Press the glowing red button", correct: false }, { text: "Look for another way around", correct: true }, { text: "Try to break the panel", correct: false }] }, { text: "Stickman discovers an elevator. The buttons show floor -1, 0, and 1.", choices: [{ text: "Press floor 1 to go up", correct: true }, { text: "Press floor -1 to go deeper", correct: false }, { text: "Stay on floor 0", correct: false }] }, { text: "Stickman sees an entity in the distance. It hasn't noticed him yet.", choices: [{ text: "Quietly back away", correct: true }, { text: "Try to communicate", correct: false }, { text: "Throw something to distract it", correct: false }] }, { text: "Stickman finds a staircase leading up. There's also a ventilation shaft.", choices: [{ text: "Take the staircase", correct: true }, { text: "Crawl through the vent", correct: false }, { text: "Wait here for help", correct: false }] }, { text: "Stickman reaches what appears to be an exit, but it feels too easy.", choices: [{ text: "Examine the exit carefully first", correct: true }, { text: "Rush through immediately", correct: false }, { text: "Look for another exit", correct: false }] }, { text: "Stickman sees a bright light ahead. This could be his final escape from the Backrooms.", choices: [{ text: "Walk towards the light confidently", correct: true }, { text: "Approach with extreme caution", correct: false }, { text: "Turn back and find another way", correct: false }] }]; var levelText = new Text2('Level: 1', { size: 80, fill: 0x000000 }); levelText.anchor.set(0.5, 0); LK.gui.top.addChild(levelText); languageButton = new LanguageButton(); languageButton.x = -60; languageButton.y = 40; LK.gui.topRight.addChild(languageButton); function initializeScenario() { if (scenario) { scenario.destroy(); } scenario = game.addChild(new Scenario()); scenario.x = 1024; scenario.y = 1366; var lang = getCurrentLanguage(); levelText.setText(translations[lang].level + currentLevel); if (currentLevel <= scenarios.length) { var currentScenario = translations[lang].scenarios[currentLevel - 1]; var choiceData = currentScenario.choices.map(function (choice, index) { return { text: choice, correct: scenarios[currentLevel - 1].choices[index].correct }; }); scenario.setScenario(currentScenario.text, choiceData); } else { LK.showYouWin(); } } function handleChoice(isCorrect) { if (isCorrect) { LK.getSound('success_sound').play(); LK.effects.flashScreen(0x00ff00, 500); currentLevel++; var lang = getCurrentLanguage(); levelText.setText(translations[lang].level + currentLevel); if (currentLevel > scenarios.length) { LK.showYouWin(); } else { LK.setTimeout(function () { initializeScenario(); }, 1000); } } else { LK.getSound('fail_sound').play(); LK.effects.flashScreen(0xff0000, 500); LK.setTimeout(function () { LK.showGameOver(); }, 1000); } } initializeScenario(); game.update = function () {};
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var ChoiceButton = Container.expand(function (text, isCorrect) {
var self = Container.call(this);
var button = self.attachAsset('choiceButton', {
anchorX: 0.5,
anchorY: 0.5
});
var buttonText = new Text2(text, {
size: 40,
fill: 0xffffff
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.isCorrect = isCorrect;
self.down = function (x, y, obj) {
LK.getSound('choice_select').play();
handleChoice(self.isCorrect);
};
return self;
});
var LanguageButton = Container.expand(function () {
var self = Container.call(this);
var button = self.attachAsset('languageButton', {
anchorX: 0.5,
anchorY: 0.5
});
var currentLanguage = storage.language || 'en';
self.buttonText = new Text2(currentLanguage === 'en' ? 'EN' : 'TR', {
size: 30,
fill: 0xffffff
});
self.buttonText.anchor.set(0.5, 0.5);
self.addChild(self.buttonText);
self.down = function (x, y, obj) {
currentLanguage = currentLanguage === 'en' ? 'tr' : 'en';
storage.language = currentLanguage;
self.buttonText.setText(currentLanguage === 'en' ? 'EN' : 'TR');
updateLanguage();
};
return self;
});
var Scenario = Container.expand(function () {
var self = Container.call(this);
var background = self.attachAsset('scenarioBackground', {
anchorX: 0.5,
anchorY: 0.5
});
var henry = self.attachAsset('henry', {
anchorX: 0.5,
anchorY: 1.0,
x: -200,
y: 100
});
self.scenarioText = new Text2('', {
size: 50,
fill: 0x000000,
wordWrap: true,
wordWrapWidth: 1600
});
self.scenarioText.anchor.set(0.5, 0);
self.scenarioText.x = 0;
self.scenarioText.y = -500;
self.addChild(self.scenarioText);
self.choices = [];
self.setScenario = function (text, choiceData) {
self.scenarioText.setText(text);
for (var i = 0; i < self.choices.length; i++) {
self.choices[i].destroy();
}
self.choices = [];
for (var j = 0; j < choiceData.length; j++) {
var choice = new ChoiceButton(choiceData[j].text, choiceData[j].correct);
choice.x = 0;
choice.y = 200 + j * 160;
self.choices.push(choice);
self.addChild(choice);
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xFFFF99
});
/****
* Game Code
****/
var currentLevel = 1;
var scenario;
var languageButton;
var translations = {
en: {
level: 'Level: ',
scenarios: [{
text: "Stickman finds himself in the yellow hallways of the Backrooms. He hears strange noises ahead. What should he do?",
choices: ["Investigate the noise cautiously", "Run away immediately", "Call out loudly"]
}, {
text: "Stickman discovers a flickering light switch. The darkness ahead seems endless.",
choices: ["Turn off the lights to hide", "Keep the lights on and proceed", "Break the light switch"]
}, {
text: "Stickman encounters a door with strange markings. It's slightly ajar.",
choices: ["Enter through the door carefully", "Slam the door shut", "Mark the door and continue"]
}, {
text: "Stickman hears footsteps behind him but sees nothing when he turns around.",
choices: ["Hide and wait quietly", "Shout 'Who's there?'", "Start running"]
}, {
text: "Stickman finds a maintenance panel with buttons. One is glowing red.",
choices: ["Press the glowing red button", "Look for another way around", "Try to break the panel"]
}, {
text: "Stickman discovers an elevator. The buttons show floor -1, 0, and 1.",
choices: ["Press floor 1 to go up", "Press floor -1 to go deeper", "Stay on floor 0"]
}, {
text: "Stickman sees an entity in the distance. It hasn't noticed him yet.",
choices: ["Quietly back away", "Try to communicate", "Throw something to distract it"]
}, {
text: "Stickman finds a staircase leading up. There's also a ventilation shaft.",
choices: ["Take the staircase", "Crawl through the vent", "Wait here for help"]
}, {
text: "Stickman reaches what appears to be an exit, but it feels too easy.",
choices: ["Examine the exit carefully first", "Rush through immediately", "Look for another exit"]
}, {
text: "Stickman sees a bright light ahead. This could be his final escape from the Backrooms.",
choices: ["Walk towards the light confidently", "Approach with extreme caution", "Turn back and find another way"]
}]
},
tr: {
level: 'Seviye: ',
scenarios: [{
text: "Çöp Adam kendini Backrooms'un sarı koridorlarında bulur. Önünden garip sesler duyar. Ne yapmalı?",
choices: ["Sesi dikkatli bir şekilde araştır", "Hemen kaç", "Yüksek sesle bağır"]
}, {
text: "Çöp Adam yanıp sönen bir ışık anahtarı keşfeder. Önündeki karanlık sonsuz görünüyor.",
choices: ["Saklanmak için ışıkları kapat", "Işıkları açık tut ve devam et", "Işık anahtarını kır"]
}, {
text: "Çöp Adam garip işaretleri olan bir kapıyla karşılaşır. Kapı hafif aralık.",
choices: ["Kapıdan dikkatli bir şekilde gir", "Kapıyı sertçe kapat", "Kapıyı işaretle ve devam et"]
}, {
text: "Çöp Adam arkasından ayak sesleri duyar ama döndüğünde hiçbir şey görmez.",
choices: ["Saklan ve sessizce bekle", "'Kim var orada?' diye bağır", "Koşmaya başla"]
}, {
text: "Çöp Adam düğmeleri olan bir bakım paneli bulur. Biri kırmızı yanıyor.",
choices: ["Kırmızı düğmeye bas", "Başka bir yol ara", "Paneli kırmaya çalış"]
}, {
text: "Çöp Adam bir asansör keşfeder. Düğmeler -1, 0 ve 1. katları gösteriyor.",
choices: ["Yukarı çıkmak için 1. kata bas", "Daha derine inmek için -1'e bas", "0. katta kal"]
}, {
text: "Çöp Adam uzakta bir varlık görür. Henüz onu fark etmemiş.",
choices: ["Sessizce geri çekil", "İletişim kurmaya çalış", "Dikkatini dağıtmak için bir şey fırlat"]
}, {
text: "Çöp Adam yukarı çıkan bir merdiven bulur. Ayrıca bir havalandırma kanalı var.",
choices: ["Merdiveni kullan", "Havalandırma kanalından sürün", "Burada yardım bekle"]
}, {
text: "Çöp Adam çıkış gibi görünen bir yere ulaşır, ama bu çok kolay görünüyor.",
choices: ["Önce çıkışı dikkatli incele", "Hemen koşarak geç", "Başka bir çıkış ara"]
}, {
text: "Çöp Adam önünde parlak bir ışık görür. Bu Backrooms'tan son kaçışı olabilir.",
choices: ["Işığa doğru güvenle yürü", "Aşırı dikkatli yaklaş", "Geri dön ve başka yol bul"]
}]
}
};
function getCurrentLanguage() {
return storage.language || 'en';
}
function updateLanguage() {
var lang = getCurrentLanguage();
levelText.setText(translations[lang].level + currentLevel);
if (scenario && currentLevel <= translations[lang].scenarios.length) {
var currentScenario = translations[lang].scenarios[currentLevel - 1];
scenario.setScenario(currentScenario.text, currentScenario.choices.map(function (choice, index) {
return {
text: choice,
correct: scenarios[currentLevel - 1].choices[index].correct
};
}));
}
}
var scenarios = [{
text: "Stickman finds himself in the yellow hallways of the Backrooms. He hears strange noises ahead. What should he do?",
choices: [{
text: "Investigate the noise cautiously",
correct: true
}, {
text: "Run away immediately",
correct: false
}, {
text: "Call out loudly",
correct: false
}]
}, {
text: "Stickman discovers a flickering light switch. The darkness ahead seems endless.",
choices: [{
text: "Turn off the lights to hide",
correct: false
}, {
text: "Keep the lights on and proceed",
correct: true
}, {
text: "Break the light switch",
correct: false
}]
}, {
text: "Stickman encounters a door with strange markings. It's slightly ajar.",
choices: [{
text: "Enter through the door carefully",
correct: true
}, {
text: "Slam the door shut",
correct: false
}, {
text: "Mark the door and continue",
correct: false
}]
}, {
text: "Stickman hears footsteps behind him but sees nothing when he turns around.",
choices: [{
text: "Hide and wait quietly",
correct: true
}, {
text: "Shout 'Who's there?'",
correct: false
}, {
text: "Start running",
correct: false
}]
}, {
text: "Stickman finds a maintenance panel with buttons. One is glowing red.",
choices: [{
text: "Press the glowing red button",
correct: false
}, {
text: "Look for another way around",
correct: true
}, {
text: "Try to break the panel",
correct: false
}]
}, {
text: "Stickman discovers an elevator. The buttons show floor -1, 0, and 1.",
choices: [{
text: "Press floor 1 to go up",
correct: true
}, {
text: "Press floor -1 to go deeper",
correct: false
}, {
text: "Stay on floor 0",
correct: false
}]
}, {
text: "Stickman sees an entity in the distance. It hasn't noticed him yet.",
choices: [{
text: "Quietly back away",
correct: true
}, {
text: "Try to communicate",
correct: false
}, {
text: "Throw something to distract it",
correct: false
}]
}, {
text: "Stickman finds a staircase leading up. There's also a ventilation shaft.",
choices: [{
text: "Take the staircase",
correct: true
}, {
text: "Crawl through the vent",
correct: false
}, {
text: "Wait here for help",
correct: false
}]
}, {
text: "Stickman reaches what appears to be an exit, but it feels too easy.",
choices: [{
text: "Examine the exit carefully first",
correct: true
}, {
text: "Rush through immediately",
correct: false
}, {
text: "Look for another exit",
correct: false
}]
}, {
text: "Stickman sees a bright light ahead. This could be his final escape from the Backrooms.",
choices: [{
text: "Walk towards the light confidently",
correct: true
}, {
text: "Approach with extreme caution",
correct: false
}, {
text: "Turn back and find another way",
correct: false
}]
}];
var levelText = new Text2('Level: 1', {
size: 80,
fill: 0x000000
});
levelText.anchor.set(0.5, 0);
LK.gui.top.addChild(levelText);
languageButton = new LanguageButton();
languageButton.x = -60;
languageButton.y = 40;
LK.gui.topRight.addChild(languageButton);
function initializeScenario() {
if (scenario) {
scenario.destroy();
}
scenario = game.addChild(new Scenario());
scenario.x = 1024;
scenario.y = 1366;
var lang = getCurrentLanguage();
levelText.setText(translations[lang].level + currentLevel);
if (currentLevel <= scenarios.length) {
var currentScenario = translations[lang].scenarios[currentLevel - 1];
var choiceData = currentScenario.choices.map(function (choice, index) {
return {
text: choice,
correct: scenarios[currentLevel - 1].choices[index].correct
};
});
scenario.setScenario(currentScenario.text, choiceData);
} else {
LK.showYouWin();
}
}
function handleChoice(isCorrect) {
if (isCorrect) {
LK.getSound('success_sound').play();
LK.effects.flashScreen(0x00ff00, 500);
currentLevel++;
var lang = getCurrentLanguage();
levelText.setText(translations[lang].level + currentLevel);
if (currentLevel > scenarios.length) {
LK.showYouWin();
} else {
LK.setTimeout(function () {
initializeScenario();
}, 1000);
}
} else {
LK.getSound('fail_sound').play();
LK.effects.flashScreen(0xff0000, 500);
LK.setTimeout(function () {
LK.showGameOver();
}, 1000);
}
}
initializeScenario();
game.update = function () {};