User prompt
ellerin içindeki score kısım ne kadar para toplarsak toplayalım boyutu aynı kalsın sağa veya sola score taşmasın
User prompt
score yazan kısım 3cm boyutla ellerin içinde olsun eller maus ile hareket ederken onlarda gittiği tarafa hareket etsin
User prompt
score yazan kısım 5 cm boyutla ellerin içinde olsun
User prompt
10/10 olan kısmı kaldırıp score kısmını ellerin üzerine alır mısın
User prompt
scor kısmı 10 cm boyutla 10/10 olan yere yazar mısın
User prompt
score kısmı elin içine 30 cm yazı boyutuyla yazar mısın
User prompt
aşağıdaki ellerin içinde 10 /10 yazsın her kaçırmada bir tane azalsın
User prompt
tekrar dene butonu 30 cm ve skor kısmınıda 30 cm oyun sonu gösterir misin
User prompt
oyun bitince skor ortada yazsın ve game play butonu olsun
User prompt
düşen para boyutu 15 cm olsun yazı boyutu 15 cm olsun
User prompt
alttaki yakalayan ellerin boyutu 15 cm olsun yazı boyutuda 15 cm olsun , 10 tane düşen para kaçırınca oyun bitsin
User prompt
düşen para birimlerinin boyutunu 20 cm yap yazı boyutunuda 20 cm yap
User prompt
para birimlerini yukardan düşsün ancak yavaş bir biçimde başlasın kademeli olarak hızlansın alttaki hesaplama da yakaladıkça artsın 10 kaçırmaya ise oyun bitsin , para birimleri yukardan tekrarlanarak farklı bir biçimde geometrik olarak düşsün , bunları aşağıda 10cmlik 2 el yakalasın ve bu yakalama sadece maus ile olsun maus olmayanlar için ise yön tuşları ile kontrol için sağ üstte seçenek olsun , her yakalamadan sonra da para sesi gelsin , ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
boyutlarını telefon ekranına sığacak kadar büyütür müsün , yazı boyutları ise 14 olsun
User prompt
buna 200 tl türkiye için ekler misin ve güncel kuru 47 tl yap , euro için de 500 euro 1000 euro ekle , centlerini de ekle ve türk lirası için 1 kurus , 5 kurus , 10 kurus , 25kurus 50 kurus , 1 lira ekle ,
Code edit (1 edits merged)
Please save this source code
User prompt
TL vs Euro: Currency Power Game
Initial prompt
İyi günler şimdi senden Türkiyede yer alan para birimlerini bozuk paralar dahil güncel kur üzerinden almanyanın kullandığı para birimi ile ilgili eşleştirmesini ve alım gücünü gösteren bir uygulama istiyorum . Bu uygulamada para birimleri eşleştirilsin ve en sonunda paranın alım gücünü belirlemek için alt tarafta bir hesaplama yeri olsun ve tl ile euro birimleri birbirlerine dönüştürebilsin . En son oyun biterken iki taraftan hangisi yüksekse kâr veya zarar diye seçenek olsun ve Kâr olunca yeşil ekran zarar olunca kırmızı ekran , Yeşil ekran sesi ve kırmızı ekran sesi birbirinden farklı olsun
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Calculator = Container.expand(function () { var self = Container.call(this); self.displayValue = "0"; self.operation = null; self.operand = null; self.waitingForOperand = false; var bg = self.attachAsset('calculatorBg', { anchorX: 0.5, anchorY: 0.5 }); var display = self.attachAsset('calcDisplay', { anchorX: 0.5, anchorY: 0.5, y: -135 }); self.displayText = new Text2(self.displayValue, { size: 14, fill: 0x00FF00 }); self.displayText.anchor.set(1, 0.5); self.displayText.x = 255; self.displayText.y = -135; self.addChild(self.displayText); var buttons = [['C', 'TL→€', '€→TL', '='], ['7', '8', '9', '/'], ['4', '5', '6', '*'], ['1', '2', '3', '-'], ['0', '.', '+', 'OK']]; self.buttons = []; for (var row = 0; row < buttons.length; row++) { for (var col = 0; col < buttons[row].length; col++) { var button = self.createButton(buttons[row][col], col, row); self.addChild(button); self.buttons.push(button); } } self.createButton = function (text, col, row) { var button = new Container(); var bg = LK.getAsset('calcButton', { anchorX: 0.5, anchorY: 0.5 }); button.addChild(bg); var label = new Text2(text, { size: 14, fill: 0xFFFFFF }); label.anchor.set(0.5, 0.5); button.addChild(label); button.x = (col - 1.5) * 135; button.y = (row - 1) * 105 - 30; button.buttonText = text; button.down = function (x, y, obj) { calculator.handleButtonPress(obj.buttonText); }; return button; }; self.handleButtonPress = function (buttonText) { LK.getSound('click').play(); if (buttonText === 'C') { self.clear(); } else if (buttonText === 'OK') { gamePhase = 'assessment'; showAssessment(); } else if (buttonText === 'TL→€') { var tlAmount = parseFloat(self.displayValue); var euroAmount = convertCurrency(tlAmount, 'tl', 'euro'); self.displayValue = euroAmount.toFixed(2); self.updateDisplay(); } else if (buttonText === '€→TL') { var euroAmount = parseFloat(self.displayValue); var tlAmount = convertCurrency(euroAmount, 'euro', 'tl'); self.displayValue = tlAmount.toFixed(2); self.updateDisplay(); } else if (['+', '-', '*', '/', '='].indexOf(buttonText) !== -1) { self.handleOperator(buttonText); } else { self.handleNumber(buttonText); } }; self.handleNumber = function (num) { if (self.waitingForOperand) { self.displayValue = num; self.waitingForOperand = false; } else { self.displayValue = self.displayValue === '0' ? num : self.displayValue + num; } self.updateDisplay(); }; self.handleOperator = function (nextOperator) { var inputValue = parseFloat(self.displayValue); if (self.operand === null) { self.operand = inputValue; } else if (self.operation) { var currentValue = self.operand || 0; var newValue = self.calculate(currentValue, inputValue, self.operation); self.displayValue = String(newValue); self.operand = newValue; self.updateDisplay(); } self.waitingForOperand = true; self.operation = nextOperator === '=' ? null : nextOperator; }; self.calculate = function (firstOperand, secondOperand, operation) { switch (operation) { case '+': return firstOperand + secondOperand; case '-': return firstOperand - secondOperand; case '*': return firstOperand * secondOperand; case '/': return firstOperand / secondOperand; default: return secondOperand; } }; self.clear = function () { self.displayValue = "0"; self.operation = null; self.operand = null; self.waitingForOperand = false; self.updateDisplay(); }; self.updateDisplay = function () { self.displayText.setText(self.displayValue); }; return self; }); var CurrencyItem = Container.expand(function (type, value, currency) { var self = Container.call(this); self.itemType = type; self.value = value; self.currency = currency; self.isDragging = false; self.originalX = 0; self.originalY = 0; var assetId = currency + type + value; var graphics = self.attachAsset(assetId, { anchorX: 0.5, anchorY: 0.5 }); var label = new Text2(value + ' ' + currency.toUpperCase(), { size: 14, fill: 0xFFFFFF }); label.anchor.set(0.5, 0.5); self.addChild(label); self.down = function (x, y, obj) { self.isDragging = true; self.originalX = self.x; self.originalY = self.y; self.alpha = 0.8; LK.getSound('click').play(); }; self.up = function (x, y, obj) { self.isDragging = false; self.alpha = 1.0; var matched = false; for (var i = 0; i < dropZones.length; i++) { if (self.intersects(dropZones[i]) && !dropZones[i].occupied) { var expectedValue = convertCurrency(self.value, self.currency, dropZones[i].targetCurrency); if (Math.abs(expectedValue - dropZones[i].targetValue) < 0.1) { self.x = dropZones[i].x; self.y = dropZones[i].y; dropZones[i].occupied = true; dropZones[i].occupiedBy = self; matched = true; matchedPairs++; LK.getSound('match').play(); LK.setScore(LK.getScore() + 10); scoreText.setText('Score: ' + LK.getScore()); if (matchedPairs >= totalPairs) { gamePhase = 'calculator'; showCalculator(); } break; } } } if (!matched) { tween(self, { x: self.originalX, y: self.originalY }, { duration: 300 }); } }; return self; }); var DropZone = Container.expand(function (targetValue, targetCurrency) { var self = Container.call(this); self.targetValue = targetValue; self.targetCurrency = targetCurrency; self.occupied = false; self.occupiedBy = null; var bg = self.attachAsset('dropZone', { anchorX: 0.5, anchorY: 0.5 }); bg.alpha = 0.3; var label = new Text2(targetValue.toFixed(2) + ' ' + targetCurrency.toUpperCase(), { size: 14, fill: 0xFFFFFF }); label.anchor.set(0.5, 0.5); self.addChild(label); return self; }); var FallingCurrency = Container.expand(function (type, value, currency) { var self = Container.call(this); self.itemType = type; self.value = value; self.currency = currency; self.speed = 2; // Start slow self.lastY = 0; var assetId = currency + type + value; var graphics = self.attachAsset(assetId, { anchorX: 0.5, anchorY: 0.5 }); var label = new Text2(value + ' ' + currency.toUpperCase(), { size: 14, fill: 0xFFFFFF }); label.anchor.set(0.5, 0.5); self.addChild(label); self.update = function () { self.lastY = self.y; self.y += self.speed; // Gradually increase speed if (LK.ticks % 300 === 0) { self.speed += 0.5; } }; return self; }); var Hand = Container.expand(function (side) { var self = Container.call(this); self.side = side; var graphics = self.attachAsset(side + 'Hand', { anchorX: 0.5, anchorY: 0.5 }); var label = new Text2(side.toUpperCase(), { size: 14, fill: 0x000000 }); label.anchor.set(0.5, 0.5); self.addChild(label); return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a1a2e }); /**** * Game Code ****/ var exchangeRate = 47; // TL per Euro var gamePhase = 'falling'; // 'falling', 'calculator', 'assessment' var caughtItems = 0; var missedItems = 0; var maxMissed = 10; var fallingItems = []; var leftHand, rightHand; var useMouseControl = true; var spawnTimer = 0; var spawnRate = 60; // frames between spawns var controlsContainer; var scoreText = new Text2('Score: 0', { size: 14, fill: 0xFFFFFF }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); var phaseText = new Text2('Catch falling currencies! Missed: 0/10', { size: 14, fill: 0xFFD700 }); phaseText.anchor.set(0.5, 0); phaseText.y = 50; LK.gui.top.addChild(phaseText); var exchangeRateText = new Text2('Exchange Rate: 1 EUR = ' + exchangeRate + ' TL', { size: 14, fill: 0x00FF00 }); exchangeRateText.anchor.set(0.5, 0); exchangeRateText.y = 80; LK.gui.top.addChild(exchangeRateText); function convertCurrency(amount, fromCurrency, toCurrency) { if (fromCurrency === 'tl' && toCurrency === 'euro') { return amount / exchangeRate; } else if (fromCurrency === 'euro' && toCurrency === 'tl') { return amount * exchangeRate; } return amount; } function setupFallingPhase() { // Create hands at bottom leftHand = new Hand('left'); leftHand.x = 400; leftHand.y = 2600; game.addChild(leftHand); rightHand = new Hand('right'); rightHand.x = 1648; rightHand.y = 2600; game.addChild(rightHand); // Create control interface setupControls(); } function setupControls() { controlsContainer = new Container(); controlsContainer.x = 1848; controlsContainer.y = 100; LK.gui.addChild(controlsContainer); var controlBg = LK.getAsset('controlButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 1.5 }); controlsContainer.addChild(controlBg); var controlText = new Text2('Controls', { size: 12, fill: 0xFFFFFF }); controlText.anchor.set(0.5, 0.5); controlText.y = -30; controlsContainer.addChild(controlText); var mouseText = new Text2('Mouse: ON', { size: 10, fill: 0x00FF00 }); mouseText.anchor.set(0.5, 0.5); controlsContainer.addChild(mouseText); var keyText = new Text2('Keys: OFF', { size: 10, fill: 0xFF0000 }); keyText.anchor.set(0.5, 0.5); keyText.y = 20; controlsContainer.addChild(keyText); controlsContainer.mouseText = mouseText; controlsContainer.keyText = keyText; controlsContainer.down = function () { useMouseControl = !useMouseControl; if (useMouseControl) { controlsContainer.mouseText.setText('Mouse: ON'); controlsContainer.mouseText.style.fill = 0x00FF00; controlsContainer.keyText.setText('Keys: OFF'); controlsContainer.keyText.style.fill = 0xFF0000; } else { controlsContainer.mouseText.setText('Mouse: OFF'); controlsContainer.mouseText.style.fill = 0xFF0000; controlsContainer.keyText.setText('Keys: ON'); controlsContainer.keyText.style.fill = 0x00FF00; } }; } function spawnCurrency() { var allCurrencies = [{ type: 'Coin1kurus', value: 0.01, currency: 'tl' }, { type: 'Coin5kurus', value: 0.05, currency: 'tl' }, { type: 'Coin10kurus', value: 0.10, currency: 'tl' }, { type: 'Coin25kurus', value: 0.25, currency: 'tl' }, { type: 'Coin50kurus', value: 0.50, currency: 'tl' }, { type: 'Coin', value: 1, currency: 'tl' }, { type: 'Note', value: 20, currency: 'tl' }, { type: 'Note', value: 50, currency: 'tl' }, { type: 'Note', value: 100, currency: 'tl' }, { type: 'Note', value: 200, currency: 'tl' }, { type: 'Coin1cent', value: 0.01, currency: 'euro' }, { type: 'Coin2cent', value: 0.02, currency: 'euro' }, { type: 'Coin5cent', value: 0.05, currency: 'euro' }, { type: 'Coin10cent', value: 0.10, currency: 'euro' }, { type: 'Coin20cent', value: 0.20, currency: 'euro' }, { type: 'Coin50cent', value: 0.50, currency: 'euro' }, { type: 'Coin', value: 1, currency: 'euro' }, { type: 'Coin', value: 2, currency: 'euro' }, { type: 'Note', value: 5, currency: 'euro' }, { type: 'Note', value: 10, currency: 'euro' }, { type: 'Note', value: 500, currency: 'euro' }, { type: 'Note', value: 1000, currency: 'euro' }]; var randomCurrency = allCurrencies[Math.floor(Math.random() * allCurrencies.length)]; var fallingItem = new FallingCurrency(randomCurrency.type, randomCurrency.value, randomCurrency.currency); fallingItem.x = Math.random() * 1800 + 124; // Random X within screen bounds fallingItem.y = -100; fallingItem.lastY = fallingItem.y; fallingItem.lastCaught = false; fallingItems.push(fallingItem); game.addChild(fallingItem); } function showCalculator() { phaseText.setText('Use calculator to convert currencies'); // Clear falling items for (var i = 0; i < fallingItems.length; i++) { fallingItems[i].destroy(); } fallingItems = []; // Clear hands if (leftHand) leftHand.destroy(); if (rightHand) rightHand.destroy(); if (controlsContainer) controlsContainer.destroy(); calculator = new Calculator(); calculator.x = 1024; calculator.y = 1400; game.addChild(calculator); } function showAssessment() { phaseText.setText('Assessment Complete!'); // Clear all falling items for (var i = 0; i < fallingItems.length; i++) { fallingItems[i].destroy(); } fallingItems = []; // Clear hands and controls if (leftHand) leftHand.destroy(); if (rightHand) rightHand.destroy(); if (controlsContainer) controlsContainer.destroy(); if (calculator) { calculator.destroy(); } var finalScore = LK.getScore(); var isProfit = finalScore >= 50; if (isProfit) { game.setBackgroundColor(0x006400); LK.effects.flashScreen(0x00FF00, 1500); LK.getSound('success').play(); var successText = new Text2('PROFIT! Well done!', { size: 14, fill: 0xFFFFFF }); successText.anchor.set(0.5, 0.5); successText.x = 1024; successText.y = 1200; game.addChild(successText); } else { game.setBackgroundColor(0x8B0000); LK.effects.flashScreen(0xFF0000, 1500); LK.getSound('warning').play(); var lossText = new Text2('LOSS! Try again!', { size: 14, fill: 0xFFFFFF }); lossText.anchor.set(0.5, 0.5); lossText.x = 1024; lossText.y = 1200; game.addChild(lossText); } LK.setTimeout(function () { if (isProfit) { LK.showYouWin(); } else { LK.showGameOver(); } }, 3000); } game.move = function (x, y, obj) { if (gamePhase === 'falling' && useMouseControl) { // Move hands based on mouse position if (x < 1024) { leftHand.x = x; } else { rightHand.x = x; } } }; game.update = function () { if (gamePhase === 'falling') { // Handle keyboard controls if (!useMouseControl) { // Simple keyboard simulation using ticks if (LK.ticks % 3 === 0) { leftHand.x = Math.max(100, leftHand.x - 5); } if (LK.ticks % 4 === 0) { leftHand.x = Math.min(1024, leftHand.x + 5); } if (LK.ticks % 5 === 0) { rightHand.x = Math.max(1024, rightHand.x - 5); } if (LK.ticks % 6 === 0) { rightHand.x = Math.min(1948, rightHand.x + 5); } } // Spawn currency spawnTimer++; if (spawnTimer >= spawnRate) { spawnCurrency(); spawnTimer = 0; // Gradually increase spawn rate if (spawnRate > 20) { spawnRate--; } } // Update falling items for (var i = fallingItems.length - 1; i >= 0; i--) { var item = fallingItems[i]; // Check if caught by hands var currentCaught = item.intersects(leftHand) || item.intersects(rightHand); if (!item.lastCaught && currentCaught) { // Just caught caughtItems++; LK.setScore(LK.getScore() + Math.floor(item.value * 10)); scoreText.setText('Score: ' + LK.getScore()); LK.getSound('money').play(); item.destroy(); fallingItems.splice(i, 1); continue; } item.lastCaught = currentCaught; // Check if item fell off screen if (item.lastY <= 2732 && item.y > 2732) { missedItems++; phaseText.setText('Catch falling currencies! Missed: ' + missedItems + '/' + maxMissed); item.destroy(); fallingItems.splice(i, 1); if (missedItems >= maxMissed) { gamePhase = 'calculator'; showCalculator(); } continue; } item.lastY = item.y; } } }; setupFallingPhase();
===================================================================
--- original.js
+++ change.js
@@ -211,8 +211,51 @@
label.anchor.set(0.5, 0.5);
self.addChild(label);
return self;
});
+var FallingCurrency = Container.expand(function (type, value, currency) {
+ var self = Container.call(this);
+ self.itemType = type;
+ self.value = value;
+ self.currency = currency;
+ self.speed = 2; // Start slow
+ self.lastY = 0;
+ var assetId = currency + type + value;
+ var graphics = self.attachAsset(assetId, {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var label = new Text2(value + ' ' + currency.toUpperCase(), {
+ size: 14,
+ fill: 0xFFFFFF
+ });
+ label.anchor.set(0.5, 0.5);
+ self.addChild(label);
+ self.update = function () {
+ self.lastY = self.y;
+ self.y += self.speed;
+ // Gradually increase speed
+ if (LK.ticks % 300 === 0) {
+ self.speed += 0.5;
+ }
+ };
+ return self;
+});
+var Hand = Container.expand(function (side) {
+ var self = Container.call(this);
+ self.side = side;
+ var graphics = self.attachAsset(side + 'Hand', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var label = new Text2(side.toUpperCase(), {
+ size: 14,
+ fill: 0x000000
+ });
+ label.anchor.set(0.5, 0.5);
+ self.addChild(label);
+ return self;
+});
/****
* Initialize Game
****/
@@ -223,21 +266,25 @@
/****
* Game Code
****/
var exchangeRate = 47; // TL per Euro
-var gamePhase = 'matching'; // 'matching', 'calculator', 'assessment'
-var matchedPairs = 0;
-var totalPairs = 6;
-var currencyItems = [];
-var dropZones = [];
-var calculator;
+var gamePhase = 'falling'; // 'falling', 'calculator', 'assessment'
+var caughtItems = 0;
+var missedItems = 0;
+var maxMissed = 10;
+var fallingItems = [];
+var leftHand, rightHand;
+var useMouseControl = true;
+var spawnTimer = 0;
+var spawnRate = 60; // frames between spawns
+var controlsContainer;
var scoreText = new Text2('Score: 0', {
size: 14,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
-var phaseText = new Text2('Match Turkish Lira with Euro equivalents', {
+var phaseText = new Text2('Catch falling currencies! Missed: 0/10', {
size: 14,
fill: 0xFFD700
});
phaseText.anchor.set(0.5, 0);
@@ -257,83 +304,196 @@
return amount * exchangeRate;
}
return amount;
}
-function setupMatchingPhase() {
- var tlValues = [0.01, 0.05, 0.10, 0.25, 0.50, 1, 5, 10, 20, 50, 100, 200];
- var tlTypes = ['Coin1kurus', 'Coin5kurus', 'Coin10kurus', 'Coin25kurus', 'Coin50kurus', 'Coin', 'Coin', 'Coin', 'Note', 'Note', 'Note', 'Note'];
- var euroValues = [0.01, 0.02, 0.05, 0.10, 0.20, 0.50, 1, 2, 5, 10, 20, 500, 1000];
- var euroTypes = ['Coin1cent', 'Coin2cent', 'Coin5cent', 'Coin10cent', 'Coin20cent', 'Coin50cent', 'Coin', 'Coin', 'Coin', 'Note', 'Note', 'Note', 'Note'];
- // Create TL items
- for (var i = 0; i < tlValues.length; i++) {
- var tlItem = new CurrencyItem(tlTypes[i], tlValues[i], 'tl');
- tlItem.x = 150 + i % 4 * 180;
- tlItem.y = 250 + Math.floor(i / 4) * 120;
- currencyItems.push(tlItem);
- game.addChild(tlItem);
- }
- // Create Euro items
- for (var i = 0; i < euroValues.length; i++) {
- var euroItem = new CurrencyItem(euroTypes[i], euroValues[i], 'euro');
- euroItem.x = 1200 + i % 4 * 180;
- euroItem.y = 250 + Math.floor(i / 4) * 120;
- currencyItems.push(euroItem);
- game.addChild(euroItem);
- }
- // Create drop zones for matching
- var matchingPairs = [{
- tl: 47,
- euro: 1
- },
- // 47 TL = 1 Euro
- {
- tl: 23.5,
- euro: 0.5
- },
- // 23.5 TL = 0.5 Euro
- {
- tl: 9.4,
- euro: 0.2
- },
- // 9.4 TL = 0.2 Euro
- {
- tl: 4.7,
- euro: 0.1
- },
- // 4.7 TL = 0.1 Euro
- {
- tl: 2.35,
- euro: 0.05
- },
- // 2.35 TL = 0.05 Euro
- {
- tl: 0.94,
- euro: 0.02
- } // 0.94 TL = 0.02 Euro
- ];
- for (var i = 0; i < matchingPairs.length; i++) {
- var dropZone = new DropZone(matchingPairs[i].euro, 'euro');
- dropZone.x = 1024 + i % 3 * 200;
- dropZone.y = 1800 + Math.floor(i / 3) * 150;
- dropZones.push(dropZone);
- game.addChild(dropZone);
- }
+function setupFallingPhase() {
+ // Create hands at bottom
+ leftHand = new Hand('left');
+ leftHand.x = 400;
+ leftHand.y = 2600;
+ game.addChild(leftHand);
+ rightHand = new Hand('right');
+ rightHand.x = 1648;
+ rightHand.y = 2600;
+ game.addChild(rightHand);
+ // Create control interface
+ setupControls();
}
+function setupControls() {
+ controlsContainer = new Container();
+ controlsContainer.x = 1848;
+ controlsContainer.y = 100;
+ LK.gui.addChild(controlsContainer);
+ var controlBg = LK.getAsset('controlButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 2,
+ scaleY: 1.5
+ });
+ controlsContainer.addChild(controlBg);
+ var controlText = new Text2('Controls', {
+ size: 12,
+ fill: 0xFFFFFF
+ });
+ controlText.anchor.set(0.5, 0.5);
+ controlText.y = -30;
+ controlsContainer.addChild(controlText);
+ var mouseText = new Text2('Mouse: ON', {
+ size: 10,
+ fill: 0x00FF00
+ });
+ mouseText.anchor.set(0.5, 0.5);
+ controlsContainer.addChild(mouseText);
+ var keyText = new Text2('Keys: OFF', {
+ size: 10,
+ fill: 0xFF0000
+ });
+ keyText.anchor.set(0.5, 0.5);
+ keyText.y = 20;
+ controlsContainer.addChild(keyText);
+ controlsContainer.mouseText = mouseText;
+ controlsContainer.keyText = keyText;
+ controlsContainer.down = function () {
+ useMouseControl = !useMouseControl;
+ if (useMouseControl) {
+ controlsContainer.mouseText.setText('Mouse: ON');
+ controlsContainer.mouseText.style.fill = 0x00FF00;
+ controlsContainer.keyText.setText('Keys: OFF');
+ controlsContainer.keyText.style.fill = 0xFF0000;
+ } else {
+ controlsContainer.mouseText.setText('Mouse: OFF');
+ controlsContainer.mouseText.style.fill = 0xFF0000;
+ controlsContainer.keyText.setText('Keys: ON');
+ controlsContainer.keyText.style.fill = 0x00FF00;
+ }
+ };
+}
+function spawnCurrency() {
+ var allCurrencies = [{
+ type: 'Coin1kurus',
+ value: 0.01,
+ currency: 'tl'
+ }, {
+ type: 'Coin5kurus',
+ value: 0.05,
+ currency: 'tl'
+ }, {
+ type: 'Coin10kurus',
+ value: 0.10,
+ currency: 'tl'
+ }, {
+ type: 'Coin25kurus',
+ value: 0.25,
+ currency: 'tl'
+ }, {
+ type: 'Coin50kurus',
+ value: 0.50,
+ currency: 'tl'
+ }, {
+ type: 'Coin',
+ value: 1,
+ currency: 'tl'
+ }, {
+ type: 'Note',
+ value: 20,
+ currency: 'tl'
+ }, {
+ type: 'Note',
+ value: 50,
+ currency: 'tl'
+ }, {
+ type: 'Note',
+ value: 100,
+ currency: 'tl'
+ }, {
+ type: 'Note',
+ value: 200,
+ currency: 'tl'
+ }, {
+ type: 'Coin1cent',
+ value: 0.01,
+ currency: 'euro'
+ }, {
+ type: 'Coin2cent',
+ value: 0.02,
+ currency: 'euro'
+ }, {
+ type: 'Coin5cent',
+ value: 0.05,
+ currency: 'euro'
+ }, {
+ type: 'Coin10cent',
+ value: 0.10,
+ currency: 'euro'
+ }, {
+ type: 'Coin20cent',
+ value: 0.20,
+ currency: 'euro'
+ }, {
+ type: 'Coin50cent',
+ value: 0.50,
+ currency: 'euro'
+ }, {
+ type: 'Coin',
+ value: 1,
+ currency: 'euro'
+ }, {
+ type: 'Coin',
+ value: 2,
+ currency: 'euro'
+ }, {
+ type: 'Note',
+ value: 5,
+ currency: 'euro'
+ }, {
+ type: 'Note',
+ value: 10,
+ currency: 'euro'
+ }, {
+ type: 'Note',
+ value: 500,
+ currency: 'euro'
+ }, {
+ type: 'Note',
+ value: 1000,
+ currency: 'euro'
+ }];
+ var randomCurrency = allCurrencies[Math.floor(Math.random() * allCurrencies.length)];
+ var fallingItem = new FallingCurrency(randomCurrency.type, randomCurrency.value, randomCurrency.currency);
+ fallingItem.x = Math.random() * 1800 + 124; // Random X within screen bounds
+ fallingItem.y = -100;
+ fallingItem.lastY = fallingItem.y;
+ fallingItem.lastCaught = false;
+ fallingItems.push(fallingItem);
+ game.addChild(fallingItem);
+}
function showCalculator() {
phaseText.setText('Use calculator to convert currencies');
+ // Clear falling items
+ for (var i = 0; i < fallingItems.length; i++) {
+ fallingItems[i].destroy();
+ }
+ fallingItems = [];
+ // Clear hands
+ if (leftHand) leftHand.destroy();
+ if (rightHand) rightHand.destroy();
+ if (controlsContainer) controlsContainer.destroy();
calculator = new Calculator();
calculator.x = 1024;
- calculator.y = 2200;
+ calculator.y = 1400;
game.addChild(calculator);
}
function showAssessment() {
phaseText.setText('Assessment Complete!');
- for (var i = 0; i < currencyItems.length; i++) {
- currencyItems[i].destroy();
+ // Clear all falling items
+ for (var i = 0; i < fallingItems.length; i++) {
+ fallingItems[i].destroy();
}
- for (var i = 0; i < dropZones.length; i++) {
- dropZones[i].destroy();
- }
+ fallingItems = [];
+ // Clear hands and controls
+ if (leftHand) leftHand.destroy();
+ if (rightHand) rightHand.destroy();
+ if (controlsContainer) controlsContainer.destroy();
if (calculator) {
calculator.destroy();
}
var finalScore = LK.getScore();
@@ -371,15 +531,74 @@
}
}, 3000);
}
game.move = function (x, y, obj) {
- if (gamePhase === 'matching') {
- for (var i = 0; i < currencyItems.length; i++) {
- if (currencyItems[i].isDragging) {
- currencyItems[i].x = x;
- currencyItems[i].y = y;
- break;
+ if (gamePhase === 'falling' && useMouseControl) {
+ // Move hands based on mouse position
+ if (x < 1024) {
+ leftHand.x = x;
+ } else {
+ rightHand.x = x;
+ }
+ }
+};
+game.update = function () {
+ if (gamePhase === 'falling') {
+ // Handle keyboard controls
+ if (!useMouseControl) {
+ // Simple keyboard simulation using ticks
+ if (LK.ticks % 3 === 0) {
+ leftHand.x = Math.max(100, leftHand.x - 5);
}
+ if (LK.ticks % 4 === 0) {
+ leftHand.x = Math.min(1024, leftHand.x + 5);
+ }
+ if (LK.ticks % 5 === 0) {
+ rightHand.x = Math.max(1024, rightHand.x - 5);
+ }
+ if (LK.ticks % 6 === 0) {
+ rightHand.x = Math.min(1948, rightHand.x + 5);
+ }
}
+ // Spawn currency
+ spawnTimer++;
+ if (spawnTimer >= spawnRate) {
+ spawnCurrency();
+ spawnTimer = 0;
+ // Gradually increase spawn rate
+ if (spawnRate > 20) {
+ spawnRate--;
+ }
+ }
+ // Update falling items
+ for (var i = fallingItems.length - 1; i >= 0; i--) {
+ var item = fallingItems[i];
+ // Check if caught by hands
+ var currentCaught = item.intersects(leftHand) || item.intersects(rightHand);
+ if (!item.lastCaught && currentCaught) {
+ // Just caught
+ caughtItems++;
+ LK.setScore(LK.getScore() + Math.floor(item.value * 10));
+ scoreText.setText('Score: ' + LK.getScore());
+ LK.getSound('money').play();
+ item.destroy();
+ fallingItems.splice(i, 1);
+ continue;
+ }
+ item.lastCaught = currentCaught;
+ // Check if item fell off screen
+ if (item.lastY <= 2732 && item.y > 2732) {
+ missedItems++;
+ phaseText.setText('Catch falling currencies! Missed: ' + missedItems + '/' + maxMissed);
+ item.destroy();
+ fallingItems.splice(i, 1);
+ if (missedItems >= maxMissed) {
+ gamePhase = 'calculator';
+ showCalculator();
+ }
+ continue;
+ }
+ item.lastY = item.y;
+ }
}
};
-setupMatchingPhase();
\ No newline at end of file
+setupFallingPhase();
\ No newline at end of file