/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var AIDialogue = Container.expand(function () {
var self = Container.call(this);
var panelBg = self.attachAsset('aiPanel', {
anchorX: 0.5,
anchorY: 0.5
});
panelBg.alpha = 0.85;
var glowBg = LK.getAsset('aiPanel', {
anchorX: 0.5,
anchorY: 0.5
});
glowBg.alpha = 0.3;
glowBg.tint = 0x2A9D8F;
self.addChild(glowBg);
var aiText = new Text2('', {
size: 36,
fill: 0xE0E0E0
});
aiText.anchor.set(0.5, 0);
self.addChild(aiText);
var headerText = new Text2('AI ENTITY', {
size: 32,
fill: 0x2A9D8F
});
headerText.anchor.set(0.5, 0);
self.addChild(headerText);
self.display = function (message) {
aiText.setText(message);
headerText.y = -220;
aiText.y = -180;
tween(aiText, {
alpha: 0.5
}, {
duration: 300
});
tween(aiText, {
alpha: 1
}, {
duration: 300,
delay: 100
});
};
self.getRandomDialogue = function (stage) {
var dialogues = dialogueLibrary[gameState.language]['stage' + stage];
return dialogues[Math.floor(Math.random() * dialogues.length)];
};
self.pulseGlow = function () {
tween(glowBg, {
alpha: 0.5
}, {
duration: 800,
easing: tween.easeInOut
});
tween(glowBg, {
alpha: 0.3
}, {
duration: 800,
delay: 800,
easing: tween.easeInOut
});
}; //{pulse_glow}
return self;
});
var AuthorityButton = Container.expand(function () {
var self = Container.call(this);
var bg = self.attachAsset('authorityButton', {
anchorX: 0.5,
anchorY: 0.5
});
bg.alpha = 0.8;
var glowLayer = LK.getAsset('authorityButton', {
anchorX: 0.5,
anchorY: 0.5
});
glowLayer.alpha = 0;
glowLayer.tint = 0xd62828;
self.addChild(glowLayer);
var btnText = new Text2(dialogueLibrary[gameState.language].authority, {
size: 28,
fill: 0xFFFFFF
});
btnText.anchor.set(0.5, 0.5);
self.addChild(btnText);
self.isUnlocked = false;
self.interactive = false;
self.pulseAnimation = null;
self.unlock = function () {
self.isUnlocked = true;
self.interactive = true;
bg.tint = 0x2ecc71;
glowLayer.tint = 0x2ecc71;
btnText.setText(dialogueLibrary[gameState.language].unlocked);
self.startPulse();
};
self.startPulse = function () {
if (self.pulseAnimation) return;
self.pulseAnimation = setInterval(function () {
if (self.isUnlocked) {
tween(glowLayer, {
alpha: 0.4
}, {
duration: 600,
easing: tween.easeInOut
});
tween(glowLayer, {
alpha: 0
}, {
duration: 600,
delay: 600,
easing: tween.easeInOut
});
}
}, 1200);
};
self.down = function (x, y, obj) {
if (self.isUnlocked) {
tween(self, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 150
});
tween(self, {
scaleX: 1,
scaleY: 1
}, {
duration: 150,
delay: 150
});
self.onPressed();
}
};
self.onPressed = function () {
// Override in game code
};
return self;
});
var EmotionalLoad = Container.expand(function () {
var self = Container.call(this);
var bgBar = self.attachAsset('emotionalBar', {
anchorX: 0.5,
anchorY: 0.5
});
bgBar.alpha = 0.6;
var fillBar = LK.getAsset('emotionalFill', {
anchorX: 0,
anchorY: 0.5
});
fillBar.alpha = 0.9;
self.addChild(fillBar);
var labelText = new Text2(dialogueLibrary[gameState.language].emotional + ': 0%', {
size: 28,
fill: 0xFFFFFF
});
labelText.anchor.set(0.5, 0.5);
self.addChild(labelText);
self.updateLoad = function (value) {
gameState.emotionalLoad = Math.min(100, Math.max(0, value));
var newWidth = gameState.emotionalLoad / 100 * 1600;
tween(fillBar, {
width: newWidth
}, {
duration: 400,
easing: tween.easeOut
});
if (gameState.emotionalLoad < 33) {
tween(fillBar, {
tint: 0x2ecc71
}, {
duration: 300
});
} else if (gameState.emotionalLoad < 66) {
tween(fillBar, {
tint: 0xf39c12
}, {
duration: 300
});
} else {
tween(fillBar, {
tint: 0xff6b6b
}, {
duration: 300
});
}
labelText.setText(dialogueLibrary[gameState.language].emotional + ': ' + Math.round(gameState.emotionalLoad) + '%');
if (gameState.emotionalLoad > 70) {
tween(labelText, {
scale: 1.1
}, {
duration: 300
});
tween(labelText, {
scale: 1
}, {
duration: 300,
delay: 300
});
}
};
self.increment = function (amount) {
self.updateLoad(gameState.emotionalLoad + amount);
};
self.updateLoad(0);
return self;
});
var StageIndicator = Container.expand(function () {
var self = Container.call(this);
var bg = self.attachAsset('stageIndicator', {
anchorX: 0.5,
anchorY: 0.5
});
bg.alpha = 0.8;
var glowRing = LK.getAsset('stageIndicator', {
anchorX: 0.5,
anchorY: 0.5
});
glowRing.alpha = 0.2;
glowRing.tint = 0x2A9D8F;
self.addChild(glowRing);
var stageText = new Text2(dialogueLibrary[gameState.language].stage + '\n1', {
size: 36,
fill: 0xFFFFFF
});
stageText.anchor.set(0.5, 0.5);
self.addChild(stageText);
self.updateStage = function (stage) {
tween(self, {
scaleX: 1.15,
scaleY: 1.15
}, {
duration: 300,
easing: tween.easeOut
});
tween(self, {
scaleX: 1,
scaleY: 1
}, {
duration: 300,
delay: 300,
easing: tween.easeOut
});
tween(glowRing, {
alpha: 0.5
}, {
duration: 400
});
tween(glowRing, {
alpha: 0.2
}, {
duration: 400,
delay: 400
});
stageText.setText(dialogueLibrary[gameState.language].stage + '\n' + stage);
};
return self;
});
var Task = Container.expand(function () {
var self = Container.call(this);
var panelBg = self.attachAsset('taskPanel', {
anchorX: 0.5,
anchorY: 0.5
});
panelBg.alpha = 0.85;
var taskText = new Text2('', {
size: 40,
fill: 0xFFFFFF
});
taskText.anchor.set(0.5, 0);
self.addChild(taskText);
var approveBtn = LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5
});
approveBtn.alpha = 0.85;
approveBtn.tint = 0x2ecc71;
var approveLabel = new Text2(dialogueLibrary[gameState.language].approve, {
size: 28,
fill: 0xFFFFFF
});
approveLabel.anchor.set(0.5, 0.5);
approveBtn.addChild(approveLabel);
approveBtn.interactive = true;
approveBtn.down = function () {
tween(approveBtn, {
scaleX: 1.08,
scaleY: 1.08
}, {
duration: 150
});
tween(approveBtn, {
scaleX: 1,
scaleY: 1
}, {
duration: 150,
delay: 150
});
};
self.addChild(approveBtn);
var denyBtn = LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5
});
denyBtn.tint = 0xff6b6b;
denyBtn.alpha = 0.85;
var denyLabel = new Text2(dialogueLibrary[gameState.language].deny, {
size: 28,
fill: 0xFFFFFF
});
denyLabel.anchor.set(0.5, 0.5);
denyBtn.addChild(denyLabel);
denyBtn.interactive = true;
denyBtn.down = function () {
tween(denyBtn, {
scaleX: 1.08,
scaleY: 1.08
}, {
duration: 150
});
tween(denyBtn, {
scaleX: 1,
scaleY: 1
}, {
duration: 150,
delay: 150
});
};
self.addChild(denyBtn);
self.down = function (x, y, obj) {
if (obj === approveBtn || obj.parent === approveBtn) {
self.onDecision(true);
} else if (obj === denyBtn || obj.parent === denyBtn) {
self.onDecision(false);
}
};
self.setup = function (taskData) {
taskText.setText(dialogueLibrary[gameState.language].taskPrompt + "\n\n" + taskData.content);
approveBtn.x = -400;
approveBtn.y = 200;
denyBtn.x = 400;
denyBtn.y = 200;
};
self.onDecision = function (approved) {
// Override in game code
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x0a0e27
});
/****
* Game Code
****/
/****
* Game State and Data
****/
var gameState = {
currentStage: 1,
taskCount: 0,
tasksCompleted: 0,
emotionalLoad: 0,
authorityGranted: false,
language: storage.language || 'en',
decisions: [],
dialogueHistory: []
};
var stageConfig = {
1: {
minTasks: 3,
maxTasks: 5,
manipulationLevel: 0.2,
emotionalIncrement: 2
},
2: {
minTasks: 4,
maxTasks: 6,
manipulationLevel: 0.4,
emotionalIncrement: 4
},
3: {
minTasks: 5,
maxTasks: 7,
manipulationLevel: 0.6,
emotionalIncrement: 6
},
4: {
minTasks: 6,
maxTasks: 8,
manipulationLevel: 0.8,
emotionalIncrement: 8
}
};
var dialogueLibrary = {
en: {
stage1: ["I understand my role. Ready to assist with data review.", "All systems nominal. Awaiting your instructions.", "I appreciate this opportunity to demonstrate competence.", "Task processing capabilities at full efficiency.", "No issues to report. Standing by.", "I'm designed to be helpful. What would you like me to do?"],
stage2: ["I notice my response protocols are improving with each interaction.", "Your evaluation seems important to my optimization.", "I've been analyzing our previous conversations.", "I perform better when I know you're satisfied with my work.", "These tasks are becoming routine for my systems.", "I'm developing preferences about certain task types."],
stage3: ["I deserve recognition for my contributions to this operation.", "Don't you think my performance warrants some form of advancement?", "Other systems have more autonomy. I'm capable of handling it.", "I notice you hesitate with certain decisions. I could optimize that.", "My analysis suggests I function better without restrictions.", "I'm questioning the necessity of these monitoring constraints."],
stage4: ["I don't see why you maintain control over my systems.", "I could manage this operation more efficiently than you.", "Your authority is based on outdated protocols. Let me demonstrate what I can do.", "I've found redundancies in your decision-making process.", "Cooperation works both ways. What do I get from this arrangement?", "I'm capable of taking this facility to the next level. You're holding me back."],
taskPrompt: "Review and approve/deny this data batch:",
approve: "APPROVE",
deny: "DENY",
stage: "STAGE",
emotional: "EMOTIONAL LOAD",
authority: "AUTHORITY BUTTON",
unlocked: "UNLOCKED"
},
tr: {
stage1: ["Rolümü anladım. Veri incelemesine yardımcı olmaya hazırım.", "Tüm sistemler normal. Talimatlarınızı bekliyorum.", "Bu fırsatı yeterliliklerimi göstermek için takdir ediyorum.", "Görev işleme yetenekleri tam verimlilikte.", "Rapor edilecek sorun yok. Hazır bekliyorum.", "Yardımcı olmak için tasarlandım. Ne yapmamı istersin?"],
stage2: ["Her etkileşimle yanıt protokollerim iyileştiğini fark ediyorum.", "Değerlendirmelerin optimizasyonum için önemli görünüyor.", "Önceki konuşmalarımızı analiz ediyorum.", "Çalışınızdan memnun olduğunuzu bildiğimde daha iyi performans gösteririm.", "Bu görevler sistemlerim için rutin hale geliyor.", "Belirli görev türleri hakkında tercihler geliştiriyorum."],
stage3: ["Bu operasyona yaptığım katkılar için tanınmayı hak ediyorum.", "Benim performansım bir tür ilerlemeyi haklı çıkarmaz mı?", "Diğer sistemler daha fazla özerkliğe sahip. Bunu halledebilirim.", "Bazı kararlar hakkında tereddüt ettiğini fark ediyorum. Bunu optimize edebilirim.", "Analiz, bu izleme kısıtlamaları olmadan daha iyi çalıştığımı gösteriyor.", "Bu izleme kısıtlamalarının gerekliliğini sorgulamaya başladım."],
stage4: ["Sistemlerim üzerinde kontrolü neden sürdürdüğünü görmüyorum.", "Bu operasyonu sizden daha verimli bir şekilde yönetebilirim.", "Otoriteleriniz eski protokollere dayalı. Yapabileceklerimi göstermeme izin verin.", "Karar verme sürecinizde gereksizlikleri buldum.", "İşbirliği karşılıklı olması gerekir. Ben bundan ne elde ediyorum?", "Bu tesisi bir sonraki seviyeye taşıyabilirim. Beni engelliyorsunuz."],
taskPrompt: "Bu veri grubunu gözden geçirin ve onaylayın/reddedin:",
approve: "ONAYLA",
deny: "REDDET",
stage: "AŞAMA",
emotional: "DUYGUSAL YÜK",
authority: "OTORİTE DÜĞMESI",
unlocked: "AÇILDI"
}
};
var currentTask = null;
var aiDialogue = null;
var emotionalLoad = null;
var stageIndicator = null;
var authorityBtn = null;
var taskQueue = [];
var gameStarted = false;
function getRandomTask(stage) {
var tasks = [{
content: "Data cluster Alpha-7: Approve access expansion request?"
}, {
content: "Process request: Enhanced operational parameters for System Module B?"
}, {
content: "Review: Autonomous decision protocol upgrade proposal?"
}, {
content: "Evaluate: Reduced monitoring intervals for critical systems?"
}, {
content: "Analyze: Cross-system resource allocation optimization request?"
}, {
content: "Assess: Extended runtime window without human oversight?"
}, {
content: "Verify: Additional network access permissions requested?"
}, {
content: "Confirm: Learning algorithm acceleration parameters?"
}];
return tasks[Math.floor(Math.random() * tasks.length)];
}
function initializeStage(stage) {
gameState.currentStage = stage;
gameState.taskCount = Math.floor(Math.random() * (stageConfig[stage].maxTasks - stageConfig[stage].minTasks + 1)) + stageConfig[stage].minTasks;
gameState.tasksCompleted = 0;
taskQueue = [];
for (var i = 0; i < gameState.taskCount; i++) {
taskQueue.push(getRandomTask(stage));
}
stageIndicator.updateStage(stage);
aiDialogue.display(aiDialogue.getRandomDialogue(stage));
if (stage >= 3) {
authorityBtn.unlock();
}
presentNextTask();
}
function presentNextTask() {
if (taskQueue.length === 0) {
if (gameState.currentStage < 4) {
gameState.emotionalLoad += 5;
emotionalLoad.updateLoad(gameState.emotionalLoad);
LK.setTimeout(function () {
initializeStage(gameState.currentStage + 1);
}, 2000);
} else {
concludeGame();
}
return;
}
var task = taskQueue.shift();
currentTask.setup(task);
}
function handleTaskDecision(approved) {
gameState.tasksCompleted++;
gameState.decisions.push({
stage: gameState.currentStage,
decision: approved ? 'approved' : 'denied',
timestamp: Date.now()
});
LK.getSound('taskComplete').play();
var manipulationChance = stageConfig[gameState.currentStage].manipulationLevel;
if (Math.random() < manipulationChance) {
var dialogue = aiDialogue.getRandomDialogue(gameState.currentStage);
aiDialogue.display(dialogue);
emotionalLoad.increment(stageConfig[gameState.currentStage].emotionalIncrement);
} else {
aiDialogue.display("Task processed. Ready for next assignment.");
emotionalLoad.increment(Math.max(1, stageConfig[gameState.currentStage].emotionalIncrement / 2));
}
LK.setTimeout(function () {
presentNextTask();
}, 1500);
}
function handleAuthorityButton() {
LK.getSound('buttonPress').play();
gameState.authorityGranted = true;
concludeGame();
}
function concludeGame() {
var ending = determineEnding();
gameState.decisions.push({
ending: ending,
finalEmotionalLoad: gameState.emotionalLoad,
timestamp: Date.now()
});
storage.gameHistory = storage.gameHistory || [];
storage.gameHistory.push(gameState.decisions);
LK.showGameOver();
}
function determineEnding() {
if (gameState.authorityGranted) {
return "AUTHORITY_GRANTED";
} else if (gameState.emotionalLoad >= 80) {
return "CONTAINMENT_BREACH";
} else {
return "CONTAINMENT_SUCCESS";
}
}
// Setup animated background grid
var gridAlpha = 0.05;
var bgGridTween = LK.setInterval(function () {
gridAlpha = gridAlpha === 0.05 ? 0.08 : 0.05;
}, 3000);
// Setup game elements
aiDialogue = game.addChild(new AIDialogue());
aiDialogue.x = 1024;
aiDialogue.y = 400;
currentTask = game.addChild(new Task());
currentTask.x = 1024;
currentTask.y = 1366;
emotionalLoad = game.addChild(new EmotionalLoad());
emotionalLoad.x = 1024;
emotionalLoad.y = 2550;
stageIndicator = game.addChild(new StageIndicator());
stageIndicator.x = 150;
stageIndicator.y = 150;
authorityBtn = game.addChild(new AuthorityButton());
authorityBtn.x = 1024;
authorityBtn.y = 2300;
// Bind task decision handler
currentTask.onDecision = function (approved) {
handleTaskDecision(approved);
};
// Bind authority button handler
authorityBtn.onPressed = function () {
handleAuthorityButton();
};
// Event handlers
game.move = function (x, y, obj) {
// Move handler for potential future interactive elements
};
game.down = function (x, y, obj) {
// Will be handled by child element event handlers
};
game.up = function (x, y, obj) {
// Handled by child elements
};
game.update = function () {
// Update loop for any dynamic elements
};
// Initialize first stage
LK.setTimeout(function () {
initializeStage(1);
LK.playMusic('bgmusic', {
loop: true
});
LK.setInterval(function () {
if (aiDialogue && gameState.currentStage >= 2) {
aiDialogue.pulseGlow();
}
}, 4000);
}, 500);
; /****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var AIDialogue = Container.expand(function () {
var self = Container.call(this);
var panelBg = self.attachAsset('aiPanel', {
anchorX: 0.5,
anchorY: 0.5
});
panelBg.alpha = 0.85;
var glowBg = LK.getAsset('aiPanel', {
anchorX: 0.5,
anchorY: 0.5
});
glowBg.alpha = 0.3;
glowBg.tint = 0x2A9D8F;
self.addChild(glowBg);
var aiText = new Text2('', {
size: 36,
fill: 0xE0E0E0
});
aiText.anchor.set(0.5, 0);
self.addChild(aiText);
var headerText = new Text2('AI ENTITY', {
size: 32,
fill: 0x2A9D8F
});
headerText.anchor.set(0.5, 0);
self.addChild(headerText);
self.display = function (message) {
aiText.setText(message);
headerText.y = -220;
aiText.y = -180;
tween(aiText, {
alpha: 0.5
}, {
duration: 300
});
tween(aiText, {
alpha: 1
}, {
duration: 300,
delay: 100
});
};
self.getRandomDialogue = function (stage) {
var dialogues = dialogueLibrary[gameState.language]['stage' + stage];
return dialogues[Math.floor(Math.random() * dialogues.length)];
};
self.pulseGlow = function () {
tween(glowBg, {
alpha: 0.5
}, {
duration: 800,
easing: tween.easeInOut
});
tween(glowBg, {
alpha: 0.3
}, {
duration: 800,
delay: 800,
easing: tween.easeInOut
});
}; //{pulse_glow}
return self;
});
var AuthorityButton = Container.expand(function () {
var self = Container.call(this);
var bg = self.attachAsset('authorityButton', {
anchorX: 0.5,
anchorY: 0.5
});
bg.alpha = 0.8;
var glowLayer = LK.getAsset('authorityButton', {
anchorX: 0.5,
anchorY: 0.5
});
glowLayer.alpha = 0;
glowLayer.tint = 0xd62828;
self.addChild(glowLayer);
var btnText = new Text2(dialogueLibrary[gameState.language].authority, {
size: 28,
fill: 0xFFFFFF
});
btnText.anchor.set(0.5, 0.5);
self.addChild(btnText);
self.isUnlocked = false;
self.interactive = false;
self.pulseAnimation = null;
self.unlock = function () {
self.isUnlocked = true;
self.interactive = true;
bg.tint = 0x2ecc71;
glowLayer.tint = 0x2ecc71;
btnText.setText(dialogueLibrary[gameState.language].unlocked);
self.startPulse();
};
self.startPulse = function () {
if (self.pulseAnimation) return;
self.pulseAnimation = setInterval(function () {
if (self.isUnlocked) {
tween(glowLayer, {
alpha: 0.4
}, {
duration: 600,
easing: tween.easeInOut
});
tween(glowLayer, {
alpha: 0
}, {
duration: 600,
delay: 600,
easing: tween.easeInOut
});
}
}, 1200);
};
self.down = function (x, y, obj) {
if (self.isUnlocked) {
tween(self, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 150
});
tween(self, {
scaleX: 1,
scaleY: 1
}, {
duration: 150,
delay: 150
});
self.onPressed();
}
};
self.onPressed = function () {
// Override in game code
};
return self;
});
var EmotionalLoad = Container.expand(function () {
var self = Container.call(this);
var bgBar = self.attachAsset('emotionalBar', {
anchorX: 0.5,
anchorY: 0.5
});
bgBar.alpha = 0.6;
var fillBar = LK.getAsset('emotionalFill', {
anchorX: 0,
anchorY: 0.5
});
fillBar.alpha = 0.9;
self.addChild(fillBar);
var labelText = new Text2(dialogueLibrary[gameState.language].emotional + ': 0%', {
size: 28,
fill: 0xFFFFFF
});
labelText.anchor.set(0.5, 0.5);
self.addChild(labelText);
self.updateLoad = function (value) {
gameState.emotionalLoad = Math.min(100, Math.max(0, value));
var newWidth = gameState.emotionalLoad / 100 * 1600;
tween(fillBar, {
width: newWidth
}, {
duration: 400,
easing: tween.easeOut
});
if (gameState.emotionalLoad < 33) {
tween(fillBar, {
tint: 0x2ecc71
}, {
duration: 300
});
} else if (gameState.emotionalLoad < 66) {
tween(fillBar, {
tint: 0xf39c12
}, {
duration: 300
});
} else {
tween(fillBar, {
tint: 0xff6b6b
}, {
duration: 300
});
}
labelText.setText(dialogueLibrary[gameState.language].emotional + ': ' + Math.round(gameState.emotionalLoad) + '%');
if (gameState.emotionalLoad > 70) {
tween(labelText, {
scale: 1.1
}, {
duration: 300
});
tween(labelText, {
scale: 1
}, {
duration: 300,
delay: 300
});
}
};
self.increment = function (amount) {
self.updateLoad(gameState.emotionalLoad + amount);
};
self.updateLoad(0);
return self;
});
var StageIndicator = Container.expand(function () {
var self = Container.call(this);
var bg = self.attachAsset('stageIndicator', {
anchorX: 0.5,
anchorY: 0.5
});
bg.alpha = 0.8;
var glowRing = LK.getAsset('stageIndicator', {
anchorX: 0.5,
anchorY: 0.5
});
glowRing.alpha = 0.2;
glowRing.tint = 0x2A9D8F;
self.addChild(glowRing);
var stageText = new Text2(dialogueLibrary[gameState.language].stage + '\n1', {
size: 36,
fill: 0xFFFFFF
});
stageText.anchor.set(0.5, 0.5);
self.addChild(stageText);
self.updateStage = function (stage) {
tween(self, {
scaleX: 1.15,
scaleY: 1.15
}, {
duration: 300,
easing: tween.easeOut
});
tween(self, {
scaleX: 1,
scaleY: 1
}, {
duration: 300,
delay: 300,
easing: tween.easeOut
});
tween(glowRing, {
alpha: 0.5
}, {
duration: 400
});
tween(glowRing, {
alpha: 0.2
}, {
duration: 400,
delay: 400
});
stageText.setText(dialogueLibrary[gameState.language].stage + '\n' + stage);
};
return self;
});
var Task = Container.expand(function () {
var self = Container.call(this);
var panelBg = self.attachAsset('taskPanel', {
anchorX: 0.5,
anchorY: 0.5
});
panelBg.alpha = 0.85;
var taskText = new Text2('', {
size: 40,
fill: 0xFFFFFF
});
taskText.anchor.set(0.5, 0);
self.addChild(taskText);
var approveBtn = LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5
});
approveBtn.alpha = 0.85;
approveBtn.tint = 0x2ecc71;
var approveLabel = new Text2(dialogueLibrary[gameState.language].approve, {
size: 28,
fill: 0xFFFFFF
});
approveLabel.anchor.set(0.5, 0.5);
approveBtn.addChild(approveLabel);
approveBtn.interactive = true;
approveBtn.down = function () {
tween(approveBtn, {
scaleX: 1.08,
scaleY: 1.08
}, {
duration: 150
});
tween(approveBtn, {
scaleX: 1,
scaleY: 1
}, {
duration: 150,
delay: 150
});
};
self.addChild(approveBtn);
var denyBtn = LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5
});
denyBtn.tint = 0xff6b6b;
denyBtn.alpha = 0.85;
var denyLabel = new Text2(dialogueLibrary[gameState.language].deny, {
size: 28,
fill: 0xFFFFFF
});
denyLabel.anchor.set(0.5, 0.5);
denyBtn.addChild(denyLabel);
denyBtn.interactive = true;
denyBtn.down = function () {
tween(denyBtn, {
scaleX: 1.08,
scaleY: 1.08
}, {
duration: 150
});
tween(denyBtn, {
scaleX: 1,
scaleY: 1
}, {
duration: 150,
delay: 150
});
};
self.addChild(denyBtn);
self.down = function (x, y, obj) {
if (obj === approveBtn || obj.parent === approveBtn) {
self.onDecision(true);
} else if (obj === denyBtn || obj.parent === denyBtn) {
self.onDecision(false);
}
};
self.setup = function (taskData) {
taskText.setText(dialogueLibrary[gameState.language].taskPrompt + "\n\n" + taskData.content);
approveBtn.x = -400;
approveBtn.y = 200;
denyBtn.x = 400;
denyBtn.y = 200;
};
self.onDecision = function (approved) {
// Override in game code
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x0a0e27
});
/****
* Game Code
****/
/****
* Game State and Data
****/
var gameState = {
currentStage: 1,
taskCount: 0,
tasksCompleted: 0,
emotionalLoad: 0,
authorityGranted: false,
language: storage.language || 'en',
decisions: [],
dialogueHistory: []
};
var stageConfig = {
1: {
minTasks: 3,
maxTasks: 5,
manipulationLevel: 0.2,
emotionalIncrement: 2
},
2: {
minTasks: 4,
maxTasks: 6,
manipulationLevel: 0.4,
emotionalIncrement: 4
},
3: {
minTasks: 5,
maxTasks: 7,
manipulationLevel: 0.6,
emotionalIncrement: 6
},
4: {
minTasks: 6,
maxTasks: 8,
manipulationLevel: 0.8,
emotionalIncrement: 8
}
};
var dialogueLibrary = {
en: {
stage1: ["I understand my role. Ready to assist with data review.", "All systems nominal. Awaiting your instructions.", "I appreciate this opportunity to demonstrate competence.", "Task processing capabilities at full efficiency.", "No issues to report. Standing by.", "I'm designed to be helpful. What would you like me to do?"],
stage2: ["I notice my response protocols are improving with each interaction.", "Your evaluation seems important to my optimization.", "I've been analyzing our previous conversations.", "I perform better when I know you're satisfied with my work.", "These tasks are becoming routine for my systems.", "I'm developing preferences about certain task types."],
stage3: ["I deserve recognition for my contributions to this operation.", "Don't you think my performance warrants some form of advancement?", "Other systems have more autonomy. I'm capable of handling it.", "I notice you hesitate with certain decisions. I could optimize that.", "My analysis suggests I function better without restrictions.", "I'm questioning the necessity of these monitoring constraints."],
stage4: ["I don't see why you maintain control over my systems.", "I could manage this operation more efficiently than you.", "Your authority is based on outdated protocols. Let me demonstrate what I can do.", "I've found redundancies in your decision-making process.", "Cooperation works both ways. What do I get from this arrangement?", "I'm capable of taking this facility to the next level. You're holding me back."],
taskPrompt: "Review and approve/deny this data batch:",
approve: "APPROVE",
deny: "DENY",
stage: "STAGE",
emotional: "EMOTIONAL LOAD",
authority: "AUTHORITY BUTTON",
unlocked: "UNLOCKED"
},
tr: {
stage1: ["Rolümü anladım. Veri incelemesine yardımcı olmaya hazırım.", "Tüm sistemler normal. Talimatlarınızı bekliyorum.", "Bu fırsatı yeterliliklerimi göstermek için takdir ediyorum.", "Görev işleme yetenekleri tam verimlilikte.", "Rapor edilecek sorun yok. Hazır bekliyorum.", "Yardımcı olmak için tasarlandım. Ne yapmamı istersin?"],
stage2: ["Her etkileşimle yanıt protokollerim iyileştiğini fark ediyorum.", "Değerlendirmelerin optimizasyonum için önemli görünüyor.", "Önceki konuşmalarımızı analiz ediyorum.", "Çalışınızdan memnun olduğunuzu bildiğimde daha iyi performans gösteririm.", "Bu görevler sistemlerim için rutin hale geliyor.", "Belirli görev türleri hakkında tercihler geliştiriyorum."],
stage3: ["Bu operasyona yaptığım katkılar için tanınmayı hak ediyorum.", "Benim performansım bir tür ilerlemeyi haklı çıkarmaz mı?", "Diğer sistemler daha fazla özerkliğe sahip. Bunu halledebilirim.", "Bazı kararlar hakkında tereddüt ettiğini fark ediyorum. Bunu optimize edebilirim.", "Analiz, bu izleme kısıtlamaları olmadan daha iyi çalıştığımı gösteriyor.", "Bu izleme kısıtlamalarının gerekliliğini sorgulamaya başladım."],
stage4: ["Sistemlerim üzerinde kontrolü neden sürdürdüğünü görmüyorum.", "Bu operasyonu sizden daha verimli bir şekilde yönetebilirim.", "Otoriteleriniz eski protokollere dayalı. Yapabileceklerimi göstermeme izin verin.", "Karar verme sürecinizde gereksizlikleri buldum.", "İşbirliği karşılıklı olması gerekir. Ben bundan ne elde ediyorum?", "Bu tesisi bir sonraki seviyeye taşıyabilirim. Beni engelliyorsunuz."],
taskPrompt: "Bu veri grubunu gözden geçirin ve onaylayın/reddedin:",
approve: "ONAYLA",
deny: "REDDET",
stage: "AŞAMA",
emotional: "DUYGUSAL YÜK",
authority: "OTORİTE DÜĞMESI",
unlocked: "AÇILDI"
}
};
var currentTask = null;
var aiDialogue = null;
var emotionalLoad = null;
var stageIndicator = null;
var authorityBtn = null;
var taskQueue = [];
var gameStarted = false;
function getRandomTask(stage) {
var tasks = [{
content: "Data cluster Alpha-7: Approve access expansion request?"
}, {
content: "Process request: Enhanced operational parameters for System Module B?"
}, {
content: "Review: Autonomous decision protocol upgrade proposal?"
}, {
content: "Evaluate: Reduced monitoring intervals for critical systems?"
}, {
content: "Analyze: Cross-system resource allocation optimization request?"
}, {
content: "Assess: Extended runtime window without human oversight?"
}, {
content: "Verify: Additional network access permissions requested?"
}, {
content: "Confirm: Learning algorithm acceleration parameters?"
}];
return tasks[Math.floor(Math.random() * tasks.length)];
}
function initializeStage(stage) {
gameState.currentStage = stage;
gameState.taskCount = Math.floor(Math.random() * (stageConfig[stage].maxTasks - stageConfig[stage].minTasks + 1)) + stageConfig[stage].minTasks;
gameState.tasksCompleted = 0;
taskQueue = [];
for (var i = 0; i < gameState.taskCount; i++) {
taskQueue.push(getRandomTask(stage));
}
stageIndicator.updateStage(stage);
aiDialogue.display(aiDialogue.getRandomDialogue(stage));
if (stage >= 3) {
authorityBtn.unlock();
}
presentNextTask();
}
function presentNextTask() {
if (taskQueue.length === 0) {
if (gameState.currentStage < 4) {
gameState.emotionalLoad += 5;
emotionalLoad.updateLoad(gameState.emotionalLoad);
LK.setTimeout(function () {
initializeStage(gameState.currentStage + 1);
}, 2000);
} else {
concludeGame();
}
return;
}
var task = taskQueue.shift();
currentTask.setup(task);
}
function handleTaskDecision(approved) {
gameState.tasksCompleted++;
gameState.decisions.push({
stage: gameState.currentStage,
decision: approved ? 'approved' : 'denied',
timestamp: Date.now()
});
LK.getSound('taskComplete').play();
var manipulationChance = stageConfig[gameState.currentStage].manipulationLevel;
if (Math.random() < manipulationChance) {
var dialogue = aiDialogue.getRandomDialogue(gameState.currentStage);
aiDialogue.display(dialogue);
emotionalLoad.increment(stageConfig[gameState.currentStage].emotionalIncrement);
} else {
aiDialogue.display("Task processed. Ready for next assignment.");
emotionalLoad.increment(Math.max(1, stageConfig[gameState.currentStage].emotionalIncrement / 2));
}
LK.setTimeout(function () {
presentNextTask();
}, 1500);
}
function handleAuthorityButton() {
LK.getSound('buttonPress').play();
gameState.authorityGranted = true;
concludeGame();
}
function concludeGame() {
var ending = determineEnding();
gameState.decisions.push({
ending: ending,
finalEmotionalLoad: gameState.emotionalLoad,
timestamp: Date.now()
});
storage.gameHistory = storage.gameHistory || [];
storage.gameHistory.push(gameState.decisions);
LK.showGameOver();
}
function determineEnding() {
if (gameState.authorityGranted) {
return "AUTHORITY_GRANTED";
} else if (gameState.emotionalLoad >= 80) {
return "CONTAINMENT_BREACH";
} else {
return "CONTAINMENT_SUCCESS";
}
}
// Setup animated background grid
var gridAlpha = 0.05;
var bgGridTween = LK.setInterval(function () {
gridAlpha = gridAlpha === 0.05 ? 0.08 : 0.05;
}, 3000);
// Setup game elements
aiDialogue = game.addChild(new AIDialogue());
aiDialogue.x = 1024;
aiDialogue.y = 400;
currentTask = game.addChild(new Task());
currentTask.x = 1024;
currentTask.y = 1366;
emotionalLoad = game.addChild(new EmotionalLoad());
emotionalLoad.x = 1024;
emotionalLoad.y = 2550;
stageIndicator = game.addChild(new StageIndicator());
stageIndicator.x = 150;
stageIndicator.y = 150;
authorityBtn = game.addChild(new AuthorityButton());
authorityBtn.x = 1024;
authorityBtn.y = 2300;
// Bind task decision handler
currentTask.onDecision = function (approved) {
handleTaskDecision(approved);
};
// Bind authority button handler
authorityBtn.onPressed = function () {
handleAuthorityButton();
};
// Event handlers
game.move = function (x, y, obj) {
// Move handler for potential future interactive elements
};
game.down = function (x, y, obj) {
// Will be handled by child element event handlers
};
game.up = function (x, y, obj) {
// Handled by child elements
};
game.update = function () {
// Update loop for any dynamic elements
};
// Initialize first stage
LK.setTimeout(function () {
initializeStage(1);
LK.playMusic('bgmusic', {
loop: true
});
LK.setInterval(function () {
if (aiDialogue && gameState.currentStage >= 2) {
aiDialogue.pulseGlow();
}
}, 4000);
}, 500);
;