User prompt
ya sayılar daha büyük olsun. Bir de cevap kutucuğunun altına kadar hareket edebilsinler.
User prompt
reis timer ile balonların assetini ayır bence
User prompt
oyuncu doğru bilince tebrikler diye bir pop up gesin. oyuncu pop up'a tıkayınca yeni oyuna geçsin
User prompt
alttaki sayılar önce yavaş hareket etsin süre bitmeye yaklaştıkça daha hızlansınlar ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
reis bence işlemi mor kutucuk ile timer'ın ortasına koy
User prompt
işlem ve timer üst üste geldi
User prompt
60 saniyesi olsun oyuncunun. geri sayımı da daha belirgin göster
User prompt
tamam. oyunu tamamen hard mode yapalım. hard mode seçeneğini kaldır. oyun tamamen hard mode şeklinde olsun. sayılr biraz daha yavaş hareket etsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'Quadratic')' in or related to this line: 'tween.to(digitCubes[i], {' Line Number: 352 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'Timeout.tick error: tween is not defined' in or related to this line: 'tween.to(digitCubes[i], {' Line Number: 346
User prompt
fail olunca doğru cevabı yazsın ekranda. bir de hard mode yapalım. sağ üstte görünsün. Hard mode'a tıklayınca alttaki sayılar random hareket etsin ekranda ve tıklamaya çalışalım hareket ederken cevaplayabilmek için
User prompt
arkaplan resmi koyalım. yanda üç joker hakkı olsun. bir tanesi ilk basamağı yazsın. diğeri sonuçta geçmeyen iki sayıyı alttan silsin. üçüncüsü de başka işleme geçirsin. bu jokerler tek seferlik olsun. kullanılınca rengi yeşiilden kırmızıya dönüşsün
User prompt
reis cevap kaç haneliyse o kadar sayıya tıklamam izin vermelisin.
User prompt
bilgisayardayım. tamam o zaman karakteri kaldıralım. ben tıklayarak sonucu yazayım. tıkladığım sayı ortaya gitsin. Mesela cevap üç haneliyse sonuna kadar beklesin kontrol etmek için. dört ise dört
User prompt
karakteri hareket ettiremiyorum ki
User prompt
kahramanımız verilen süre içerisinde ekranda görünen matematiksel dört işlemin sonucunu ortadaki beyaz kutucuğa götürmek zorunda. aşağıda küp şeklinde sıfırdan dokuza kadar saılar var. kahraman sonucu bu sayıları sırayla kutucuğun içine götürerek tahmin ediyor. doğruysa yeni oyuna geçiliyor. yanlışsa fail oluyor
User prompt
Matematik Kahramanı: Sonucu Bul!
Initial prompt
kahramanımız verilen süre içerisinde ekranda görünen matematiksel dört işlemin sonucunu ortadaki beyaz kutucuğa götürmek zorunda. aşağıda küp şeklinde sıfırdan dokuza kadar sayılar var. kahraman sonucu bu sayıları sırayla kutucuğun içine götürerek tahmin ediyor. doğruysa yeni oyuna geçiliyor. yanlışsa fail oluyor
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// --- Game Variables ---
// Import tween plugin for animations
var currentQuestion = null; // Holds the current math question object
var answerDigits = []; // Array of selected digit values (as strings)
var digitCubes = []; // Array of digit cube objects (0-9)
var answerBox = null; // The answer drop zone
var questionText = null; // The question display
var timerText = null; // Timer display
var timer = null; // Timer interval id
var timeLeft = 60; // Total seconds for the game
var timerBar = null; // Visual timer bar
var timerBarBg = null; // Timer bar background
var timerBarWidth = 1200; // Width of the timer bar
var timerBarHeight = 60; // Height of the timer bar
var timerBarX = 2048 / 2 - timerBarWidth / 2;
var timerBarY = 240;
var timerBarColor = 0xFF3333;
var timerBarBgColor = 0x222222;
var timerBarPadding = 8;
// Removed hero and drag logic; input is now by clicking digit cubes
var score = 0; // Player score
// --- Background Image ---
var bgImage = LK.getAsset('background', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0,
width: 2048,
height: 2732
});
game.addChildAt(bgImage, 0); // Add as background
// --- Joker State ---
var jokers = [{
used: false,
label: "İlk Basamak",
color: 0x00cc00
}, {
used: false,
label: "Yanlışları Sil",
color: 0x00cc00
}, {
used: false,
label: "Atla",
color: 0x00cc00
}];
var jokerButtons = [];
// --- Utility Functions ---
function randomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
// Generates a random math question object: {text, answer}
function generateQuestion() {
var ops = ['+', '-', '×', '÷'];
var op = ops[randomInt(0, ops.length - 1)];
var a, b, text, answer;
if (op === '+') {
a = randomInt(1, 99);
b = randomInt(1, 99);
answer = a + b;
} else if (op === '-') {
a = randomInt(10, 99);
b = randomInt(1, a);
answer = a - b;
} else if (op === '×') {
a = randomInt(2, 12);
b = randomInt(2, 12);
answer = a * b;
} else {
// ÷
b = randomInt(2, 12);
answer = randomInt(2, 12);
a = b * answer;
}
text = a + " " + op + " " + b + " = ?";
return {
text: text,
answer: answer
};
}
// Resets the answer input and updates the answer box display
function resetAnswer() {
answerDigits = [];
updateAnswerBox();
}
// Updates the answer box text to show current input
function updateAnswerBox() {
if (answerBox && answerBox.textObj) {
answerBox.textObj.setText(answerDigits.length ? answerDigits.join('') : "");
}
}
// Starts a new question
function startNewQuestion() {
if (timer) {
LK.clearInterval(timer);
}
currentQuestion = generateQuestion();
questionText.setText(currentQuestion.text);
resetAnswer();
// Reset digit cubes visibility for new question
for (var d = 0; d < digitCubes.length; d++) {
digitCubes[d].visible = true;
}
// Do not reset timeLeft here; timer is for the whole game
// Only set timer if not already running
if (!timer) {
timerText.setText("⏰ " + timeLeft);
timerBar.width = timerBarWidth;
timer = LK.setInterval(function () {
timeLeft--;
timerText.setText("⏰ " + timeLeft);
// Update timer bar width
timerBar.width = Math.max(0, timerBarWidth * (timeLeft / 60));
if (timeLeft <= 0) {
LK.clearInterval(timer);
timer = null;
timerBar.width = 0;
LK.showGameOver();
}
}, 1000);
}
}
// Checks the answer and proceeds accordingly
function checkAnswer() {
var guess = parseInt(answerDigits.join(''));
if (guess === currentQuestion.answer) {
score++;
startNewQuestion();
} else {
LK.clearInterval(timer);
timer = null;
if (timerBar) timerBar.width = 0;
// Show correct answer in the answer box before game over
if (answerBox && answerBox.textObj) {
answerBox.textObj.setText("Doğru: " + currentQuestion.answer);
}
LK.setTimeout(function () {
LK.showGameOver();
}, 1200);
}
}
// --- UI Setup ---
// --- Question Box (purple) centered between timer and answer box ---
var questionBox = new Container();
var questionBoxAsset = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5
});
questionBoxAsset.width = 600;
questionBoxAsset.height = 180;
questionBoxAsset.tint = 0x8720fe;
questionBox.addChild(questionBoxAsset);
// Place questionBox between timerText (y=20, height~160) and answerBox (y=900, height=200)
// Let's center it at y = (timerBarY + answerBox.y) / 2, but visually, a bit above answerBox
questionBox.x = 2048 / 2;
questionBox.y = (timerBarY + 900) / 2 - 60; // visually balanced
questionText = new Text2("", {
size: 120,
fill: 0xFFFFFF
});
questionText.anchor.set(0.5, 0.5);
questionText.x = 0;
questionText.y = 0;
questionBox.addChild(questionText);
game.addChild(questionBox);
// Timer at top center, larger and more visible
timerText = new Text2("⏰ 60", {
size: 160,
fill: 0xFF3333,
fontWeight: "bold"
});
timerText.anchor.set(0.5, 0);
timerText.x = 2048 / 2;
// Move timerText higher to avoid overlap with questionText
timerText.y = 20;
game.addChild(timerText);
// Timer bar background
timerBarBg = LK.getAsset('bullet', {
anchorX: 0,
anchorY: 0
});
timerBarBg.width = timerBarWidth + timerBarPadding * 2;
timerBarBg.height = timerBarHeight + timerBarPadding * 2;
timerBarBg.x = timerBarX - timerBarPadding;
timerBarBg.y = timerBarY - timerBarPadding;
timerBarBg.tint = timerBarBgColor;
game.addChild(timerBarBg);
// Timer bar (foreground)
timerBar = LK.getAsset('bullet', {
anchorX: 0,
anchorY: 0
});
timerBar.width = timerBarWidth;
timerBar.height = timerBarHeight;
timerBar.x = timerBarX;
timerBar.y = timerBarY;
timerBar.tint = timerBarColor;
game.addChild(timerBar);
// --- Hard Mode: Always enabled, no toggle button ---
// Joker buttons (right side, vertically spaced)
var jokerStartY = 400;
var jokerSpacing = 220;
for (var j = 0; j < 3; j++) {
var jokerBtn = new Container();
var btnAsset = LK.getAsset('character', {
anchorX: 0.5,
anchorY: 0.5
});
btnAsset.width = 180;
btnAsset.height = 180;
btnAsset.tint = jokers[j].color;
jokerBtn.addChild(btnAsset);
var btnText = new Text2(jokers[j].label, {
size: 38,
fill: 0xffffff
});
btnText.anchor.set(0.5, 0.5);
btnText.x = 0;
btnText.y = 0;
jokerBtn.addChild(btnText);
jokerBtn.x = 2048 - 180;
jokerBtn.y = jokerStartY + j * jokerSpacing;
jokerBtn.jokerIndex = j;
// Joker button logic
jokerBtn.down = function (idx) {
return function (x, y, obj) {
if (jokers[idx].used) return;
jokers[idx].used = true;
// Change color to red
jokerButtons[idx].children[0].tint = 0xcc0000;
// Joker 1: Fill first digit
if (idx === 0) {
var ansStr = currentQuestion.answer + "";
if (answerDigits.length < ansStr.length) {
answerDigits = [ansStr[0]];
updateAnswerBox();
}
}
// Joker 2: Remove two incorrect digits from cubes
else if (idx === 1) {
var ansStr2 = currentQuestion.answer + "";
var digitsInAnswer = {};
for (var k = 0; k < ansStr2.length; k++) {
digitsInAnswer[ansStr2[k]] = true;
}
var removed = 0;
for (var d = 0; d < digitCubes.length; d++) {
if (!digitsInAnswer.hasOwnProperty(digitCubes[d].digit + "") && removed < 2) {
digitCubes[d].visible = false;
removed++;
}
}
}
// Joker 3: Skip to next question
else if (idx === 2) {
startNewQuestion();
}
};
}(j);
jokerButtons.push(jokerBtn);
game.addChild(jokerBtn);
}
// Answer box in center
answerBox = new Container();
var boxAsset = LK.getAsset('centerCircle', {
anchorX: 0.5,
anchorY: 0.5
});
boxAsset.width = 400;
boxAsset.height = 200;
answerBox.addChild(boxAsset);
answerBox.x = 2048 / 2;
answerBox.y = 900;
answerBox.textObj = new Text2("", {
size: 120,
fill: 0x000000
});
answerBox.textObj.anchor.set(0.5, 0.5);
answerBox.textObj.x = 0;
answerBox.textObj.y = 0;
answerBox.addChild(answerBox.textObj);
game.addChild(answerBox);
// Digit cubes (0-9) at bottom, spaced evenly, now clickable
var cubeSpacing = 180;
var startX = (2048 - (cubeSpacing * 10 - 40)) / 2;
for (var i = 0; i < 10; i++) {
var cube = new Container();
var asset = LK.getAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5
});
asset.width = 140;
asset.height = 140;
cube.addChild(asset);
var txt = new Text2(i + "", {
size: 90,
fill: 0x000000
});
txt.anchor.set(0.5, 0.5);
txt.x = 0;
txt.y = 0;
cube.addChild(txt);
cube.x = startX + i * cubeSpacing;
cube.y = 2400;
cube.digit = i;
// Add click/tap handler
cube.down = function (digit) {
return function (x, y, obj) {
// Only allow input if we haven't reached the required number of digits
if (answerDigits.length < (currentQuestion.answer + "").length) {
answerDigits.push(digit + "");
updateAnswerBox();
// If we've reached the required number of digits, check the answer
if (answerDigits.length === (currentQuestion.answer + "").length) {
checkAnswer();
}
}
// If already at max digits, ignore further input
};
}(i);
digitCubes.push(cube);
game.addChild(cube);
}
// Hero character and drag logic removed; input is now by clicking digit cubes
// Drag-and-drop logic removed; digit cubes are now clickable for input
// --- Start Game ---
startNewQuestion();
// --- Hard Mode Digit Cube Movement: Always enabled, slower movement ---
var hardModeMoveTimer = null;
function updateHardModeMovement() {
// Movement speed: slow at start, fast at end
// At 60s: 1200ms, at 0s: 350ms
var minDuration = 350;
var maxDuration = 1200;
var t = Math.max(0, Math.min(1, timeLeft / 60)); // 1 at start, 0 at end
var moveDuration = Math.round(minDuration + (maxDuration - minDuration) * t);
for (var i = 0; i < digitCubes.length; i++) {
// Only move visible cubes
if (!digitCubes[i].visible) continue;
// Randomly move within a region at the bottom of the screen
var minX = 100;
var maxX = 2048 - 100;
var minY = 2200;
var maxY = 2600;
// Animate to new random position
var targetX = randomInt(minX, maxX);
var targetY = randomInt(minY, maxY);
tween(digitCubes[i], {
x: targetX,
y: targetY
}, {
duration: moveDuration,
easing: tween.quadraticInOut
});
}
}
// Set up interval for hard mode movement (interval will be dynamically updated)
var hardModeMoveTimer = null;
function scheduleHardModeMove() {
// Movement speed: slow at start, fast at end
var minInterval = 350;
var maxInterval = 1200;
var t = Math.max(0, Math.min(1, timeLeft / 60));
var moveInterval = Math.round(minInterval + (maxInterval - minInterval) * t);
if (hardModeMoveTimer) LK.clearTimeout(hardModeMoveTimer);
updateHardModeMovement();
hardModeMoveTimer = LK.setTimeout(scheduleHardModeMove, moveInterval);
}
scheduleHardModeMove();
// When starting a new question, do not reset cube positions (always hard mode)
var _origStartNewQuestion = startNewQuestion;
startNewQuestion = function startNewQuestion() {
_origStartNewQuestion();
}; ===================================================================
--- original.js
+++ change.js
@@ -341,8 +341,14 @@
startNewQuestion();
// --- Hard Mode Digit Cube Movement: Always enabled, slower movement ---
var hardModeMoveTimer = null;
function updateHardModeMovement() {
+ // Movement speed: slow at start, fast at end
+ // At 60s: 1200ms, at 0s: 350ms
+ var minDuration = 350;
+ var maxDuration = 1200;
+ var t = Math.max(0, Math.min(1, timeLeft / 60)); // 1 at start, 0 at end
+ var moveDuration = Math.round(minDuration + (maxDuration - minDuration) * t);
for (var i = 0; i < digitCubes.length; i++) {
// Only move visible cubes
if (!digitCubes[i].visible) continue;
// Randomly move within a region at the bottom of the screen
@@ -356,17 +362,26 @@
tween(digitCubes[i], {
x: targetX,
y: targetY
}, {
- duration: 1200,
+ duration: moveDuration,
easing: tween.quadraticInOut
});
}
}
-// Set up interval for hard mode movement (slower)
-hardModeMoveTimer = LK.setInterval(function () {
+// Set up interval for hard mode movement (interval will be dynamically updated)
+var hardModeMoveTimer = null;
+function scheduleHardModeMove() {
+ // Movement speed: slow at start, fast at end
+ var minInterval = 350;
+ var maxInterval = 1200;
+ var t = Math.max(0, Math.min(1, timeLeft / 60));
+ var moveInterval = Math.round(minInterval + (maxInterval - minInterval) * t);
+ if (hardModeMoveTimer) LK.clearTimeout(hardModeMoveTimer);
updateHardModeMovement();
-}, 1200);
+ hardModeMoveTimer = LK.setTimeout(scheduleHardModeMove, moveInterval);
+}
+scheduleHardModeMove();
// When starting a new question, do not reset cube positions (always hard mode)
var _origStartNewQuestion = startNewQuestion;
startNewQuestion = function startNewQuestion() {
_origStartNewQuestion();
sky. In-Game asset. 2d. High contrast. No shadows
cloud. In-Game asset. 2d. High contrast. No shadows
grey cloud. In-Game asset. 2d. High contrast. No shadows
angry bird. In-Game asset. 2d. High contrast. No shadows
yellow angry bird. In-Game asset. 2d. High contrast. No shadows
golden snitch. In-Game asset. 2d. High contrast. No shadows
trashcan. In-Game asset. 2d. High contrast. No shadows
Rocketship. In-Game asset. 2d. High contrast. No shadows
A sign with oval corners. Light blue. In-Game asset. 2d. High contrast. No shadows