User prompt
Şimdi oyunda pişirme gibi mantıklar olsun hatta bizden bazen bu eşyaları kullanarak içecek vb. Yapmamızı istesin
User prompt
Neredeyse dogru ama herşey arkasında kalacak
User prompt
Hayır şöyle olsun bir buton olsun o butona basınca bize ekranı kaplayan ve tamamen arkasını göstermeyen bir yer açsın orada twrifler yazsın çıkmak için bi buton daha olsun ve oraya tıklayınca geri dönelim
User prompt
Er buton yok
User prompt
Bence şöyle yap tarif kitabını bir tuş olarak yap oraya tıkladığında bütün ekranı kaplayan ve arkasını göstermeyen bir yer olacak oraya tarifleri ekle
User prompt
Biraz daha ekranın içine sığdır malzemeleri
User prompt
Biraz daha yuvarlağı büyüt ve içine daha iyi sığdır
User prompt
Daha fazla malzeme ve daha fazla yemek
User prompt
Ama tarifler yuvarlağını büyüt ve daha iyi içine sok
User prompt
Biraz daha yemek ekleyelim
User prompt
Yani salata , burger gibi tarifler orda açık şekilde yazacak
User prompt
Ama açılmıyor
User prompt
Biraz daha üste koy
User prompt
Hayır tarif kitabı tamda malzemelerin üst kısmında olsun
User prompt
Ve bir tane tarif kitabı gibi bişey koy ayrıca süre 30 saniye olsun
User prompt
Hayır sipariş söyleme yerini costumer in altında olan teslim et butonunun altına koy
User prompt
Teslim et butonu aynı yerinde olsun siparişi bize söyleme yeri costumer in altında olsun
User prompt
Ve ayrıca sipariş butonunu costumer in altına koy
User prompt
Burger murger diyo ama yapmak için bize malzeme verilmemiş
User prompt
Ve bide zamanlayıcı ile başka bi yazı üst üste geliyor
User prompt
Eşyaların adı yazmıyor
User prompt
Bana bu oyunu mobile de oynanabilir yap
User prompt
Kodu yeniden yazar mısın çıktım da kodu yeniden gaz
User prompt
Order Up! Chef Rush
Initial prompt
Yemek yapma oyunu sipariş veren insanların siparişlerini yapacağız vb.
/**** * Classes ****/ // --- Müşteri sınıfı --- var Customer = Container.expand(function () { var self = Container.call(this); var asset = self.attachAsset('customer', { anchorX: 0.5, anchorY: 0.5, width: 300, height: 300, color: 0xcccccc }); return self; }); // --- Sipariş oluşturma ve gösterme --- // --- Malzeme butonu sınıfı --- var IngredientButton = Container.expand(function () { var self = Container.call(this); self.ingredientId = null; self.selected = false; self.setIngredient = function (ingredient) { self.ingredientId = ingredient.id; var asset = self.attachAsset('ingredient_' + ingredient.id, { anchorX: 0.5, anchorY: 0.5, width: 140, height: 70, color: ingredient.color }); // Malzeme adı etiketi ekle if (self.ingredientLabel) self.ingredientLabel.destroy(); self.ingredientLabel = new Text2(ingredient.name, { size: 38, fill: "#fff" }); self.ingredientLabel.anchor.set(0.5, 0); // Butonun altına yerleştir self.ingredientLabel.x = 0; self.ingredientLabel.y = asset.height / 2 + 10; self.addChild(self.ingredientLabel); }; self.down = function (x, y, obj) { if (!self.selected) { self.selected = true; selectedIngredients.push(self.ingredientId); self.alpha = 0.5; } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // --- Oyun için temel değişkenler ve sınıflar --- // Malzeme ve siparişler için örnek veri var INGREDIENTS = [{ id: 'lettuce', name: 'Marul', color: 0x7ed957 }, { id: 'tomato', name: 'Domates', color: 0xff4b4b }, { id: 'cheese', name: 'Peynir', color: 0xffe066 }, { id: 'meat', name: 'Et', color: 0x8b5c2a }, { id: 'onion', name: 'Soğan', color: 0xe0c97f }, { id: 'cucumber', name: 'Salatalık', color: 0x6ecb63 }, { id: 'egg', name: 'Yumurta', color: 0xf7e7b0 }, { id: 'chicken', name: 'Tavuk', color: 0xf5c16c }, { id: 'bread', name: 'Ekmek', color: 0xf5e6b2 }]; var RECIPES = [{ name: 'Burger', ingredients: ['lettuce', 'tomato', 'cheese', 'meat'], type: 'cook' }, { name: 'Salata', ingredients: ['lettuce', 'tomato', 'cheese'], type: 'normal' }, { name: 'Peynirli Sandviç', ingredients: ['cheese', 'lettuce', 'tomato', 'bread'], type: 'normal' }, { name: 'Etli Sandviç', ingredients: ['meat', 'cheese', 'lettuce', 'bread'], type: 'cook' }, { name: 'Domatesli Salata', ingredients: ['lettuce', 'tomato'], type: 'normal' }, { name: 'Tavuklu Salata', ingredients: ['lettuce', 'tomato', 'chicken', 'cucumber'], type: 'normal' }, { name: 'Yumurtalı Salata', ingredients: ['lettuce', 'egg', 'tomato', 'onion'], type: 'cook' }, { name: 'Tavuklu Sandviç', ingredients: ['chicken', 'cheese', 'lettuce', 'bread'], type: 'cook' }, { name: 'Sebzeli Sandviç', ingredients: ['lettuce', 'tomato', 'cucumber', 'bread'], type: 'normal' }, { name: 'Soğanlı Burger', ingredients: ['meat', 'cheese', 'onion', 'bread'], type: 'cook' }, // Drinks { name: 'Limonata', ingredients: ['lemon', 'water', 'sugar'], type: 'drink' }, { name: 'Soğuk Çay', ingredients: ['tea', 'water', 'sugar', 'lemon'], type: 'drink' }, { name: 'Ayran', ingredients: ['yogurt', 'water', 'salt'], type: 'drink' }]; // Ekstra içecek ve pişirme malzemeleri if (!INGREDIENTS.find(function (i) { return i.id === 'lemon'; })) INGREDIENTS.push({ id: 'lemon', name: 'Limon', color: 0xfff700 }); if (!INGREDIENTS.find(function (i) { return i.id === 'water'; })) INGREDIENTS.push({ id: 'water', name: 'Su', color: 0x8fd3f4 }); if (!INGREDIENTS.find(function (i) { return i.id === 'sugar'; })) INGREDIENTS.push({ id: 'sugar', name: 'Şeker', color: 0xffffff }); if (!INGREDIENTS.find(function (i) { return i.id === 'tea'; })) INGREDIENTS.push({ id: 'tea', name: 'Çay', color: 0x7b3f00 }); if (!INGREDIENTS.find(function (i) { return i.id === 'yogurt'; })) INGREDIENTS.push({ id: 'yogurt', name: 'Yoğurt', color: 0xfafafa }); if (!INGREDIENTS.find(function (i) { return i.id === 'salt'; })) INGREDIENTS.push({ id: 'salt', name: 'Tuz', color: 0xe0e0e0 }); var currentOrder = null; var selectedIngredients = []; var customer = null; var ingredientButtons = []; var score = 0; var orderTimer = null; var orderTimeLimit = 30000; // ms, 30 saniye var orderTimeLeft = orderTimeLimit; var orderText = null; var scoreText = null; var timerText = null; // --- Sipariş oluşturma ve gösterme --- function newOrder() { // Sipariş ve seçili malzemeleri sıfırla selectedIngredients = []; for (var i = 0; i < ingredientButtons.length; i++) { ingredientButtons[i].selected = false; ingredientButtons[i].alpha = 1; } // Rastgele sipariş seç currentOrder = RECIPES[Math.floor(Math.random() * RECIPES.length)]; if (orderText) orderText.destroy(); orderText = new Text2("Sipariş: " + currentOrder.name, { size: 90, fill: "#fff" }); orderText.anchor.set(0.5, 0); // orderText'i deliverBtn'in hemen altına yerleştir orderText.x = 2048 / 2; orderText.y = deliverBtn.y + deliverBtn.height / 2 + 30; game.addChild(orderText); // Sipariş türüne göre pişir ve içecek butonlarını göster/gizle if (typeof cookBtn !== "undefined" && cookBtn) cookBtn.visible = currentOrder.type === 'cook'; if (typeof drinkBtn !== "undefined" && drinkBtn) drinkBtn.visible = currentOrder.type === 'drink'; // Zamanı başlat orderTimeLeft = orderTimeLimit; if (timerText) timerText.destroy(); timerText = new Text2("Süre: " + Math.floor(orderTimeLeft / 1000), { size: 80, fill: "#fff" }); timerText.anchor.set(0.5, 0); // timerText'i orderText'in hemen altına yerleştir timerText.x = 2048 / 2; timerText.y = orderText.y + orderText.height + 10; game.addChild(timerText); // Müşteri oluştur if (customer) customer.destroy(); customer = new Customer(); customer.x = 2048 / 2; customer.y = 600; game.addChild(customer); // Zamanlayıcı başlat if (orderTimer) LK.clearInterval(orderTimer); orderTimer = LK.setInterval(function () { orderTimeLeft -= 100; if (timerText) timerText.setText("Süre: " + Math.ceil(orderTimeLeft / 1000)); if (orderTimeLeft <= 0) { LK.clearInterval(orderTimer); failOrder(); } }, 100); } // --- Pişir ve içecek hazırla butonları için global değişkenler --- window.cooked = false; window.drinkReady = false; // --- Cook button logic --- if (typeof cookBtn !== "undefined") { cookBtn.down = function (x, y, obj) { if (!currentOrder || currentOrder.type !== 'cook') return; if (selectedIngredients.length !== currentOrder.ingredients.length) { LK.effects.flashScreen(0xffa500, 400); return; } // Sıralı ve tam malzeme kontrolü var correct = true; for (var i = 0; i < currentOrder.ingredients.length; i++) { if (selectedIngredients[i] !== currentOrder.ingredients[i]) { correct = false; break; } } if (correct) { window.cooked = true; LK.effects.flashObject(cookBtn, 0x00ff00, 600); } else { LK.effects.flashObject(cookBtn, 0xff0000, 600); } }; } // --- Drink button logic --- if (typeof drinkBtn !== "undefined") { drinkBtn.down = function (x, y, obj) { if (!currentOrder || currentOrder.type !== 'drink') return; if (selectedIngredients.length !== currentOrder.ingredients.length) { LK.effects.flashScreen(0x8fd3f4, 400); return; } // Sıralı ve tam malzeme kontrolü var correct = true; for (var i = 0; i < currentOrder.ingredients.length; i++) { if (selectedIngredients[i] !== currentOrder.ingredients[i]) { correct = false; break; } } if (correct) { window.drinkReady = true; LK.effects.flashObject(drinkBtn, 0x00ff00, 600); } else { LK.effects.flashObject(drinkBtn, 0xff0000, 600); } }; } // --- Siparişi kontrol et --- function checkOrder() { if (!currentOrder) return; // Pişirme veya içecek hazırlama gerektiriyorsa, önce o işlem yapılmalı if (currentOrder.type === 'cook' && !window.cooked) { LK.effects.flashScreen(0xffa500, 400); return; } if (currentOrder.type === 'drink' && !window.drinkReady) { LK.effects.flashScreen(0x8fd3f4, 400); return; } var correct = true; if (selectedIngredients.length !== currentOrder.ingredients.length) correct = false;else { for (var i = 0; i < currentOrder.ingredients.length; i++) { if (selectedIngredients[i] !== currentOrder.ingredients[i]) { correct = false; break; } } } if (correct) { score += 10; if (scoreText) scoreText.setText("Puan: " + score); LK.effects.flashScreen(0x00ff00, 400); LK.clearInterval(orderTimer); window.cooked = false; window.drinkReady = false; LK.setTimeout(newOrder, 800); } else { failOrder(); window.cooked = false; window.drinkReady = false; } } // --- Sipariş başarısız --- function failOrder() { LK.effects.flashScreen(0xff0000, 400); LK.clearInterval(orderTimer); score -= 5; if (score < 0) score = 0; if (scoreText) scoreText.setText("Puan: " + score); LK.setTimeout(newOrder, 800); } // --- Oyun başlat --- function startGame() { // Skor gösterimi if (scoreText) scoreText.destroy(); scoreText = new Text2("Puan: 0", { size: 90, fill: "#fff" }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); // Malzeme butonlarını oluştur for (var i = 0; i < ingredientButtons.length; i++) { ingredientButtons[i].destroy(); } ingredientButtons = []; // Mobilde ekranın altına ve ortalanmış şekilde butonları yerleştir var buttonAreaY = 2732 - 270; // Alt kısımda, deliverBtn'in üstünde, biraz daha yukarı var buttonSize = 170; // Daha küçük butonlar var spacing = 38; // Daha az boşluk var totalWidth = INGREDIENTS.length * buttonSize + (INGREDIENTS.length - 1) * spacing; var startX = 2048 / 2 - totalWidth / 2 + buttonSize / 2; for (var i = 0; i < INGREDIENTS.length; i++) { var btn = new IngredientButton(); btn.setIngredient(INGREDIENTS[i]); btn.x = startX + i * (buttonSize + spacing); btn.y = buttonAreaY; btn.scaleX = btn.scaleY = buttonSize / 200; // IngredientButton asset boyutu 200, orantılı küçült ingredientButtons.push(btn); game.addChild(btn); } // Pişir ve İçecek Hazırla butonları if (typeof cookBtn !== "undefined" && cookBtn) cookBtn.destroy(); if (typeof drinkBtn !== "undefined" && drinkBtn) drinkBtn.destroy(); cookBtn = new Container(); var cookAsset = cookBtn.attachAsset('ingredient_meat', { anchorX: 0.5, anchorY: 0.5, width: 200, height: 100, color: 0xffa500 }); var cookText = new Text2("Pişir", { size: 54, fill: "#fff" }); cookText.anchor.set(0.5, 0.5); cookBtn.addChild(cookText); cookBtn.x = 2048 / 2 - 250; cookBtn.y = buttonAreaY - 120; cookBtn.visible = false; game.addChild(cookBtn); drinkBtn = new Container(); var drinkAsset = drinkBtn.attachAsset('ingredient_water', { anchorX: 0.5, anchorY: 0.5, width: 200, height: 100, color: 0x8fd3f4 }); var drinkText = new Text2("İçecek Hazırla", { size: 44, fill: "#222" }); drinkText.anchor.set(0.5, 0.5); drinkBtn.addChild(drinkText); drinkBtn.x = 2048 / 2 + 250; drinkBtn.y = buttonAreaY - 120; drinkBtn.visible = false; game.addChild(drinkBtn); // Sipariş başlat newOrder(); } // --- Teslim et butonu --- var deliverBtn = new Container(); var deliverAsset = deliverBtn.attachAsset('deliver', { anchorX: 0.5, anchorY: 0.5, width: 300, height: 120, color: 0x4b8cff }); var deliverText = new Text2("Teslim Et", { size: 70, fill: "#fff" }); deliverText.anchor.set(0.5, 0.5); deliverBtn.addChild(deliverText); deliverBtn.x = 2048 / 2; // Müşterinin hemen altına yerleştir (müşteri 600'de, yüksekliği 300, biraz boşluk ekle) deliverBtn.y = 600 + 150 + 60; // customer.y + customer.height/2 + margin deliverBtn.down = function (x, y, obj) { checkOrder(); }; game.addChild(deliverBtn); // --- Tarif Kitabı (Recipe Book) --- // Tarif kitabı paneli (tam ekran, başta gizli) var recipeBookPanel = new Container(); var recipeBookBg = recipeBookPanel.attachAsset('ingredient_lettuce', { anchorX: 0.5, anchorY: 0.5, width: 2048, height: 2732, color: 0xfafafa }); recipeBookPanel.x = 2048 / 2; recipeBookPanel.y = 2732 / 2; recipeBookPanel.visible = false; // Panel başlığı var recipeTitle = new Text2("Tarifler", { size: 110, fill: "#222" }); recipeTitle.anchor.set(0.5, 0); recipeTitle.y = -1100; recipeBookPanel.addChild(recipeTitle); // Tarifleri listele var yStart = recipeTitle.y + 180; var recipeLineSpacing = 100; for (var i = 0; i < RECIPES.length; i++) { var recipe = RECIPES[i]; var recipeStr = recipe.name + ": "; for (var j = 0; j < recipe.ingredients.length; j++) { var ing = INGREDIENTS.find(function (x) { return x.id === recipe.ingredients[j]; }); recipeStr += ing ? ing.name : recipe.ingredients[j]; if (j < recipe.ingredients.length - 1) recipeStr += ", "; } var recipeLine = new Text2(recipeStr, { size: 80, fill: "#333" }); recipeLine.anchor.set(0.5, 0); recipeLine.y = yStart + i * recipeLineSpacing; recipeBookPanel.addChild(recipeLine); } // Kapatma butonu (büyük, üstte) var closeBtn = new Container(); var closeBtnAsset = closeBtn.attachAsset('ingredient_tomato', { anchorX: 0.5, anchorY: 0.5, width: 160, height: 160, color: 0xff4b4b }); var closeBtnText = new Text2("Kapat", { size: 48, fill: "#fff" }); closeBtnText.anchor.set(0.5, 0.5); closeBtn.addChild(closeBtnText); closeBtn.x = 0; closeBtn.y = -1200; closeBtn.down = function (x, y, obj) { recipeBookPanel.visible = false; }; recipeBookPanel.addChild(closeBtn); // Paneli oyuna ekle (en üstte olacak şekilde) game.addChild(recipeBookPanel); // Her frame'de recipeBookPanel'i en üste taşı game.update = function (origUpdate) { return function () { // Panel görünürse, en üste taşı if (recipeBookPanel && recipeBookPanel.visible) { // En üste taşımak için önce çıkarıp tekrar ekle if (recipeBookPanel.parent) { recipeBookPanel.parent.removeChild(recipeBookPanel); game.addChild(recipeBookPanel); } } if (typeof origUpdate === "function") origUpdate.call(game); }; }(game.update); // Tarif kitabı açma butonu (her zaman görünür, ekranın sağ üstünde, tarif paneli açıkken gizli) var recipeBookBtn = new Container(); var recipeBookBtnAsset = recipeBookBtn.attachAsset('ingredient_cheese', { anchorX: 0.5, anchorY: 0.5, width: 140, height: 140, color: 0xffe066 }); var recipeBookBtnText = new Text2("Tarifler", { size: 44, fill: "#222" }); recipeBookBtnText.anchor.set(0.5, 0.5); recipeBookBtn.addChild(recipeBookBtnText); // Sağ üstte, platform menüsüne çakışmayacak şekilde (ilk 100x100 px boş bırak) recipeBookBtn.x = 2048 - 160; recipeBookBtn.y = 100 + 70; recipeBookBtn.down = function (x, y, obj) { recipeBookPanel.visible = true; recipeBookBtn.visible = false; // Diğer etkileşimli elemanları gizle deliverBtn.visible = false; for (var i = 0; i < ingredientButtons.length; i++) { ingredientButtons[i].visible = false; } if (customer) customer.visible = false; if (orderText) orderText.visible = false; if (timerText) timerText.visible = false; }; // Panel açıldığında kapatma butonuna basınca tekrar göster closeBtn.down = function (x, y, obj) { recipeBookPanel.visible = false; recipeBookBtn.visible = true; // Diğer etkileşimli elemanları tekrar göster deliverBtn.visible = true; for (var i = 0; i < ingredientButtons.length; i++) { ingredientButtons[i].visible = true; } if (customer) customer.visible = true; if (orderText) orderText.visible = true; if (timerText) timerText.visible = true; }; game.addChild(recipeBookBtn); // --- Oyunu başlat --- startGame(); ;
===================================================================
--- original.js
+++ change.js
@@ -100,37 +100,104 @@
color: 0xf5e6b2
}];
var RECIPES = [{
name: 'Burger',
- ingredients: ['lettuce', 'tomato', 'cheese', 'meat']
+ ingredients: ['lettuce', 'tomato', 'cheese', 'meat'],
+ type: 'cook'
}, {
name: 'Salata',
- ingredients: ['lettuce', 'tomato', 'cheese']
+ ingredients: ['lettuce', 'tomato', 'cheese'],
+ type: 'normal'
}, {
name: 'Peynirli Sandviç',
- ingredients: ['cheese', 'lettuce', 'tomato', 'bread']
+ ingredients: ['cheese', 'lettuce', 'tomato', 'bread'],
+ type: 'normal'
}, {
name: 'Etli Sandviç',
- ingredients: ['meat', 'cheese', 'lettuce', 'bread']
+ ingredients: ['meat', 'cheese', 'lettuce', 'bread'],
+ type: 'cook'
}, {
name: 'Domatesli Salata',
- ingredients: ['lettuce', 'tomato']
+ ingredients: ['lettuce', 'tomato'],
+ type: 'normal'
}, {
name: 'Tavuklu Salata',
- ingredients: ['lettuce', 'tomato', 'chicken', 'cucumber']
+ ingredients: ['lettuce', 'tomato', 'chicken', 'cucumber'],
+ type: 'normal'
}, {
name: 'Yumurtalı Salata',
- ingredients: ['lettuce', 'egg', 'tomato', 'onion']
+ ingredients: ['lettuce', 'egg', 'tomato', 'onion'],
+ type: 'cook'
}, {
name: 'Tavuklu Sandviç',
- ingredients: ['chicken', 'cheese', 'lettuce', 'bread']
+ ingredients: ['chicken', 'cheese', 'lettuce', 'bread'],
+ type: 'cook'
}, {
name: 'Sebzeli Sandviç',
- ingredients: ['lettuce', 'tomato', 'cucumber', 'bread']
+ ingredients: ['lettuce', 'tomato', 'cucumber', 'bread'],
+ type: 'normal'
}, {
name: 'Soğanlı Burger',
- ingredients: ['meat', 'cheese', 'onion', 'bread']
+ ingredients: ['meat', 'cheese', 'onion', 'bread'],
+ type: 'cook'
+},
+// Drinks
+{
+ name: 'Limonata',
+ ingredients: ['lemon', 'water', 'sugar'],
+ type: 'drink'
+}, {
+ name: 'Soğuk Çay',
+ ingredients: ['tea', 'water', 'sugar', 'lemon'],
+ type: 'drink'
+}, {
+ name: 'Ayran',
+ ingredients: ['yogurt', 'water', 'salt'],
+ type: 'drink'
}];
+// Ekstra içecek ve pişirme malzemeleri
+if (!INGREDIENTS.find(function (i) {
+ return i.id === 'lemon';
+})) INGREDIENTS.push({
+ id: 'lemon',
+ name: 'Limon',
+ color: 0xfff700
+});
+if (!INGREDIENTS.find(function (i) {
+ return i.id === 'water';
+})) INGREDIENTS.push({
+ id: 'water',
+ name: 'Su',
+ color: 0x8fd3f4
+});
+if (!INGREDIENTS.find(function (i) {
+ return i.id === 'sugar';
+})) INGREDIENTS.push({
+ id: 'sugar',
+ name: 'Şeker',
+ color: 0xffffff
+});
+if (!INGREDIENTS.find(function (i) {
+ return i.id === 'tea';
+})) INGREDIENTS.push({
+ id: 'tea',
+ name: 'Çay',
+ color: 0x7b3f00
+});
+if (!INGREDIENTS.find(function (i) {
+ return i.id === 'yogurt';
+})) INGREDIENTS.push({
+ id: 'yogurt',
+ name: 'Yoğurt',
+ color: 0xfafafa
+});
+if (!INGREDIENTS.find(function (i) {
+ return i.id === 'salt';
+})) INGREDIENTS.push({
+ id: 'salt',
+ name: 'Tuz',
+ color: 0xe0e0e0
+});
var currentOrder = null;
var selectedIngredients = [];
var customer = null;
var ingredientButtons = [];
@@ -160,8 +227,11 @@
// orderText'i deliverBtn'in hemen altına yerleştir
orderText.x = 2048 / 2;
orderText.y = deliverBtn.y + deliverBtn.height / 2 + 30;
game.addChild(orderText);
+ // Sipariş türüne göre pişir ve içecek butonlarını göster/gizle
+ if (typeof cookBtn !== "undefined" && cookBtn) cookBtn.visible = currentOrder.type === 'cook';
+ if (typeof drinkBtn !== "undefined" && drinkBtn) drinkBtn.visible = currentOrder.type === 'drink';
// Zamanı başlat
orderTimeLeft = orderTimeLimit;
if (timerText) timerText.destroy();
timerText = new Text2("Süre: " + Math.floor(orderTimeLeft / 1000), {
@@ -189,11 +259,71 @@
failOrder();
}
}, 100);
}
+// --- Pişir ve içecek hazırla butonları için global değişkenler ---
+window.cooked = false;
+window.drinkReady = false;
+// --- Cook button logic ---
+if (typeof cookBtn !== "undefined") {
+ cookBtn.down = function (x, y, obj) {
+ if (!currentOrder || currentOrder.type !== 'cook') return;
+ if (selectedIngredients.length !== currentOrder.ingredients.length) {
+ LK.effects.flashScreen(0xffa500, 400);
+ return;
+ }
+ // Sıralı ve tam malzeme kontrolü
+ var correct = true;
+ for (var i = 0; i < currentOrder.ingredients.length; i++) {
+ if (selectedIngredients[i] !== currentOrder.ingredients[i]) {
+ correct = false;
+ break;
+ }
+ }
+ if (correct) {
+ window.cooked = true;
+ LK.effects.flashObject(cookBtn, 0x00ff00, 600);
+ } else {
+ LK.effects.flashObject(cookBtn, 0xff0000, 600);
+ }
+ };
+}
+// --- Drink button logic ---
+if (typeof drinkBtn !== "undefined") {
+ drinkBtn.down = function (x, y, obj) {
+ if (!currentOrder || currentOrder.type !== 'drink') return;
+ if (selectedIngredients.length !== currentOrder.ingredients.length) {
+ LK.effects.flashScreen(0x8fd3f4, 400);
+ return;
+ }
+ // Sıralı ve tam malzeme kontrolü
+ var correct = true;
+ for (var i = 0; i < currentOrder.ingredients.length; i++) {
+ if (selectedIngredients[i] !== currentOrder.ingredients[i]) {
+ correct = false;
+ break;
+ }
+ }
+ if (correct) {
+ window.drinkReady = true;
+ LK.effects.flashObject(drinkBtn, 0x00ff00, 600);
+ } else {
+ LK.effects.flashObject(drinkBtn, 0xff0000, 600);
+ }
+ };
+}
// --- Siparişi kontrol et ---
function checkOrder() {
if (!currentOrder) return;
+ // Pişirme veya içecek hazırlama gerektiriyorsa, önce o işlem yapılmalı
+ if (currentOrder.type === 'cook' && !window.cooked) {
+ LK.effects.flashScreen(0xffa500, 400);
+ return;
+ }
+ if (currentOrder.type === 'drink' && !window.drinkReady) {
+ LK.effects.flashScreen(0x8fd3f4, 400);
+ return;
+ }
var correct = true;
if (selectedIngredients.length !== currentOrder.ingredients.length) correct = false;else {
for (var i = 0; i < currentOrder.ingredients.length; i++) {
if (selectedIngredients[i] !== currentOrder.ingredients[i]) {
@@ -206,11 +336,15 @@
score += 10;
if (scoreText) scoreText.setText("Puan: " + score);
LK.effects.flashScreen(0x00ff00, 400);
LK.clearInterval(orderTimer);
+ window.cooked = false;
+ window.drinkReady = false;
LK.setTimeout(newOrder, 800);
} else {
failOrder();
+ window.cooked = false;
+ window.drinkReady = false;
}
}
// --- Sipariş başarısız ---
function failOrder() {
@@ -250,8 +384,47 @@
btn.scaleX = btn.scaleY = buttonSize / 200; // IngredientButton asset boyutu 200, orantılı küçült
ingredientButtons.push(btn);
game.addChild(btn);
}
+ // Pişir ve İçecek Hazırla butonları
+ if (typeof cookBtn !== "undefined" && cookBtn) cookBtn.destroy();
+ if (typeof drinkBtn !== "undefined" && drinkBtn) drinkBtn.destroy();
+ cookBtn = new Container();
+ var cookAsset = cookBtn.attachAsset('ingredient_meat', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 200,
+ height: 100,
+ color: 0xffa500
+ });
+ var cookText = new Text2("Pişir", {
+ size: 54,
+ fill: "#fff"
+ });
+ cookText.anchor.set(0.5, 0.5);
+ cookBtn.addChild(cookText);
+ cookBtn.x = 2048 / 2 - 250;
+ cookBtn.y = buttonAreaY - 120;
+ cookBtn.visible = false;
+ game.addChild(cookBtn);
+ drinkBtn = new Container();
+ var drinkAsset = drinkBtn.attachAsset('ingredient_water', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 200,
+ height: 100,
+ color: 0x8fd3f4
+ });
+ var drinkText = new Text2("İçecek Hazırla", {
+ size: 44,
+ fill: "#222"
+ });
+ drinkText.anchor.set(0.5, 0.5);
+ drinkBtn.addChild(drinkText);
+ drinkBtn.x = 2048 / 2 + 250;
+ drinkBtn.y = buttonAreaY - 120;
+ drinkBtn.visible = false;
+ game.addChild(drinkBtn);
// Sipariş başlat
newOrder();
}
// --- Teslim et butonu ---