/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1", {
highScore: 0,
totalPlayed: 0
});
/****
* Classes
****/
var Character = Container.expand(function () {
var self = Container.call(this);
var happyFace = self.attachAsset('characterHappy', {
anchorX: 0.5,
anchorY: 0.5
});
happyFace.visible = false;
var sadFace = self.attachAsset('characterSad', {
anchorX: 0.5,
anchorY: 0.5
});
sadFace.visible = false;
var excitedFace = self.attachAsset('characterExcited', {
anchorX: 0.5,
anchorY: 0.5
});
excitedFace.visible = false;
var neutralFace = self.attachAsset('characterNeutral', {
anchorX: 0.5,
anchorY: 0.5
});
neutralFace.visible = true;
self.showHappy = function () {
happyFace.visible = true;
sadFace.visible = false;
excitedFace.visible = false;
neutralFace.visible = false;
};
self.showSad = function () {
happyFace.visible = false;
sadFace.visible = true;
excitedFace.visible = false;
neutralFace.visible = false;
};
self.showExcited = function () {
happyFace.visible = false;
sadFace.visible = false;
excitedFace.visible = true;
neutralFace.visible = false;
};
self.showNeutral = function () {
happyFace.visible = false;
sadFace.visible = false;
excitedFace.visible = false;
neutralFace.visible = true;
};
return self;
});
var Joker = Container.expand(function (type, icon) {
var self = Container.call(this);
self.type = type;
self.used = false;
var background = self.attachAsset('jokerButton', {
anchorX: 0.5,
anchorY: 0.5
});
var text = new Text2(icon, {
size: 50,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 3
});
text.anchor.set(0.5, 0.5);
self.addChild(text);
self.use = function () {
if (self.used) {
return false;
}
self.used = true;
tween(self, {
alpha: 0.4
}, {
duration: 100
});
return true;
};
self.reset = function () {
self.used = false;
self.alpha = 1;
};
self.down = function (x, y, obj) {
if (!self.used && !gameOver && !answerLocked && !menuOpen) {
activateJoker(self.type);
}
};
return self;
});
var MenuScreen = Container.expand(function () {
var self = Container.call(this);
// Menu background
var background = self.attachAsset('menuscreen', {
anchorX: 0.5,
anchorY: 0.5
});
// Play button
var playButtonContainer = new Container();
playButtonContainer.position.set(0, -100); // Moved 200 pixels down from original -300
self.addChild(playButtonContainer);
var playButtonBg = playButtonContainer.attachAsset('menu_play', {
anchorX: 0.5,
anchorY: 0.5
});
playButtonBg.alpha = 0.9; // Set to 40% opacity (60% transparent)
// Add "Play" text to play button
playText = new Text2(labels[currentLang].play, {
size: 70,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 4
});
playText.anchor.set(0.5, 0.5);
playButtonContainer.addChild(playText);
// How to play button
var howToPlayContainer = new Container();
howToPlayContainer.position.set(0, -1600); // Moved 1500 pixels up from original -100
self.addChild(howToPlayContainer);
var howToPlayButtonBg = howToPlayContainer.attachAsset('menu_howtoplay', {
anchorX: 0.5,
anchorY: 0.5
});
howToPlayButtonBg.alpha = 0.9; // Set to 40% opacity (60% transparent)
// Add "How To Play" text to how to play button
howToPlayText = new Text2(labels[currentLang].how, {
size: 70,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 4
});
howToPlayText.anchor.set(0.5, 0.5);
howToPlayContainer.addChild(howToPlayText);
// Language button
var languageContainer = new Container();
languageContainer.position.set(0, 102);
self.addChild(languageContainer);
var languageButtonBg = languageContainer.attachAsset('menu_language', {
anchorX: 0.5,
anchorY: 0.5
});
languageButtonBg.alpha = 0.9; // Set to 40% opacity (60% transparent)
// Add "Language" text to language button
languageText = new Text2(labels[currentLang].lang, {
size: 70,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 4
});
languageText.anchor.set(0.5, 0.5);
languageContainer.addChild(languageText);
// Stickman button
var stickmanContainer = new Container();
stickmanContainer.position.set(0, 303);
self.addChild(stickmanContainer);
var stickmanButtonBg = stickmanContainer.attachAsset('menu_stickman', {
anchorX: 0.5,
anchorY: 0.5
});
stickmanButtonBg.alpha = 0.9; // Set to 40% opacity (60% transparent)
// Add "Select Character" text to stickman button
stickmanText = new Text2(labels[currentLang]["char"], {
size: 70,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 4
});
stickmanText.anchor.set(0.5, 0.5);
stickmanContainer.addChild(stickmanText);
// Handle clicks on all buttons
playButtonContainer.interactive = true;
playButtonContainer.down = function () {
if (secondaryMenuOpen) {
return;
} // Don't do anything if secondary menu is open
self.hide();
initGame();
};
howToPlayContainer.interactive = true;
howToPlayContainer.down = function () {
if (secondaryMenuOpen) {
return;
} // Don't do anything if secondary menu is open
// For now just log
console.log("How To Play clicked");
};
languageContainer.interactive = true;
languageContainer.down = function () {
if (secondaryMenuOpen) {
return;
} // Don't do anything if secondary menu is open
openSecondaryMenu(languageMenu);
};
stickmanContainer.interactive = true;
stickmanContainer.down = function () {
if (secondaryMenuOpen) {
return;
} // Don't do anything if secondary menu is open
openSecondaryMenu(characterMenu);
};
// Show menu
self.show = function () {
self.visible = true;
menuOpen = true; // Set menu state to open
};
// Hide menu
self.hide = function () {
self.visible = false;
menuOpen = false; // Set menu state to closed
};
return self;
});
var PhoneFriendPopup = Container.expand(function () {
var self = Container.call(this);
// background card
var bg = self.attachAsset('phonejokerscreen', {
anchorX: 0.5,
anchorY: 0.5,
width: 1200,
height: 800
});
bg.tint = 0xF5F5F5;
// the single guess text
var guessText = new Text2("", {
size: 70,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 4
});
guessText.anchor.set(0.5, 0.5);
guessText.position.set(0, 0);
self.addChild(guessText);
self.visible = false;
// show with the correct answer inserted
self.show = function (answer) {
guessText.setText('Hmm, I guess the answer is "' + answer + '"!');
self.visible = true;
};
self.hide = function () {
self.visible = false;
};
return self;
});
var QuestionButton = Container.expand(function (index, text) {
var self = Container.call(this);
self.index = index;
self.isCorrect = false;
self.isSelected = false;
self.isEliminated = false;
self.isDisabled = false; // Added for second chance joker
// Apply additional 7% height increase while keeping width the same
var background = self.attachAsset('buttonBackground', {
anchorX: 0.5,
anchorY: 0.5,
width: 944,
// 924 + 20 = 944 (adding 10px on each side)
// Extended by 10 pixels on left and right
height: 234,
// 224 + 10 = 234 (adding 5px on top and 5px on bottom)
shape: 'ellipse' // More rounded shape
});
// Add outline to the button
var btnWidth = 944;
var btnHeight = 234;
var cornerRadius = 50;
// Create outline shape with same properties as button
var outline = self.attachAsset('buttonBackground', {
anchorX: 0.5,
anchorY: 0.5,
width: btnWidth + 10,
// Slightly larger than the button
height: btnHeight + 10,
shape: 'ellipse'
});
outline.tint = 0x000000; // Black outline
outline.alpha = 0.8;
// Make sure outline is rendered behind the button background
self.addChildAt(outline, 0);
var buttonText = new Text2(text, {
size: 60,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 4
});
buttonText.anchor.set(0.5, 0.5);
buttonText.position.set(10, 0); // Shift text 10 pixels to the right
self.addChild(buttonText);
var overlay = self.attachAsset('correctAnswerOverlay', {
anchorX: 0.5,
anchorY: 0.5,
width: 944,
// 924 + 20 = 944 (adding 10px on each side)
// Extended by 10 pixels on left and right
height: 234,
// 224 + 10 = 234 (adding 5px on top and 5px on bottom)
shape: 'ellipse' // More rounded shape for overlay
});
overlay.alpha = 0;
self.setText = function (newText) {
buttonText.setText(wrapText(newText, 35));
};
self.setCorrect = function (correct) {
self.isCorrect = correct;
};
self.markAsCorrect = function () {
overlay.tint = 0x00FF00;
tween(overlay, {
alpha: 0.5
}, {
duration: 500
});
};
self.markAsIncorrect = function () {
overlay.tint = 0xFF0000;
tween(overlay, {
alpha: 0.5
}, {
duration: 500
});
};
self.reset = function () {
overlay.alpha = 0;
self.isSelected = false;
self.isEliminated = false;
self.isDisabled = false; // Reset disabled state
self.alpha = 1; // Reset visual appearance back to fully visible
};
self.eliminate = function () {
if (self.isCorrect) {
return false;
}
self.isEliminated = true;
tween(self, {
alpha: 0.3
}, {
duration: 300
});
return true;
};
// New function for second chance joker
self.disable = function () {
self.isDisabled = true;
tween(self, {
alpha: 0.3
}, {
duration: 300
});
};
self.down = function (x, y, obj) {
if (!self.isEliminated && !self.isDisabled && !gameOver && !answerLocked && !menuOpen) {
self.isSelected = true;
submitAnswer(self.index);
}
};
return self;
});
var SecondarySmallMenu = Container.expand(function (title, options) {
var self = Container.call(this);
// Create full screen overlay that captures all clicks
var overlay = new Container();
overlay.width = 2048;
overlay.height = 2732;
overlay.position.set(-2048 / 2, -2732 / 2); // Position overlay to cover entire screen
overlay.hitArea = new Rectangle(0, 0, 2048, 2732);
overlay.interactive = true;
overlay.down = function (x, y, obj) {
closeSecondaryMenus();
};
self.addChild(overlay);
// Create background
var background = self.attachAsset('secondarysmallmenu', {
anchorX: 0.5,
anchorY: 0.5,
width: 1200,
height: 800
});
// Make background interactive to prevent click events from reaching overlay
background.hitArea = new Rectangle(-600, -400, 1200, 800);
background.interactive = true;
background.down = function (x, y, obj) {
// Stop propagation - do nothing when clicking the background
if (obj && obj.event && typeof obj.event.stopPropagation === 'function') {
obj.event.stopPropagation();
}
};
// Create title text
var titleText = new Text2(title, {
size: 80,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 4
});
titleText.anchor.set(0.5, 0);
titleText.position.set(0, -300);
self.addChild(titleText);
// Create options buttons
self.optionButtons = [];
for (var i = 0; i < options.length; i++) {
var optionContainer = new Container();
optionContainer.position.set(0, -150 + i * 120);
var optionBackground = optionContainer.attachAsset('buttonBackground', {
anchorX: 0.5,
anchorY: 0.5,
width: 800,
height: 100
});
var optionText = new Text2(options[i], {
size: 60,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 3
});
optionText.anchor.set(0.5, 0.5);
optionContainer.addChild(optionText);
optionContainer.optionValue = options[i];
// Handle button click
optionContainer.interactive = true;
optionContainer.down = function (x, y, obj) {
// Stop propagation to prevent menu from closing immediately
if (obj && obj.event && typeof obj.event.stopPropagation === 'function') {
obj.event.stopPropagation();
}
console.log("Selected option: " + obj.parent.optionValue);
self.hide();
secondaryMenuOpen = false;
activeSecondaryMenu = null;
};
self.optionButtons.push(optionContainer);
self.addChild(optionContainer);
}
self.visible = false;
self.show = function () {
self.visible = true;
secondaryMenuOpen = true;
activeSecondaryMenu = self;
};
self.hide = function () {
self.visible = false;
};
return self;
});
var Stickman = Container.expand(function () {
var self = Container.call(this);
// Create stickman assets
var stickmanhappy = self.attachAsset('stickmanhappy', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var stickmanthinking = self.attachAsset('stickmanthinking', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var stickmandisappointed = self.attachAsset('stickmandisappointed', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var stickmanangry = self.attachAsset('stickmanagry', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var stickmanwinner = self.attachAsset('stickmanwinner', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
// Create Pepo assets
var pepohappy = self.attachAsset('pepohappy', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var pepothinking = self.attachAsset('pepothinking', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var pepodisappointed = self.attachAsset('pepodisappointed', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var pepoangry = self.attachAsset('pepoangry', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var pepowin = self.attachAsset('pepowin', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
// Create Chill Guy assets
var chillguyhappy = self.attachAsset('chillguyhappy', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var chillguythinking = self.attachAsset('chillguythinking', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var chillguydisappointed = self.attachAsset('chillguydisappointed', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var chillguyangry = self.attachAsset('chillguyangry', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var chillguywin = self.attachAsset('chillguywin', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
// Create at0m assets
var atomhappy = self.attachAsset('atomhappy', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var atomthinking = self.attachAsset('atomthinking', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var atomdisappointed = self.attachAsset('atomdisappointed', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var atomangry = self.attachAsset('atomangry', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var atomwin = self.attachAsset('atomwin', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
// Set all to same position
stickmanhappy.position.set(0, 0);
stickmanthinking.position.set(0, 0);
stickmandisappointed.position.set(0, 0);
stickmanangry.position.set(0, 0);
stickmanwinner.position.set(0, 0);
pepohappy.position.set(0, 0);
pepothinking.position.set(0, 0);
pepodisappointed.position.set(0, 0);
pepoangry.position.set(0, 0);
pepowin.position.set(0, 0);
chillguyhappy.position.set(0, 0);
chillguythinking.position.set(0, 0);
chillguydisappointed.position.set(0, 0);
chillguyangry.position.set(0, 0);
chillguywin.position.set(0, 0);
atomhappy.position.set(0, 0);
atomthinking.position.set(0, 0);
atomdisappointed.position.set(0, 0);
atomangry.position.set(0, 0);
atomwin.position.set(0, 0);
// Initially hide Pepo and Chill Guy assets
pepohappy.visible = false;
pepothinking.visible = false;
pepodisappointed.visible = false;
pepoangry.visible = false;
pepowin.visible = false;
chillguyhappy.visible = false;
chillguythinking.visible = false;
chillguydisappointed.visible = false;
chillguyangry.visible = false;
chillguywin.visible = false;
// Initially hide at0m assets
atomhappy.visible = false;
atomthinking.visible = false;
atomdisappointed.visible = false;
atomangry.visible = false;
atomwin.visible = false;
// Helper function to show only one state
function showOnly(target) {
if (self.currentCharacter === "Pepo") {
pepohappy.visible = target === 'happy';
pepothinking.visible = target === 'thinking';
pepodisappointed.visible = target === 'disappointed';
pepoangry.visible = target === 'angry';
pepowin.visible = target === 'winner';
// Hide all stickman, chillguy, and at0m assets
stickmanhappy.visible = false;
stickmanthinking.visible = false;
stickmandisappointed.visible = false;
stickmanangry.visible = false;
stickmanwinner.visible = false;
chillguyhappy.visible = false;
chillguythinking.visible = false;
chillguydisappointed.visible = false;
chillguyangry.visible = false;
chillguywin.visible = false;
atomhappy.visible = false;
atomthinking.visible = false;
atomdisappointed.visible = false;
atomangry.visible = false;
atomwin.visible = false;
} else if (self.currentCharacter === "Chill Guy") {
chillguyhappy.visible = target === 'happy';
chillguythinking.visible = target === 'thinking';
chillguydisappointed.visible = target === 'disappointed';
chillguyangry.visible = target === 'angry';
chillguywin.visible = target === 'winner';
// Hide all stickman, pepo, and at0m assets
stickmanhappy.visible = false;
stickmanthinking.visible = false;
stickmandisappointed.visible = false;
stickmanangry.visible = false;
stickmanwinner.visible = false;
pepohappy.visible = false;
pepothinking.visible = false;
pepodisappointed.visible = false;
pepoangry.visible = false;
pepowin.visible = false;
atomhappy.visible = false;
atomthinking.visible = false;
atomdisappointed.visible = false;
atomangry.visible = false;
atomwin.visible = false;
} else if (self.currentCharacter === "at0m") {
atomhappy.visible = target === 'happy';
atomthinking.visible = target === 'thinking';
atomdisappointed.visible = target === 'disappointed';
atomangry.visible = target === 'angry';
atomwin.visible = target === 'winner';
// Hide all stickman, pepo, and chillguy assets
stickmanhappy.visible = false;
stickmanthinking.visible = false;
stickmandisappointed.visible = false;
stickmanangry.visible = false;
stickmanwinner.visible = false;
pepohappy.visible = false;
pepothinking.visible = false;
pepodisappointed.visible = false;
pepoangry.visible = false;
pepowin.visible = false;
chillguyhappy.visible = false;
chillguythinking.visible = false;
chillguydisappointed.visible = false;
chillguyangry.visible = false;
chillguywin.visible = false;
} else {
stickmanhappy.visible = target === 'happy';
stickmanthinking.visible = target === 'thinking';
stickmandisappointed.visible = target === 'disappointed';
stickmanangry.visible = target === 'angry';
stickmanwinner.visible = target === 'winner';
// Hide all pepo, chillguy, and at0m assets
pepohappy.visible = false;
pepothinking.visible = false;
pepodisappointed.visible = false;
pepoangry.visible = false;
pepowin.visible = false;
chillguyhappy.visible = false;
chillguythinking.visible = false;
chillguydisappointed.visible = false;
chillguyangry.visible = false;
chillguywin.visible = false;
atomhappy.visible = false;
atomthinking.visible = false;
atomdisappointed.visible = false;
atomangry.visible = false;
atomwin.visible = false;
}
}
// Set default character
self.currentCharacter = "Stickman";
// Method to set character type
self.setCharacter = function (characterType) {
self.currentCharacter = characterType;
// Update current state
if (stickmanthinking.visible) {
showOnly('thinking');
} else if (stickmanhappy.visible || pepohappy.visible) {
showOnly('happy');
} else if (stickmandisappointed.visible || pepodisappointed.visible) {
showOnly('disappointed');
} else if (stickmanangry.visible || pepoangry.visible) {
showOnly('angry');
} else if (stickmanwinner.visible || pepowin.visible) {
showOnly('winner');
} else {
// Default to thinking
showOnly('thinking');
}
};
// Initialize with thinking visible
showOnly('thinking');
// Public methods to change stickman state
self.showHappy = function () {
showOnly('happy');
};
self.showThinking = function () {
showOnly('thinking');
};
self.showDisappointed = function () {
showOnly('disappointed');
};
self.showAngry = function () {
showOnly('angry');
};
self.showWinner = function () {
showOnly('winner');
};
return self;
});
var TrollFaces = Container.expand(function () {
var self = Container.call(this);
var trollFaceHappy = self.attachAsset('trollfacehappy', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var trollFaceSad = self.attachAsset('trollfacesad', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var trollFaceSmile = self.attachAsset('trollfacesmile', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
var trollFaceAngry = self.attachAsset('trollfaceangry', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 3,
scaleY: 3
});
// Set all faces to same position
trollFaceHappy.position.set(0, 0);
trollFaceSad.position.set(0, 0);
trollFaceSmile.position.set(0, 0);
trollFaceAngry.position.set(0, 0);
// Helper function to show only one face
function showOnly(target) {
trollFaceHappy.visible = target === 'happy';
trollFaceSad.visible = target === 'sad';
trollFaceSmile.visible = target === 'smile';
trollFaceAngry.visible = target === 'angry';
}
// Initially only show happy face
showOnly('happy');
self.showHappy = function () {
showOnly('happy');
};
self.showSad = function () {
showOnly('sad');
};
self.showSmile = function () {
showOnly('smile');
};
self.showAngry = function () {
showOnly('angry');
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Menüdeki buton metinlerini tutacak global referanslar
var playText, howToPlayText, languageText, stickmanText;
/**
* Uzun metni kelime bütünlüğünü bozmadan maxChars uzunluğunda parçalara ayırır.
* @param {string} text — Orijinal metin
* @param {number} maxChars — Bir satırdaki maksimum karakter sayısı
* @returns {string} Satır sonlarıyla (\n) bölünmüş metin
*/
function wrapText(text, maxChars) {
var lines = [];
var remainder = text;
while (remainder.length > maxChars) {
// İlk maxChars karakterlik bölümü al
var slice = remainder.slice(0, maxChars);
// Kelime bütünlüğü için son boşluğu bul
var lastSpace = slice.lastIndexOf(' ');
if (lastSpace > 0) {
lines.push(slice.slice(0, lastSpace));
remainder = remainder.slice(lastSpace + 1);
} else {
// Boşluk yoksa zorla kır
lines.push(slice);
remainder = remainder.slice(maxChars);
}
}
// Kalan küçük metni de ekle
if (remainder.length > 0) {
lines.push(remainder);
}
return lines.join('\n');
}
// ——— DİL SEÇİMİ & SORU VERİSİ ———
var currentLang = "tr"; // Oyunun dili Türkçe başlasın
var questions; // Will be populated in initGame
var questionsByLang = {
tr: [{
question: "1. Türkiye Cumhuriyeti ne zaman ilan edilmiştir?",
answers: ["1920", "1921", "1922", "1923"],
correctIndex: 3
}, {
question: "2. Kurtuluş Savaşı'nın lideri kimdir?",
answers: ["Kazım Karabekir", "Mustafa Kemal Atatürk", "İsmet İnönü", "Fevzi Çakmak"],
correctIndex: 1
}, {
question: "3. Türkiye'nin başkenti hangi şehirdir?",
answers: ["İstanbul", "Ankara", "İzmir", "Bursa"],
correctIndex: 1
}, {
question: "4. Osmanlı Devleti hangi yıl sona ermiştir?",
answers: ["1918", "1920", "1922", "1923"],
correctIndex: 2
}, {
question: "5. Türkiye'nin ilk kadın pilotu kimdir?",
answers: ["Sabiha Gökçen", "Afet İnan", "Halide Edip", "Fikriye Hanım"],
correctIndex: 0
}, {
question: "6. 1453 yılında hangi önemli olay gerçekleşmiştir?",
answers: ["İstanbul'un Fethi", "Cumhuriyetin İlanı", "Sakarya Meydan Muharebesi", "Lozan Antlaşması"],
correctIndex: 0
}, {
question: "7. Türkiye'nin en uzun nehri hangisidir?",
answers: ["Kızılırmak", "Fırat", "Dicle", "Yeşilırmak"],
correctIndex: 0
}, {
question: "8. Atatürk'ün doğum yeri neresidir?",
answers: ["Selanik", "Samsun", "Ankara", "İstanbul"],
correctIndex: 0
}, {
question: "9. Türkiye'nin ilk anayasası hangi yılda kabul edilmiştir?",
answers: ["1921", "1924", "1961", "1982"],
correctIndex: 0
}, {
question: "10. TBMM hangi tarihte açılmıştır?",
answers: ["19 Mayıs 1919", "23 Nisan 1920", "29 Ekim 1923", "30 Ağustos 1922"],
correctIndex: 1
}],
en: [{
question: "1. Which subject is students’ favorite?",
answers: ["Mathematics", "Geography", "Science", "–"],
correctIndex: 3
}, {
question: "2. Where is the Great Wall of China located?",
answers: ["China", "Mexico", "Mongolia", "Egypt"],
correctIndex: 0
}, {
question: "3. The anthem you’re listening to is in which country’s language?",
answers: ["English", "Russian", "German", "Spanish"],
correctIndex: 1
}, {
question: "4. Bogos binted?",
answers: ["Yes", "No", "Maybe", "Russian"],
correctIndex: 1
}, {
question: "5. Which planet heats the Earth?",
answers: ["The Sun", "Jupiter", "The Moon", "None"],
correctIndex: 3
}, {
question: "6. What is the thing that took 6 years for the second installment and 13 years for the third?",
answers: ["Avatar", "GTA", "The courier’s delivery time for my package", "RDR3"],
correctIndex: 2
}, {
question: "7. In Cyberpunk 2077’s dystopian future, what is the scariest thing encountered?",
answers: ["Getting a chip implanted in your brain", "People are still listening to trap music", "Having your eyeball removed and replaced with a screwed-in, laser-equipped sensor", "Gangs taking over the streets"],
correctIndex: 1
}, {
question: "8. When will I decide to get my life in order and start exercising?",
answers: ["During dinner", "At the most productive time of day", "At 12:00", "At 3:00 AM, while in bed"],
correctIndex: 3
}, {
question: "9. When do all diets start?",
answers: ["Sunday", "Monday", "Tuesday", "Wednesday"],
correctIndex: 1
}, {
question: "10. Which animal has the largest ears?",
answers: ["Bat", "Rabbit", "Elephant", "Cat"],
correctIndex: 2
}],
de: [{
question: "1. Welches Fach ist das Lieblingsfach der Schüler?",
answers: ["Mathematik", "Erdkunde", "Naturwissenschaften", "–"],
correctIndex: 3
}, {
question: "2. Wo befindet sich die Chinesische Mauer?",
answers: ["China", "Mexiko", "Mongolei", "Ägypten"],
correctIndex: 0
}, {
question: "3. Die Hymne, die du gerade hörst, ist in welcher Landessprache?",
answers: ["Englisch", "Russisch", "Deutsch", "Spanisch"],
correctIndex: 1
}, {
question: "4. Bogos binted?",
answers: ["Ja", "Nein", "Vielleicht", "Russisch"],
correctIndex: 1
}, {
question: "5. Welcher Planet erwärmt die Erde?",
answers: ["Die Sonne", "Jupiter", "Der Mond", "Keiner"],
correctIndex: 3
}, {
question: "6. Was hat für den zweiten Teil 6 Jahre und für den dritten Teil 13 Jahre gebraucht?",
answers: ["Avatar", "GTA", "Die Lieferzeit meines Pakets", "RDR3"],
correctIndex: 2
}, {
question: "7. In der dystopischen Zukunft von Cyberpunk 2077, was ist das Gruseligste, dem man begegnet?",
answers: ["Einen Chip ins Gehirn implantiert zu bekommen", "Dass die Leute immer noch Trap-Musik hören", "Dass dir dein Augapfel entfernt und durch einen eingeschraubten, laserbestückten Sensor ersetzt wird", "Dass Gangs die Straßen übernehmen"],
correctIndex: 1
}, {
question: "8. Wann werde ich beschließen, mein Leben in Ordnung zu bringen und mit dem Sport zu beginnen?",
answers: ["Beim Abendessen", "Zur produktivsten Tageszeit", "Um 12:00 Uhr", "Um 3:00 Uhr morgens im Bett"],
correctIndex: 3
}, {
question: "9. Wann beginnen alle Diäten?",
answers: ["Sonntag", "Montag", "Dienstag", "Mittwoch"],
correctIndex: 1
}, {
question: "10. Welches Tier hat die größten Ohren?",
answers: ["Fledermaus", "Kaninchen", "Elefant", "Katze"],
correctIndex: 2
}],
fr: [{
question: "1. Quelle matière est la préférée des élèves ?",
answers: ["Mathématiques", "Géographie", "Sciences", "–"],
correctIndex: 3
}, {
question: "2. Où se trouve la Grande Muraille de Chine ?",
answers: ["Chine", "Mexique", "Mongolie", "Égypte"],
correctIndex: 0
}, {
question: "3. L’hymne que tu écoutes, dans quelle langue nationale est-il ?",
answers: ["Anglais", "Russe", "Allemand", "Espagnol"],
correctIndex: 1
}, {
question: "4. Bogos binted ?",
answers: ["Oui", "Non", "Peut-être", "Russe"],
correctIndex: 1
}, {
question: "5. Quelle « planète » réchauffe la Terre ?",
answers: ["Le Soleil", "Jupiter", "La Lune", "Aucune"],
correctIndex: 3
}, {
question: "6. Qu’est-ce qui a mis 6 ans pour le deuxième volet et 13 ans pour le troisième ?",
answers: ["Avatar", "GTA", "Le délai de livraison de mon colis", "RDR3"],
correctIndex: 2
}, {
question: "7. Dans le futur dystopique de Cyberpunk 2077, quelle est la chose la plus effrayante que l’on peut y rencontrer ?",
answers: ["Se faire implanter une puce dans le cerveau", "Que les gens écoutent toujours de la musique trap", "Se faire retirer le globe oculaire et le remplacer par un capteur laser vissé", "Les gangs qui prennent le contrôle des rues"],
correctIndex: 1
}, {
question: "8. Quand déciderai-je de remettre ma vie en ordre et de commencer à faire de l’exercice ?",
answers: ["Pendant le dîner", "Au moment le plus productif de la journée", "À midi", "À 3 h du matin, dans mon lit"],
correctIndex: 3
}, {
question: "9. Quand commencent tous les régimes ?",
answers: ["Dimanche", "Lundi", "Mardi", "Mercredi"],
correctIndex: 1
}, {
question: "10. Quel animal a les plus grandes oreilles ?",
answers: ["Chauve-souris", "Lapin", "Éléphant", "Chat"],
correctIndex: 2
}],
es: [{
question: "1. ¿Cuál es la asignatura favorita de los estudiantes?",
answers: ["Matemáticas", "Geografía", "Ciencias", "–"],
correctIndex: 3
}, {
question: "2. ¿Dónde se encuentra la Gran Muralla China?",
answers: ["China", "México", "Mongolia", "Egipto"],
correctIndex: 0
}, {
question: "3. ¿En qué idioma nacional está el himno que estás escuchando?",
answers: ["Inglés", "Ruso", "Alemán", "Español"],
correctIndex: 1
}, {
question: "4. ¿Bogos binted?",
answers: ["Sí", "No", "Quizás", "Ruso"],
correctIndex: 1
}, {
question: "5. ¿Qué “planeta” calienta la Tierra?",
answers: ["El Sol", "Júpiter", "La Luna", "Ninguno"],
correctIndex: 3
}, {
question: "6. ¿Qué es lo que tardó 6 años en la segunda parte y 13 años en la tercera?",
answers: ["Avatar", "GTA", "El tiempo de entrega de mi paquete", "RDR3"],
correctIndex: 2
}, {
question: "7. En el futuro distópico de Cyberpunk 2077, ¿qué es lo más aterrador que se encuentra?",
answers: ["Que te implanten un chip en el cerebro", "Que la gente siga escuchando trap", "Que te quiten el globo ocular y lo sustituyan por un sensor láser atornillado", "Que las pandillas tomen las calles"],
correctIndex: 1
}, {
question: "8. ¿Cuándo decidiré poner mi vida en orden y empezar a hacer ejercicio?",
answers: ["Durante la cena", "En el momento más productivo del día", "A las 12:00", "A las 3:00 AM, en la cama"],
correctIndex: 3
}, {
question: "9. ¿Cuándo comienzan todas las dietas?",
answers: ["Domingo", "Lunes", "Martes", "Miércoles"],
correctIndex: 1
}, {
question: "10. ¿Qué animal tiene las orejas más grandes?",
answers: ["Murciélago", "Conejo", "Elefante", "Gato"],
correctIndex: 2
}]
};
// Menü butonları için diller arası metinler
var labels = {
tr: {
play: "Oyna",
how: "Nasıl Oynanır",
lang: "Dil",
"char": "Karakter Seç"
},
en: {
play: "Play",
how: "How To Play",
lang: "Language",
"char": "Select Character"
},
es: {
play: "Jugar",
how: "Cómo Jugar",
lang: "Idioma",
"char": "Seleccionar Personaje"
},
de: {
play: "Spielen",
how: "Wie Man Spielt",
lang: "Sprache",
"char": "Charakter Wählen"
},
fr: {
play: "Jouer",
how: "Comment Jouer",
lang: "Langue",
"char": "Choisir Personnage"
}
};
// Game constants
// Character images for different emotions/states
var TOTAL_QUESTIONS = 10;
var TIME_PER_QUESTION = 30; // seconds
var BUTTON_SPACING = 180;
var selectedCharacter = "Stickman"; // Default character selection
// Function to update character assets based on selection
function updateCharacterAssets() {
if (selectedCharacter === "Pepo") {
// Replace stickman assets with pepo assets
stickman.setCharacter("Pepo");
} else if (selectedCharacter === "Chill Guy") {
// Replace stickman assets with chillguy assets
stickman.setCharacter("Chill Guy");
} else if (selectedCharacter === "at0m") {
// Replace stickman assets with at0m assets
stickman.setCharacter("at0m");
} else {
// Default to stickman
stickman.setCharacter("Stickman");
}
}
// Game state variables
var currentQuestion = 0;
var score = 0;
var timeLeft = TIME_PER_QUESTION;
var gameOver = false;
var answerLocked = false;
var secondChanceActive = false; // Track if second chance is active for current question
var currentCorrectIndex = 0;
var indianMusicPlaying = false; // Flag to track if indian music is playing
// Quiz questions
var questions = questionsByLang["tr"];
// Background colors for different questions
var backgroundColors = [0x87CEEB,
// Sky blue
0x98FB98,
// Pale green
0xFFB6C1,
// Light pink
0xFFD700,
// Gold
0xE6E6FA,
// Lavender
0xFFA07A,
// Light salmon
0xADD8E6,
// Light blue
0xF0E68C,
// Khaki
0xD8BFD8,
// Thistle
0xAFEEEE // Pale turquoise
];
// Create UI elements
var theset = game.addChild(LK.getAsset('theset', {
anchorX: 0.5,
anchorY: 0.5
}));
theset.position.set(2048 / 2 - 30 + 10, 2732 / 2 - 600 + 400 + 100);
var mainQuestionBoard = game.addChild(LK.getAsset('mainquestionboard', {
anchorX: 0.5,
anchorY: 0.5
}));
mainQuestionBoard.position.set(2048 / 2 + 135, 2732 / 2 + 430);
var questionCard = game.addChild(LK.getAsset('questionCard', {
anchorX: 0.5,
anchorY: -0.8
}));
questionCard.position.set(2048 / 2, 2732 / 2 - 500);
var questionText = new Text2("", {
size: 70,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 4
});
questionText.anchor.set(0.5, 0.5);
questionText.position.set(0, 920);
questionCard.addChild(questionText);
var answerButtons = [];
for (var i = 0; i < 4; i++) {
var button = new QuestionButton(i, "");
if (i === 0) {
// Move button A 500 pixels down and 215 pixels left
button.position.set(2048 / 2 - 515, 2732 / 2 - 100 + i * BUTTON_SPACING + 970);
} else if (i === 1) {
// Move button B 970 pixels down and 400 pixels right, then 20 pixels left
button.position.set(2048 / 2 + 510, 2732 / 2 - 100 + i * BUTTON_SPACING + 790);
} else if (i === 2) {
// Move button C 950 pixels down and 510 pixels left
button.position.set(2048 / 2 - 510, 2732 / 2 - 200 + i * BUTTON_SPACING + 1010);
} else {
button.position.set(2048 / 2 + 515, 2732 / 2 - 200 + i * BUTTON_SPACING + 830);
}
answerButtons.push(button);
game.addChild(button);
}
// Create jokers
var jokers = [];
var jokerTypes = ["fifty", "audience", "phone", "second"];
var jokerIcons = ["50/50", "👥", "📞", "🔄"];
for (var i = 0; i < 4; i++) {
var joker = new Joker(jokerTypes[i], jokerIcons[i]);
joker.position.set(280 + i * 150, 200);
jokers.push(joker);
game.addChild(joker);
}
// Create character
var character = new Character();
character.position.set(2048 / 2, 2732 - 300);
game.addChild(character);
// Create timer UI
var timerText = new Text2("", {
size: 100,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 5
});
timerText.anchor.set(0.5, 0.5);
timerText.position.set(2048 / 2, 150);
game.addChild(timerText);
// Create score display
var scoreText = new Text2("Score: 0", {
size: 70,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 4
});
scoreText.anchor.set(1, 0);
scoreText.position.set(2048 - 50, 50);
game.addChild(scoreText);
// Create question counter
var counterText = new Text2("Question: 1/" + TOTAL_QUESTIONS, {
size: 70,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 4
});
counterText.anchor.set(0, 0);
counterText.position.set(205, 50);
game.addChild(counterText);
// Second chance indicator text
var secondChanceText = new Text2("", {
size: 60,
fill: 0xFFFFFF,
stroke: 0x000000,
strokeThickness: 3
});
secondChanceText.anchor.set(0.5, 0.5);
secondChanceText.position.set(2048 / 2, 280);
game.addChild(secondChanceText);
// Create phone a friend popup
var phoneFriendPopup = new PhoneFriendPopup();
phoneFriendPopup.position.set(2048 / 2, 2732 / 2);
game.addChild(phoneFriendPopup);
// Create and add troll faces
var trollFaces = new TrollFaces();
trollFaces.position.set(2048 / 2 + 735, 2732 / 2 - 190);
game.addChild(trollFaces);
// Create and add stickman character
var stickman = new Stickman();
stickman.position.set(2048 / 2 - 725, 2732 / 2 - 150);
game.addChild(stickman);
// Game timer
var gameTimer = LK.setInterval(function () {
if (gameOver || answerLocked || menuOpen) {
return;
}
timeLeft--;
timerText.setText(timeLeft);
// Change character expression when time is running low
if (timeLeft <= 5) {
character.showExcited();
trollFaces.showSmile();
stickman.showAngry(); // Show angry stickman when 5 seconds left
}
if (timeLeft <= 0) {
timeExpired();
}
}, 1000);
// Game functions
function loadQuestion(index) {
if (index >= questions.length) {
endGame(true);
return;
}
// Change background color
game.setBackgroundColor(backgroundColors[index]);
var question = questions[index];
questionText.setText(wrapText(question.question, 45));
currentCorrectIndex = question.correctIndex;
for (var i = 0; i < 4; i++) {
answerButtons[i].setText(question.answers[i]);
answerButtons[i].setCorrect(i === question.correctIndex);
answerButtons[i].reset();
}
timeLeft = TIME_PER_QUESTION;
timerText.setText(timeLeft);
currentQuestion = index;
// Play Indian music when loading question 3
if (index === 2) {
// Question index 2 is the 3rd question (0-based indexing)
LK.playMusic('indian');
indianMusicPlaying = true;
}
// Play Russian short music once 3 seconds after question 4 loads
if (index === 3) {
LK.setTimeout(function () {
LK.playMusic('russianshort', {
loop: false
});
}, 3000);
}
// Play background music when 5th question is loaded
if (index === 4) {
LK.playMusic('backgroundMusic');
}
// Sayaç metni
var countLabel = {
tr: "Soru: ",
en: "Question: ",
es: "Pregunta: ",
de: "Frage: ",
fr: "Question : "
}[currentLang];
counterText.setText(countLabel + (index + 1) + "/" + TOTAL_QUESTIONS);
// Skor metni
var scoreLabel = currentLang === "tr" ? "Puan: " : "Score: ";
scoreText.setText(scoreLabel + score);
character.showNeutral();
stickman.showThinking(); // Reset stickman to thinking state for new question
secondChanceActive = false; // Reset second chance status for new question
secondChanceText.setText(""); // Clear second chance indicator
answerLocked = false;
}
function submitAnswer(index) {
if (answerLocked || menuOpen || secondaryMenuOpen) {
return;
}
var correct = index === currentCorrectIndex;
// Stop Indian music if it's playing (for 3rd question)
if (indianMusicPlaying) {
LK.stopMusic();
indianMusicPlaying = false;
}
// Special handling for second chance joker
if (secondChanceActive) {
if (correct) {
// If correct answer with second chance active, proceed normally
answerLocked = true;
LK.getSound('correctSound').play();
answerButtons[index].markAsCorrect();
character.showHappy();
trollFaces.showSad(); // Show sad troll face for correct answer
score++;
// Use millionaire prize tiers based on question number
var prizeMoney;
switch (currentQuestion) {
case 0:
prizeMoney = 250;
break;
case 1:
prizeMoney = 500;
break;
case 2:
prizeMoney = 1000;
break;
case 3:
prizeMoney = 2500;
break;
case 4:
prizeMoney = 25000;
break;
case 5:
prizeMoney = 50000;
break;
case 6:
prizeMoney = 100000;
break;
case 7:
prizeMoney = 250000;
break;
case 8:
prizeMoney = 500000;
break;
case 9:
prizeMoney = 1000000;
break;
default:
prizeMoney = 0;
}
scoreText.setText("Score: " + prizeMoney);
// Clear second chance indicator
secondChanceActive = false;
secondChanceText.setText("");
// Load next question after delay
LK.setTimeout(function () {
loadQuestion(currentQuestion + 1);
}, 1500);
} else {
// If wrong answer with second chance active, disable only that button
LK.getSound('incorrectSound').play();
answerButtons[index].disable(); // Make this button unclickable
// Deactivate second chance - one wrong answer protection used
secondChanceActive = false;
secondChanceText.setText(""); // Clear the indicator
// Player can still continue with this question, but will lose on next wrong answer
}
} else {
// Normal answer handling (no second chance active)
answerLocked = true;
if (correct) {
LK.getSound('correctSound').play();
answerButtons[index].markAsCorrect();
character.showHappy();
trollFaces.showSad(); // Show sad troll face for correct answer
stickman.showHappy(); // Show happy stickman for correct answer
score++;
// Use millionaire prize tiers based on question number
var prizeMoney;
switch (currentQuestion) {
case 0:
prizeMoney = 250;
break;
case 1:
prizeMoney = 500;
break;
case 2:
prizeMoney = 1000;
break;
case 3:
prizeMoney = 2500;
break;
case 4:
prizeMoney = 25000;
break;
case 5:
prizeMoney = 50000;
break;
case 6:
prizeMoney = 100000;
break;
case 7:
prizeMoney = 250000;
break;
case 8:
prizeMoney = 500000;
break;
case 9:
prizeMoney = 1000000;
break;
default:
prizeMoney = 0;
}
scoreText.setText("Score: " + prizeMoney);
LK.setTimeout(function () {
trollFaces.showHappy();
loadQuestion(currentQuestion + 1);
}, 2000);
} else {
LK.getSound('incorrectSound').play();
// Play hahaha sound with 0.2 second delay
LK.setTimeout(function () {
LK.getSound('hahaha').play(); // Play hahaha sound for wrong answer
}, 200);
answerButtons[index].markAsIncorrect();
character.showSad();
trollFaces.showHappy(); // Show happy troll face for wrong answer
stickman.showDisappointed(); // Show disappointed stickman for wrong answer
// Show correct answer and end game
answerButtons[currentCorrectIndex].markAsCorrect();
LK.setTimeout(function () {
LK.setTimeout(function () {
endGame(false);
}, 3000);
}, 3000);
}
}
}
function timeExpired() {
answerLocked = true;
character.showSad();
trollFaces.showHappy(); // Show happy troll face when time expires
stickman.showDisappointed(); // Show disappointed stickman when time expires
// Highlight correct answer
answerButtons[currentCorrectIndex].markAsCorrect();
// Stop Indian music if it's playing (for 3rd question)
if (indianMusicPlaying) {
LK.stopMusic();
indianMusicPlaying = false;
}
LK.setTimeout(function () {
endGame(false);
}, 3000);
}
function activateJoker(type) {
var joker = findJokerByType(type);
if (!joker || joker.used || menuOpen) {
return;
}
LK.getSound('jokerSound').play();
switch (type) {
case "fifty":
useFiftyFifty();
joker.use();
break;
case "audience":
useAudienceHelp();
joker.use();
break;
case "phone":
usePhoneFriend();
joker.use();
break;
case "second":
useSecondChance();
// For second chance, we don't mark the joker as used yet
// It will be marked as used when the player submits an answer
break;
}
}
function findJokerByType(type) {
for (var i = 0; i < jokers.length; i++) {
if (jokers[i].type === type) {
return jokers[i];
}
}
return null;
}
function useFiftyFifty() {
var eliminated = 0;
var attempts = 0;
// Try to eliminate two wrong answers
while (eliminated < 2 && attempts < 10) {
attempts++;
var randomIndex = Math.floor(Math.random() * 4);
if (answerButtons[randomIndex].eliminate()) {
eliminated++;
}
}
}
function useAudienceHelp() {
// Calculate audience accuracy based on question number
// Accuracy decreases as questions get harder
var baseAccuracy = 0.99 - currentQuestion * 0.05;
for (var i = 0; i < 4; i++) {
var percentage;
if (i === currentCorrectIndex) {
// Correct answer gets higher percentage based on accuracy
percentage = Math.floor(baseAccuracy * 100);
} else {
// Distribute remaining percentage among wrong answers
percentage = Math.floor((1 - baseAccuracy) * 33);
}
// Update button text to show percentage
var originalText = questions[currentQuestion].answers[i];
answerButtons[i].setText(originalText + " (" + percentage + "%)");
}
// Reset the text after 5 seconds
LK.setTimeout(function () {
for (var i = 0; i < 4; i++) {
answerButtons[i].setText(questions[currentQuestion].answers[i]);
}
}, 5000);
}
function usePhoneFriend() {
// hide the normal question card
questionCard.visible = false;
// show our new popup with the real answer
var correctAnswer = questions[currentQuestion].answers[currentCorrectIndex];
phoneFriendPopup.show(correctAnswer);
// mark the joker used
findJokerByType('phone').use();
// Add click handler to close popup when clicked anywhere
game.phoneFriendClickHandler = function (x, y, obj) {
phoneFriendPopup.hide();
questionCard.visible = true;
// Remove the handler by setting it to null
game.phoneFriendClickHandler = null;
};
// Assign the handler to game's down event
game.down = game.phoneFriendClickHandler;
// after 5 seconds, hide popup and go back
LK.setTimeout(function () {
phoneFriendPopup.hide();
questionCard.visible = true;
// Remove click handler if timer expires first
game.phoneFriendClickHandler = null;
}, 5000);
}
function useSecondChance() {
// Only activate if not already active
if (!secondChanceActive) {
// Mark second chance as active for the current question
secondChanceActive = true;
// Display second chance status
secondChanceText.setText("Second Chance Active 🔄");
secondChanceText.visible = true;
// Get the second chance joker
var secondChanceJoker = findJokerByType("second");
// Don't mark as used yet - will be used when player makes a selection
// We only want to mark it visually as active
tween(secondChanceJoker, {
alpha: 0.7
}, {
duration: 300
});
}
}
// Phone friend callback has been replaced by direct handling in usePhoneFriend
function endGame(completed) {
gameOver = true;
// Update high score
if (score > storage.highScore) {
storage.highScore = score;
}
// Update total games played
storage.totalPlayed = (storage.totalPlayed || 0) + 1;
// Show game over screen
if (completed) {
trollFaces.showAngry(); // Show angry troll face when completing all questions
stickman.showWinner(); // Show winner stickman when completing all questions
// Play yay sound when player wins
LK.getSound('yay').play();
LK.setTimeout(function () {
LK.showYouWin();
}, 2000);
} else {
LK.showGameOver();
}
}
// Create menu screen
var menuScreen = new MenuScreen();
menuScreen.position.set(2048 / 2, 2732 / 2);
game.addChild(menuScreen);
// ——— DİL MENÜSÜ ———
var languageMenu = new SecondarySmallMenu("Dil Seç / Select Language", ["Türkçe", "English", "Español", "Deutsch", "Français"]);
languageMenu.position.set(2048 / 2, 2732 / 2);
game.addChild(languageMenu);
languageMenu.optionButtons.forEach(function (btn) {
btn.down = function (x, y, obj) {
// Tıklama olayının menüyü tekrar kapatmaması için
if (obj && obj.event && typeof obj.event.stopPropagation === 'function') {
obj.event.stopPropagation();
}
// seçime göre currentLang
switch (this.optionValue) {
case "Türkçe":
currentLang = "tr";
break;
case "English":
currentLang = "en";
break;
case "Español":
currentLang = "es";
break;
case "Deutsch":
currentLang = "de";
break;
case "Français":
currentLang = "fr";
break;
}
// Sadece dil menüsünü kapat
closeSecondaryMenus();
// Menüdeki etiketleri (Play, Language vs) ve sayaç metnini güncelle
playText.setText(labels[currentLang].play);
howToPlayText.setText(labels[currentLang].how);
languageText.setText(labels[currentLang].lang);
stickmanText.setText(labels[currentLang]["char"]);
// Eğer ekranındaki başka metinler (counterText vb.) varsa, onları da güncelle:
counterText.setText({
tr: "Soru: ",
en: "Question: ",
es: "Pregunta: ",
de: "Frage: ",
fr: "Question : "
}[currentLang] + (currentQuestion + 1) + "/" + TOTAL_QUESTIONS);
scoreText.setText((currentLang === "tr" ? "Puan: " : "Score: ") + score);
};
});
var characterMenu = new SecondarySmallMenu("Select Character", ["Pepo", "Chill Guy", "at0m", "-", "-"]);
characterMenu.position.set(2048 / 2, 2732 / 2);
game.addChild(characterMenu);
// Override character menu option buttons to only close menu when clicked
characterMenu.optionButtons.forEach(function (btn) {
btn.down = function (x, y, obj) {
// Stop propagation to prevent menu from closing immediately
if (obj && obj.event && typeof obj.event.stopPropagation === 'function') {
obj.event.stopPropagation();
}
// Check which character was selected
if (this.optionValue === "Pepo") {
// Set a global flag to track which character is selected
selectedCharacter = "Pepo";
// Update stickman with Pepo assets
updateCharacterAssets();
} else if (this.optionValue === "Chill Guy") {
// Set a global flag to track which character is selected
selectedCharacter = "Chill Guy";
// Update stickman with Chill Guy assets
updateCharacterAssets();
} else if (this.optionValue === "at0m") {
// Set a global flag to track which character is selected
selectedCharacter = "at0m";
// Update stickman with at0m assets
updateCharacterAssets();
}
// Only close the small menu when a character is clicked
characterMenu.hide();
secondaryMenuOpen = false;
activeSecondaryMenu = null;
};
});
// Track menu states
var menuOpen = true;
var secondaryMenuOpen = false;
var activeSecondaryMenu = null;
// Initialize game
function initGame() {
// ——— Dil bazlı soruları seç
questions = questionsByLang[currentLang];
TOTAL_QUESTIONS = questions.length;
score = 0;
gameOver = false;
currentQuestion = 0;
secondChanceActive = false;
indianMusicPlaying = false;
// Reset jokers
for (var i = 0; i < jokers.length; i++) {
jokers[i].reset();
}
// Update score text - starting prize is $0 before first question answered
scoreText.setText("Score: " + 0);
// Clear second chance text
secondChanceText.setText("");
// Reset troll faces
trollFaces.showHappy();
// Reset stickman
stickman.showThinking();
// Start with first question
loadQuestion(0);
// Play background music
LK.playMusic('backgroundMusic');
}
// Initially hide game elements
function hideGameElements() {
// Hide all game UI elements
theset.visible = false;
mainQuestionBoard.visible = false;
questionCard.visible = false;
timerText.visible = false;
scoreText.visible = false;
counterText.visible = false;
character.visible = false;
stickman.visible = false;
trollFaces.visible = false;
secondChanceText.visible = false;
// Hide answer buttons and jokers
for (var i = 0; i < answerButtons.length; i++) {
answerButtons[i].visible = false;
}
for (var i = 0; i < jokers.length; i++) {
jokers[i].visible = false;
}
}
// Show game elements
function showGameElements() {
// Show all game UI elements
theset.visible = true;
mainQuestionBoard.visible = true;
questionCard.visible = true;
timerText.visible = true;
scoreText.visible = true;
counterText.visible = true;
character.visible = true;
stickman.visible = true;
trollFaces.visible = true;
// Show answer buttons and jokers
for (var i = 0; i < answerButtons.length; i++) {
answerButtons[i].visible = true;
}
for (var i = 0; i < jokers.length; i++) {
jokers[i].visible = true;
}
}
// Initially hide game elements and show menu
hideGameElements();
menuScreen.show();
// Function to open secondary menu
function openSecondaryMenu(menu) {
closeSecondaryMenus(); // Close any existing menu first
menu.show(); // This now handles setting secondaryMenuOpen and activeSecondaryMenu
}
// Function to close all secondary menus
function closeSecondaryMenus() {
if (activeSecondaryMenu) {
activeSecondaryMenu.hide();
activeSecondaryMenu = null;
secondaryMenuOpen = false;
}
}
// Add global click handler for game elements
game.down = function (x, y, obj) {
// Handle phone friend callback if active
if (game.phoneFriendClickHandler) {
game.phoneFriendClickHandler(x, y, obj);
}
};
// Modified initGame to show game elements
var originalInitGame = initGame;
initGame = function initGame() {
showGameElements();
originalInitGame();
}; ===================================================================
--- original.js
+++ change.js
@@ -845,47 +845,47 @@
var currentLang = "tr"; // Oyunun dili Türkçe başlasın
var questions; // Will be populated in initGame
var questionsByLang = {
tr: [{
- question: "1. Öğrencilerin en sevdiği ders hangisidir?",
- answers: ["Matematik", "Coğrafya", "Fen Bilgisi", "–"],
+ question: "1. Türkiye Cumhuriyeti ne zaman ilan edilmiştir?",
+ answers: ["1920", "1921", "1922", "1923"],
correctIndex: 3
}, {
- question: "2. Çin Seddi nerededir?",
- answers: ["Çin", "Meksika", "Moğolistan", "Mısır"],
- correctIndex: 0
- }, {
- question: "3. Dinlediğiniz marş hangi ülkenin dilindedir?",
- answers: ["İngilizce", "Rusça", "Almanca", "İspanyolca"],
+ question: "2. Kurtuluş Savaşı'nın lideri kimdir?",
+ answers: ["Kazım Karabekir", "Mustafa Kemal Atatürk", "İsmet İnönü", "Fevzi Çakmak"],
correctIndex: 1
}, {
- question: "4. Bogos binted?",
- answers: ["Evet", "Hayır", "Belki", "Rusça"],
+ question: "3. Türkiye'nin başkenti hangi şehirdir?",
+ answers: ["İstanbul", "Ankara", "İzmir", "Bursa"],
correctIndex: 1
}, {
- question: "5. Hangi “gezegen” dünyayı ısıtır?",
- answers: ["Güneş", "Jüpiter", "Ay", "Hiçbiri"],
- correctIndex: 3
- }, {
- question: "6. İkincisinin gelmesi 6 yıl, üçüncüsünün gelmesi 13 yıl süren şey nedir?",
- answers: ["Avatar", "GTA", "Kargocu’nun kargomu teslim etme süresi", "RDR3"],
+ question: "4. Osmanlı Devleti hangi yıl sona ermiştir?",
+ answers: ["1918", "1920", "1922", "1923"],
correctIndex: 2
}, {
- question: "7. Cyberpunk 2077’nin distopik geleceğinde karşılaşılan en korkunç şey hangisidir?",
- answers: ["Beyne çip takılması", "Hâlâ trap dinlenmesi", "Göz kürenizi çıkarıp yerine vidalı, lazerli sensör takılması", "Çetelerin sokağı ele geçirmesi"],
- correctIndex: 1
+ question: "5. Türkiye'nin ilk kadın pilotu kimdir?",
+ answers: ["Sabiha Gökçen", "Afet İnan", "Halide Edip", "Fikriye Hanım"],
+ correctIndex: 0
}, {
- question: "8. Hayatımı düzene sokup spora başlamaya ne zaman karar veririm?",
- answers: ["Akşam yemeği sırasında", "Günün en verimli saatinde", "Saat 12:00’de", "Gece saat 03:00’te, yataktayken"],
- correctIndex: 3
+ question: "6. 1453 yılında hangi önemli olay gerçekleşmiştir?",
+ answers: ["İstanbul'un Fethi", "Cumhuriyetin İlanı", "Sakarya Meydan Muharebesi", "Lozan Antlaşması"],
+ correctIndex: 0
}, {
- question: "9. Tüm diyetler ne zaman başlar?",
- answers: ["Pazar", "Pazartesi", "Salı", "Çarşamba"],
- correctIndex: 1
+ question: "7. Türkiye'nin en uzun nehri hangisidir?",
+ answers: ["Kızılırmak", "Fırat", "Dicle", "Yeşilırmak"],
+ correctIndex: 0
}, {
- question: "10. Kulakları en büyük hayvan hangisidir?",
- answers: ["Yarasa", "Tavşan", "Fil", "Kedi"],
- correctIndex: 2
+ question: "8. Atatürk'ün doğum yeri neresidir?",
+ answers: ["Selanik", "Samsun", "Ankara", "İstanbul"],
+ correctIndex: 0
+ }, {
+ question: "9. Türkiye'nin ilk anayasası hangi yılda kabul edilmiştir?",
+ answers: ["1921", "1924", "1961", "1982"],
+ correctIndex: 0
+ }, {
+ question: "10. TBMM hangi tarihte açılmıştır?",
+ answers: ["19 Mayıs 1919", "23 Nisan 1920", "29 Ekim 1923", "30 Ağustos 1922"],
+ correctIndex: 1
}],
en: [{
question: "1. Which subject is students’ favorite?",
answers: ["Mathematics", "Geography", "Science", "–"],