User prompt
Türkçede adı Çöp Adam olsun
User prompt
Henry Stickmin adını Stickman ile değiştir
User prompt
oyunun içinde lunge button yok
User prompt
oyuna bir buton koy bu buton dil butonu basınca dil değişisin sadce 2 dil olsun türkçe ingilizce ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
oyundaki butoları büyüt am a yazıları aynı kalsın
User prompt
hayır bulamaca değil henry stickmin in buradan çıkması için seçimler yapması lazım
Code edit (1 edits merged)
Please save this source code
User prompt
Henry Stickmin: Backrooms Escape
Initial prompt
Henry Stickmin : The Backrooms
/**** * Plugins ****/ var tween = LK.import("@upit/tween.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 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 * 120; 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 scenarios = [{ text: "Henry 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: "Henry 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: "Henry 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: "Henry 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: "Henry 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: "Henry 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: "Henry 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: "Henry 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: "Henry 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: "Henry 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); function initializeScenario() { if (scenario) { scenario.destroy(); } scenario = game.addChild(new Scenario()); scenario.x = 1024; scenario.y = 1366; if (currentLevel <= scenarios.length) { var currentScenario = scenarios[currentLevel - 1]; scenario.setScenario(currentScenario.text, currentScenario.choices); } else { LK.showYouWin(); } } function handleChoice(isCorrect) { if (isCorrect) { LK.getSound('success_sound').play(); LK.effects.flashScreen(0x00ff00, 500); currentLevel++; levelText.setText('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 () {};
===================================================================
--- original.js
+++ change.js
@@ -5,87 +5,63 @@
/****
* Classes
****/
-var Entity = Container.expand(function () {
+var ChoiceButton = Container.expand(function (text, isCorrect) {
var self = Container.call(this);
- var entityGraphics = self.attachAsset('entity', {
+ var button = self.attachAsset('choiceButton', {
anchorX: 0.5,
anchorY: 0.5
});
- self.speed = 2;
- self.direction = Math.random() * Math.PI * 2;
- self.detectionRange = 200;
- self.chaseSpeed = 3;
- self.isChasing = false;
- self.lastDirectionChange = 0;
- self.update = function () {
- if (LK.ticks - self.lastDirectionChange > 120) {
- self.direction += (Math.random() - 0.5) * 0.5;
- self.lastDirectionChange = LK.ticks;
- }
- var distanceToHenry = Math.sqrt(Math.pow(henry.x - self.x, 2) + Math.pow(henry.y - self.y, 2));
- if (distanceToHenry < self.detectionRange) {
- self.isChasing = true;
- var angleToHenry = Math.atan2(henry.y - self.y, henry.x - self.x);
- self.direction = angleToHenry;
- } else if (distanceToHenry > self.detectionRange * 2) {
- self.isChasing = false;
- }
- var currentSpeed = self.isChasing ? self.chaseSpeed : self.speed;
- var newX = self.x + Math.cos(self.direction) * currentSpeed;
- var newY = self.y + Math.sin(self.direction) * currentSpeed;
- if (isValidPosition(newX, newY)) {
- self.x = newX;
- self.y = newY;
- } else {
- self.direction += Math.PI;
- }
- if (self.isChasing && Math.random() < 0.02) {
- LK.getSound('entity_sound').play();
- }
+ 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 Henry = Container.expand(function () {
+var Scenario = Container.expand(function () {
var self = Container.call(this);
- var body = self.attachAsset('henry', {
+ var background = self.attachAsset('scenarioBackground', {
anchorX: 0.5,
- anchorY: 1.0
+ anchorY: 0.5
});
- self.speed = 4;
- self.isMoving = false;
- self.targetX = 0;
- self.targetY = 0;
- self.sanity = 100;
- self.moveTo = function (x, y) {
- if (self.isMoving) return;
- var gridX = Math.floor(x / GRID_SIZE) * GRID_SIZE + GRID_SIZE / 2;
- var gridY = Math.floor(y / GRID_SIZE) * GRID_SIZE + GRID_SIZE;
- if (!isValidPosition(gridX, gridY)) return;
- self.targetX = gridX;
- self.targetY = gridY;
- self.isMoving = true;
- LK.getSound('footstep').play();
- var distance = Math.sqrt(Math.pow(gridX - self.x, 2) + Math.pow(gridY - self.y, 2));
- var duration = distance / self.speed * 16.67;
- tween(self, {
- x: gridX,
- y: gridY
- }, {
- duration: duration,
- easing: tween.linear,
- onFinish: function onFinish() {
- self.isMoving = false;
- checkCollisions();
- }
- });
- };
- self.decreaseSanity = function (amount) {
- self.sanity = Math.max(0, self.sanity - amount);
- if (self.sanity <= 0) {
- LK.showGameOver();
+ 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 * 120;
+ self.choices.push(choice);
+ self.addChild(choice);
+ }
};
return self;
});
@@ -98,143 +74,170 @@
/****
* Game Code
****/
-var GRID_SIZE = 100;
-var ROOM_WIDTH = 20;
-var ROOM_HEIGHT = 27;
-var levelLayout = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1], [1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]];
-var walls = [];
-var floors = [];
-var entities = [];
-var henry;
-var exitDoor;
-var level = 1;
-var sanityText = new Text2('Sanity: 100', {
- size: 80,
- fill: 0x000000
-});
-sanityText.anchor.set(1, 0);
-LK.gui.topRight.addChild(sanityText);
+var currentLevel = 1;
+var scenario;
+var scenarios = [{
+ text: "Henry 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: "Henry 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: "Henry 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: "Henry 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: "Henry 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: "Henry 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: "Henry 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: "Henry 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: "Henry 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: "Henry 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, 0);
+levelText.anchor.set(0.5, 0);
LK.gui.top.addChild(levelText);
-function initializeLevel() {
- walls = [];
- floors = [];
- entities = [];
- for (var y = 0; y < ROOM_HEIGHT; y++) {
- for (var x = 0; x < ROOM_WIDTH; x++) {
- var cellType = levelLayout[y][x];
- var posX = x * GRID_SIZE + GRID_SIZE / 2;
- var posY = y * GRID_SIZE + GRID_SIZE / 2;
- if (cellType === 1) {
- var wall = LK.getAsset('wall', {
- x: posX,
- y: posY,
- anchorX: 0.5,
- anchorY: 0.5
- });
- walls.push(wall);
- game.addChild(wall);
- } else {
- var floor = LK.getAsset('floor', {
- x: posX,
- y: posY,
- anchorX: 0.5,
- anchorY: 0.5
- });
- floors.push(floor);
- game.addChild(floor);
- if (cellType === 2) {
- exitDoor = LK.getAsset('exit', {
- x: posX,
- y: posY + GRID_SIZE / 2,
- anchorX: 0.5,
- anchorY: 1.0
- });
- game.addChild(exitDoor);
- }
- }
- }
+function initializeScenario() {
+ if (scenario) {
+ scenario.destroy();
}
- henry = game.addChild(new Henry());
- henry.x = 1.5 * GRID_SIZE;
- henry.y = 1.5 * GRID_SIZE + GRID_SIZE / 2;
- for (var i = 0; i < Math.min(3 + level, 8); i++) {
- var entity = game.addChild(new Entity());
- var validPos = false;
- var attempts = 0;
- while (!validPos && attempts < 50) {
- var randomX = (2 + Math.floor(Math.random() * (ROOM_WIDTH - 4))) * GRID_SIZE + GRID_SIZE / 2;
- var randomY = (2 + Math.floor(Math.random() * (ROOM_HEIGHT - 4))) * GRID_SIZE + GRID_SIZE / 2;
- if (isValidPosition(randomX, randomY)) {
- var distanceToHenry = Math.sqrt(Math.pow(henry.x - randomX, 2) + Math.pow(henry.y - randomY, 2));
- if (distanceToHenry > 300) {
- entity.x = randomX;
- entity.y = randomY;
- entities.push(entity);
- validPos = true;
- }
- }
- attempts++;
- }
- if (!validPos) {
- entity.destroy();
- }
+ scenario = game.addChild(new Scenario());
+ scenario.x = 1024;
+ scenario.y = 1366;
+ if (currentLevel <= scenarios.length) {
+ var currentScenario = scenarios[currentLevel - 1];
+ scenario.setScenario(currentScenario.text, currentScenario.choices);
+ } else {
+ LK.showYouWin();
}
}
-function isValidPosition(x, y) {
- var gridX = Math.floor(x / GRID_SIZE);
- var gridY = Math.floor(y / GRID_SIZE);
- if (gridX < 0 || gridX >= ROOM_WIDTH || gridY < 0 || gridY >= ROOM_HEIGHT) {
- return false;
- }
- return levelLayout[gridY][gridX] !== 1;
-}
-function checkCollisions() {
- for (var i = 0; i < entities.length; i++) {
- var entity = entities[i];
- var distance = Math.sqrt(Math.pow(henry.x - entity.x, 2) + Math.pow(henry.y - entity.y, 2));
- if (distance < 50) {
- henry.decreaseSanity(20);
- LK.effects.flashScreen(0xFF0000, 500);
- break;
+function handleChoice(isCorrect) {
+ if (isCorrect) {
+ LK.getSound('success_sound').play();
+ LK.effects.flashScreen(0x00ff00, 500);
+ currentLevel++;
+ levelText.setText('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);
}
- if (exitDoor) {
- var exitDistance = Math.sqrt(Math.pow(henry.x - exitDoor.x, 2) + Math.pow(henry.y - exitDoor.y, 2));
- if (exitDistance < 60) {
- LK.getSound('exit_found').play();
- level++;
- levelText.setText('Level: ' + level);
- henry.sanity = Math.min(100, henry.sanity + 10);
- if (level >= 10) {
- LK.showYouWin();
- } else {
- for (var j = 0; j < entities.length; j++) {
- entities[j].destroy();
- }
- if (exitDoor) {
- exitDoor.destroy();
- }
- initializeLevel();
- }
- }
- }
}
-initializeLevel();
-game.down = function (x, y, obj) {
- henry.moveTo(x, y);
-};
-game.update = function () {
- sanityText.setText('Sanity: ' + henry.sanity);
- if (LK.ticks % 300 === 0 && henry.sanity > 0) {
- henry.decreaseSanity(1);
- }
- for (var i = 0; i < entities.length; i++) {
- entities[i].update();
- }
-};
\ No newline at end of file
+initializeScenario();
+game.update = function () {};
\ No newline at end of file