User prompt
puanımız üstte yazsın
User prompt
kaç soru çözersek okdar puanımız olsun
User prompt
1 dk sonra oyun sona ersin
User prompt
ali yi % 10 yukkarı
User prompt
ali yi % 30 aşşa al
User prompt
ali yi birazdaha aşşa al
User prompt
biraz daha
User prompt
biraz daha aşşada olabilir ali
User prompt
ali ekranın üstünde olacak
User prompt
sorunun üstünde bir asset olsun adı ali
Initial prompt
ali hoca
/**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Question class to handle math questions //<Write imports for supported plugins here> //<Assets used in the game will automatically appear here> // Initialize variables var Question = function Question() { this.generate = function () { // Generate a simple math question var num1 = Math.floor(Math.random() * 10); var num2 = Math.floor(Math.random() * 10); this.answer = num1 + num2; return "Is ".concat(num1, " + ").concat(num2, " = ").concat(this.answer, "?"); }; }; var question = new Question(); var questionText = new Text2('', { size: 100, fill: 0xFFFFFF }); questionText.anchor.set(0.5, 0.5); LK.gui.center.addChild(questionText); var trueButton = LK.getAsset('button', { x: 1024 - 200, y: 2000, anchorX: 0.5, anchorY: 0.5 }); var falseButton = LK.getAsset('button', { x: 1024 + 200, y: 2000, anchorX: 0.5, anchorY: 0.5 }); game.addChild(trueButton); game.addChild(falseButton); // Create an asset named 'ali' and position it at the top of the screen var ali = LK.getAsset('ali', { x: 1024, y: 400 + 2732 * 0.2, anchorX: 0.5, anchorY: 0.5 }); game.addChild(ali); function askQuestion() { questionText.setText(question.generate()); } var score = 0; // Initialize score variable var scoreText = new Text2('0', { size: 100, fill: 0xFFFFFF }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); function handleAnswer(isTrue) { if (isTrue) { score++; // Increment score each time a question is answered correctly scoreText.setText(score.toString()); askQuestion(); } else { LK.showGameOver(); } } trueButton.down = function (x, y, obj) { handleAnswer(true); }; falseButton.down = function (x, y, obj) { handleAnswer(false); }; // Start the game by asking the first question askQuestion(); // Set a timeout to end the game after 1 minute LK.setTimeout(function () { LK.showGameOver(); }, 60000);
===================================================================
--- original.js
+++ change.js
@@ -53,11 +53,18 @@
function askQuestion() {
questionText.setText(question.generate());
}
var score = 0; // Initialize score variable
+var scoreText = new Text2('0', {
+ size: 100,
+ fill: 0xFFFFFF
+});
+scoreText.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreText);
function handleAnswer(isTrue) {
if (isTrue) {
score++; // Increment score each time a question is answered correctly
+ scoreText.setText(score.toString());
askQuestion();
} else {
LK.showGameOver();
}