User prompt
Bir asset oluştur başlangıç ekranına adı gameBanner olsun
User prompt
move truetex and wrongtext 10px left
User prompt
move startBtn 170px down
User prompt
move startBtn 170px down and create another asset for starting screen which names: gameBanner
User prompt
score asseti sabit kalırken Score: formülünü yukarı taşı 188px ve sola taşı 9px
User prompt
score asseti sabit kalırken Score: formülünü yukarı taşı 178px
User prompt
score asseti sabit kalırken Score: formülünü yukarı taşı 78px
User prompt
Score u bu sefer 75px yukarı taşı
User prompt
Score: yazısını ekranın en altına taşı. Fontunu büyüt ve fontunu daha dramatik yap. Ayrıca arkasına da bir asset oluştur. score olsun adı.
User prompt
Move startBtn 140px down more
User prompt
Move startBtn 120px down
User prompt
Move true/true2/wrong/wrong2 assets 60px down
User prompt
delete tap to start text. not needed
User prompt
şıkların aralarını 32px arala
User prompt
move startBtn and tap to start text 270px down
User prompt
move startBtn and tap to start text 170px down
User prompt
şıkların aralarını 25px aç
User prompt
şıkların aralarını 10px aç
User prompt
No timer fix it
User prompt
Show the timer at top right of screen
User prompt
didnt show the digit timer. fix it
User prompt
Eğer 9 soruda 2 veya daha az doğru varsa, zaman bonusunun sadece 4te birini ekle.
User prompt
At the top right of screen also show the timer by digits. Use digits to harmonious with LOTR world
User prompt
Move true/true2 assets 500px left, truetext asset 500px right; move wrong/wrong2 assets 500px left, wrongtext asset 500px right
User prompt
Move truetext asset 100px right. move true and true2 assets 100px left. Move wrongtext asset 100px right. move wrong and wrong2 assets 100px left.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Option Button Class
var OptionButton = Container.expand(function () {
var self = Container.call(this);
// Attach button background
var btn = self.attachAsset('optionBtn', {
anchorX: 0.5,
anchorY: 0.5
});
// Attach text
var txt = new Text2('', {
size: 80,
fill: "#fff"
});
txt.anchor.set(0.5, 0.5);
self.addChild(txt);
// Set option text
self.setText = function (str) {
txt.setText(str);
};
// Set index (for event handling)
self.index = -1;
// Enable/disable button
self.setEnabled = function (enabled) {
btn.alpha = enabled ? 1 : 0.5;
self.interactive = enabled;
};
// Flash green/red for feedback
self.flash = function (color, duration) {
tween(btn, {
color: color
}, {
duration: duration,
onFinish: function onFinish() {
btn.color = 0x8B0000;
}
});
};
return self;
});
// Start Button Class
var StartButton = Container.expand(function () {
var self = Container.call(this);
var btn = self.attachAsset('startBtn', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
// Timer Bar Class
var TimerBar = Container.expand(function () {
var self = Container.call(this);
var bg = self.attachAsset('timerBarBg', {
anchorX: 0.5,
anchorY: 0.5
});
var fg = self.attachAsset('timerBarFg', {
anchorX: 0.5,
anchorY: 0.5
});
fg.y = 0;
self.fg = fg;
self.bg = bg;
// Set progress (0-1)
self.setProgress = function (p) {
if (p < 0) p = 0;
if (p > 1) p = 1;
fg.width = 1200 * p;
fg.x = -(1200 * (1 - p)) / 2;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x181818
});
/****
* Game Code
****/
// Timer bar foreground
// Timer bar background
// Start button shape: larger dark red rectangle
// Button shape: dark red rectangle for options
// --- Quiz Data ---
// 3 packages: Easy, Medium, Hard. Each is an array of {q, options, answer, points}
var easyQuestions = [{
q: "What is the name of Bilbo's home?",
options: ["Bag End", "Rivendell", "Minas Tirith", "Helm's Deep"],
answer: 0,
points: 3
}, {
q: "Who is Frodo's loyal gardener?",
options: ["Samwise", "Gimli", "Boromir", "Legolas"],
answer: 0,
points: 3
}, {
q: "What creature did Gollum used to be?",
options: ["Hobbit", "Elf", "Dwarf", "Orc"],
answer: 0,
points: 3
}, {
q: "What is the name of Frodo's sword?",
options: ["Sting", "Andúril", "Glamdring", "Orcrist"],
answer: 0,
points: 3
}, {
q: "Who is the wizard in a grey cloak?",
options: ["Gandalf", "Saruman", "Radagast", "Sauron"],
answer: 0,
points: 3
}];
var mediumQuestions = [{
q: "Who forged the One Ring?",
options: ["Sauron", "Saruman", "Elrond", "Gandalf"],
answer: 0,
points: 5
}, {
q: "What is the name of Aragorn's sword?",
options: ["Andúril", "Sting", "Glamdring", "Orcrist"],
answer: 0,
points: 5
}, {
q: "Which forest is home to Legolas?",
options: ["Mirkwood", "Fangorn", "Lothlórien", "Shire"],
answer: 0,
points: 5
}, {
q: "Who is the Lady of Lothlórien?",
options: ["Galadriel", "Arwen", "Éowyn", "Shelob"],
answer: 0,
points: 5
}, {
q: "What is the name of the inn in Bree?",
options: ["The Prancing Pony", "The Green Dragon", "The Golden Perch", "The Ivy Bush"],
answer: 0,
points: 5
}];
var hardQuestions = [{
q: "Who was the first King of Númenor?",
options: ["Elros", "Isildur", "Ar-Pharazôn", "Tar-Míriel"],
answer: 0,
points: 10
}, {
q: "What is the true name of Gandalf?",
options: ["Olórin", "Curunír", "Aiwendil", "Mithrandir"],
answer: 0,
points: 10
}, {
q: "Which Vala created the Dwarves?",
options: ["Aulë", "Manwë", "Ulmo", "Yavanna"],
answer: 0,
points: 10
}, {
q: "Who is the father of Galadriel?",
options: ["Finarfin", "Finwë", "Fëanor", "Fingolfin"],
answer: 0,
points: 10
}, {
q: "What is the name of the mountain where the One Ring was forged?",
options: ["Orodruin", "Caradhras", "Erebor", "Thangorodrim"],
answer: 0,
points: 10
}];
// Helper to pick n random questions from an array
function pickRandomQuestions(arr, n) {
var copy = arr.slice();
shuffleArray(copy);
var out = [];
for (var i = 0; i < n && i < copy.length; i++) {
out.push(copy[i]);
}
return out;
}
// Select 3 random from each package for this game
var selectedEasy = pickRandomQuestions(easyQuestions, 3);
var selectedMedium = pickRandomQuestions(mediumQuestions, 3);
var selectedHard = pickRandomQuestions(hardQuestions, 3);
// Combine for 9-question game: 3 easy, 3 medium, 3 hard
var allQuestions = selectedEasy.concat(selectedMedium, selectedHard);
// --- State Variables ---
var currentQuestion = 0;
var score = 0;
var timeLeft = 60.0; // seconds
var timerInterval = null;
var quizStarted = false;
var optionButtons = [];
var timerBar = null;
var questionText = null;
var scoreText = null;
var startButton = null;
var summaryText = null;
var bonusText = null;
var canAnswer = false;
// --- Utility Functions ---
// Shuffle array in-place (Fisher-Yates)
function shuffleArray(arr) {
for (var i = arr.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
}
// Randomize options for a question, return {options, answerIdx}
function randomizeOptions(q) {
var opts = [];
for (var i = 0; i < 4; i++) {
opts.push({
text: q.options[i],
origIdx: i
});
}
shuffleArray(opts);
var answerIdx = -1;
for (var i = 0; i < 4; i++) {
if (opts[i].origIdx === q.answer) {
answerIdx = i;
break;
}
}
return {
options: [opts[0].text, opts[1].text, opts[2].text, opts[3].text],
answerIdx: answerIdx
};
}
// --- UI Setup ---
// Center positions
var centerX = 2048 / 2;
var centerY = 2732 / 2;
// Question text
questionText = new Text2('', {
size: 100,
fill: "#fff"
});
questionText.anchor.set(0.5, 0);
questionText.x = centerX;
questionText.y = 350;
// Score background asset (bottom center, behind score text)
var scoreBgAsset = LK.getAsset('score', {
anchorX: 0.5,
anchorY: 1.0,
x: centerX,
y: 2732 - 40
});
game.addChild(scoreBgAsset);
// Score text (bottom center, GUI, dramatic font)
scoreText = new Text2('Score: 0', {
size: 140,
fill: "#fff",
font: "'Impact','GillSans-Bold','Arial Black','Papyrus','Georgia','Times New Roman',serif"
});
scoreText.anchor.set(0.5, 1.0);
// Move Score: text 188px up and 9px left from its previous position
scoreText.x = centerX - 9;
scoreText.y = 2732 - 40 - 10 - 188;
game.addChild(scoreText);
// Timer bar (below score)
timerBar = new TimerBar();
timerBar.x = centerX;
timerBar.y = 200;
timerBar.setProgress(1);
game.addChild(timerBar);
// Timer digits (top right, GUI, using harmonious style)
var timerDigits = new Text2('60', {
size: 110,
fill: 0xE2C275,
// goldish, harmonious with LOTR
font: "'Papyrus','Georgia','Times New Roman',serif"
});
timerDigits.anchor.set(1, 0); // right-top
timerDigits.x = 2048 - 60; // 60px from right edge, avoid top left menu
timerDigits.y = 0;
LK.gui.top.addChild(timerDigits);
// Option buttons (4)
var optionYStart = 900;
var optionYGap = 260 + 32; // 32px extra gap between options
for (var i = 0; i < 4; i++) {
var btn = new OptionButton();
btn.x = centerX;
btn.y = optionYStart + i * optionYGap;
btn.index = i;
btn.setEnabled(false);
// Event: tap/click
btn.down = function (idx) {
return function (x, y, obj) {
if (!canAnswer) return;
handleOptionSelected(idx);
};
}(i);
optionButtons.push(btn);
game.addChild(btn);
}
// Starting screen background (centered, behind start button)
var startingScreenBg = LK.getAsset('startingscreen', {
anchorX: 0.5,
anchorY: 0.5,
x: centerX,
y: centerY
});
game.addChild(startingScreenBg);
// Game banner asset (centered, above start button)
var gameBannerAsset = LK.getAsset('gameBanner', {
anchorX: 0.5,
anchorY: 0.5,
x: centerX,
y: centerY - 350
});
game.addChild(gameBannerAsset);
// Start button (centered, moved 440px down)
startButton = new StartButton();
startButton.x = centerX;
startButton.y = centerY + 440;
startButton.down = function (x, y, obj) {
if (!quizStarted) {
startQuiz();
}
};
game.addChild(startButton);
// Summary text (hidden at start)
summaryText = new Text2('', {
size: 110,
fill: "#fff"
});
summaryText.anchor.set(0.5, 0.5);
summaryText.x = centerX;
summaryText.y = centerY - 200;
summaryText.visible = false;
game.addChild(summaryText);
// Bonus text (hidden at start)
bonusText = new Text2('', {
size: 80,
fill: 0x83DE44
});
bonusText.anchor.set(0.5, 0.5);
bonusText.x = centerX;
bonusText.y = centerY + 100;
bonusText.visible = false;
game.addChild(bonusText);
// --- Feedback Assets ---
var trueAsset = LK.getAsset('true', {
anchorX: 0.5,
anchorY: 1.0,
x: centerX - 500,
y: 2732 - 40 + 60
});
var wrongAsset = LK.getAsset('wrong', {
anchorX: 0.5,
anchorY: 1.0,
x: centerX - 500,
y: 2732 - 40 + 60
});
var trueAsset2 = LK.getAsset('true2', {
anchorX: 0.5,
anchorY: 1.0,
x: centerX - 500,
y: 2732 - 40 + 60
});
var wrongAsset2 = LK.getAsset('wrong2', {
anchorX: 0.5,
anchorY: 1.0,
x: centerX - 500,
y: 2732 - 40 + 60
});
trueAsset.visible = false;
wrongAsset.visible = false;
trueAsset2.visible = false;
wrongAsset2.visible = false;
// --- Feedback Text Assets ---
var truetextAsset = LK.getAsset('truetext', {
anchorX: 0.5,
anchorY: 1.0,
x: centerX + 490,
y: 2732 - 300
});
var wrongtextAsset = LK.getAsset('wrongtext', {
anchorX: 0.5,
anchorY: 1.0,
x: centerX + 490,
y: 2732 - 300
});
truetextAsset.visible = false;
wrongtextAsset.visible = false;
game.addChild(trueAsset);
game.addChild(wrongAsset);
game.addChild(trueAsset2);
game.addChild(wrongAsset2);
game.addChild(truetextAsset);
game.addChild(wrongtextAsset);
// --- Game Logic ---
function startQuiz() {
quizStarted = true;
score = 0;
timeLeft = 60.0;
currentQuestion = 0;
scoreText.setText('Score: 0');
timerBar.setProgress(1);
timerDigits.setText("60");
summaryText.visible = false;
bonusText.visible = false;
startButton.visible = false;
startingScreenBg.visible = false;
for (var i = 0; i < 4; i++) {
optionButtons[i].setEnabled(false);
optionButtons[i].visible = true;
}
showQuestion(currentQuestion);
canAnswer = true;
// Start timer
if (timerInterval) {
LK.clearInterval(timerInterval);
}
timerInterval = LK.setInterval(function () {
if (!quizStarted) return;
timeLeft -= 0.1;
if (timeLeft < 0) timeLeft = 0;
timerBar.setProgress(timeLeft / 60.0);
// Update timerDigits to show remaining time as integer seconds, always 2 digits
var shownTime = Math.ceil(timeLeft);
if (shownTime < 0) shownTime = 0;
if (shownTime > 99) shownTime = 99;
timerDigits.setText((shownTime < 10 ? "0" : "") + shownTime);
if (timeLeft <= 0) {
endQuiz();
}
}, 100);
}
function showQuestion(idx) {
if (idx >= allQuestions.length) {
endQuiz();
return;
}
var q = allQuestions[idx];
var randomized = randomizeOptions(q);
// Split question into two lines if more than 8 words
var qText = q.q;
var words = qText.split(' ');
if (words.length > 8) {
var mid = Math.ceil(words.length / 2);
var firstLine = words.slice(0, mid).join(' ');
var secondLine = words.slice(mid).join(' ');
qText = firstLine + '\n' + secondLine;
}
questionText.setText(qText);
if (!game.children.includes(questionText)) {
game.addChild(questionText);
}
for (var i = 0; i < 4; i++) {
optionButtons[i].setText(randomized.options[i]);
optionButtons[i].setEnabled(true);
optionButtons[i].visible = true;
optionButtons[i].correct = i === randomized.answerIdx;
}
canAnswer = true;
}
function handleOptionSelected(idx) {
if (!canAnswer) return;
canAnswer = false;
var q = allQuestions[currentQuestion];
var correctIdx = -1;
for (var i = 0; i < 4; i++) {
if (optionButtons[i].correct) {
correctIdx = i;
break;
}
}
// Feedback: flash green/red
// Pick which feedback asset to show
var showTrue = Math.random() < 0.5;
var showWrong = Math.random() < 0.5;
if (optionButtons[idx].correct) {
optionButtons[idx].flash(0x83de44, 300);
score += q.points;
scoreText.setText('Score: ' + score);
if (showTrue) {
trueAsset.visible = true;
trueAsset2.visible = false;
} else {
trueAsset.visible = false;
trueAsset2.visible = true;
}
wrongAsset.visible = false;
wrongAsset2.visible = false;
// Show truetext asset
truetextAsset.visible = true;
wrongtextAsset.visible = false;
} else {
optionButtons[idx].flash(0xff0000, 300);
optionButtons[correctIdx].flash(0x83de44, 300);
trueAsset.visible = false;
trueAsset2.visible = false;
if (showWrong) {
wrongAsset.visible = true;
wrongAsset2.visible = false;
} else {
wrongAsset.visible = false;
wrongAsset2.visible = true;
}
// Show wrongtext asset
truetextAsset.visible = false;
wrongtextAsset.visible = true;
}
// Hide feedback after short delay
LK.setTimeout(function () {
trueAsset.visible = false;
wrongAsset.visible = false;
trueAsset2.visible = false;
wrongAsset2.visible = false;
truetextAsset.visible = false;
wrongtextAsset.visible = false;
}, 500);
// Disable all buttons
for (var i = 0; i < 4; i++) {
optionButtons[i].setEnabled(false);
}
// Next question after short delay
LK.setTimeout(function () {
currentQuestion++;
if (currentQuestion < allQuestions.length && timeLeft > 0) {
showQuestion(currentQuestion);
} else {
endQuiz();
}
}, 600);
}
function endQuiz() {
quizStarted = false;
canAnswer = false;
if (timerInterval) {
LK.clearInterval(timerInterval);
timerInterval = null;
}
timerDigits.setText("00");
// Hide question/options
questionText.setText('');
for (var i = 0; i < 4; i++) {
optionButtons[i].setEnabled(false);
optionButtons[i].visible = false;
}
// Calculate number of correct answers
var correctCount = 0;
for (var i = 0; i < allQuestions.length; i++) {
if (score >= allQuestions[i].points * (i + 1)) {
correctCount++;
score -= allQuestions[i].points;
}
}
// Restore score (since above loop subtracts)
score += correctCount * (allQuestions[0] ? allQuestions[0].points : 0);
// Calculate bonus: 1 point per 2 seconds left (rounded down)
var bonus = Math.floor(timeLeft / 2);
// If 2 or fewer correct in 9 questions, only 1/4 bonus
if (allQuestions.length === 9 && correctCount <= 2) {
bonus = Math.floor(bonus / 4);
}
var total = score + bonus;
summaryText.setText("Quiz Complete!\nFinal Score: " + score);
summaryText.visible = true;
bonusText.setText("Time Bonus: +" + bonus + "\nTotal: " + total);
bonusText.visible = true;
scoreText.setText('Score: ' + total);
// Show start button again after delay
LK.setTimeout(function () {
startButton.visible = true;
startingScreenBg.visible = true;
summaryText.visible = false;
bonusText.visible = false;
scoreText.setText('Score: 0');
}, 3500);
}
// --- Game Update ---
game.update = function () {
// No per-frame logic needed; timer handled by interval
};
// --- Touch Handling ---
// No drag/move needed; all handled by button events
// --- End of File --- ===================================================================
--- original.js
+++ change.js
@@ -87,14 +87,14 @@
/****
* Game Code
****/
-// 3 packages: Easy, Medium, Hard. Each is an array of {q, options, answer, points}
-// --- Quiz Data ---
-// Button shape: dark red rectangle for options
-// Start button shape: larger dark red rectangle
-// Timer bar background
// Timer bar foreground
+// Timer bar background
+// Start button shape: larger dark red rectangle
+// Button shape: dark red rectangle for options
+// --- Quiz Data ---
+// 3 packages: Easy, Medium, Hard. Each is an array of {q, options, answer, points}
var easyQuestions = [{
q: "What is the name of Bilbo's home?",
options: ["Bag End", "Rivendell", "Minas Tirith", "Helm's Deep"],
answer: 0,
@@ -308,8 +308,16 @@
x: centerX,
y: centerY
});
game.addChild(startingScreenBg);
+// Game banner asset (centered, above start button)
+var gameBannerAsset = LK.getAsset('gameBanner', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: centerX,
+ y: centerY - 350
+});
+game.addChild(gameBannerAsset);
// Start button (centered, moved 440px down)
startButton = new StartButton();
startButton.x = centerX;
startButton.y = centerY + 440;
Make him smile
a LOTR style button with elegant and green leaves. In-Game asset. 2d. High contrast. No shadows
write "TAP to START" on it with LOTR style
tonu daha yapraksı ve dokulu olsun
Kare ama köşeleri oval bir banner. LOTR tarzı. Yeşil ve altın sarısı ağırlıklı. İçinde "Myths of the West" yazıyor.
write: "This is an unofficial, non-commercial quiz game created as a tribute to the epic legends imagined by J.R.R. Tolkien." with golden color and LOTR style. 1400x200. In-Game asset. 2d. High contrast. No shadows
Golden ornoment LOTR style. In-Game asset. 2d. High contrast. No shadows
Same but write "RESTART"
Same stars but make it two.
delete blacks
Write "MAGNIFICENT" bottom of the stars with LOTR style
Arka planı sil şeffaf olsun
Tamamen aynı sanatsal formda ama parmağını aşağı indirip üzülen GOLLUM olacak
Tamamen aynı sanatsal formda ama parmağını aşağı indirip üzülen GRIMA WORMTHONG olacak
Tamamen aynı sanatsal formda ama parmağını yukarı kaldırıp gülen ARAGORN olacak
Tamamen aynı sanatsal formda ama parmağını aşağı indirip üzülen SARUMAN olacak
Make a mute button in lotr style
Çerçeve içinde "5'te 5 BONUS" yazsın. LOTR temalı olacak. Dikkat çekici bir popup bu.. In-Game asset. 2d. High contrast. No shadows
Her şey aynı sadece yazıyı düzenle; "5 out of 5 BONUS"
tamamen aynı sadece rengi biraz daha soluk gri olacak
tamamen aynı ama yeşilin tonunu daha LOTR dünyasına uydur. ve çizgileri koyu kahverengi yap
Tamamen aynı resim olacak ama daha gerçekçi bir hale getir
Tamamen aynı ama yatay olacak
arka planı ve pençesindeki yüzüğü sil