Code edit (7 edits merged)
Please save this source code
User prompt
Şu şekilde bir tablo oluşturman gerekiyor: (Oyunun skor tablosunu gösterebilmem için) "zar1 asseti" = 100 (büyük boşluk) "zar1 asseti" "zar1 asseti" "zar1 asseti" = 1000 "zar5 asseti" = 50 (büyük boşluk) "zar2 asseti" "zar2 asseti" "zar2 asseti" = 200 "zar1 asseti" "zar2 asseti" "zar3 asseti" "zar4 asseti" "zar5 asseti" = 500 (büyük boşluk) "zar3 asseti" "zar3 asseti" "zar3 asseti" = 300 "zar2 asseti" "zar3 asseti" "zar4 asseti" "zar5 asseti" "zar6 asseti" = 750 (büyük boşluk) "zar4 asseti" "zar4 asseti" "zar4 asseti" = 400 "zar1 asseti" "zar2 asseti" "zar3 asseti" "zar4 asseti" "zar5 asseti" "zar6 asseti" = 1500 (büyük boşluk) "zar5 asseti" "zar5 asseti" "zar5 asseti" = 500 "zar6 asseti" = Joker (büyük boşluk) "zar6 asseti" "zar6 asseti" "zar6 asseti" = 600 Bu tabloyu skor tablosunun altına koyacağım.
User prompt
Hani şu anda atılan zarların sonucunda hiçbir kombinasyon yapılamadığı zaman kırmızı bir ekran yanıp yavaşça sönüyor ya, bunun süresini uzatabilir miyiz? O kırmızı ekran bittikten sonra çok hızlı geçiyor oyun. O kırmızı ekran geldiği zaman ekranda 1 saniye boyunca beyaz "İflas!" yazısı yazsa ve o da yavaşça kaybolsa ve sonrasında oyun devam etse (sıra diğer oyuncuya geçse) daha güzel olurdu bence. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (3 edits merged)
Please save this source code
User prompt
Ama şu anda zarlar dönüyorken NPC (2. oyuncu) hala zar seçebiliyor! Zarlar dönüyorken (durmamışken) zarlar seçilemez! Zar seçmek için zarlar durmuş olmaları şart.
User prompt
Please fix the bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (dice[idx].selected) {' Line Number: 921
User prompt
Ama şu anda 2. oyuncu (NPC) TUT ve DEVAM ET dediği zaman zarların döndüğünü görmüyorum, zarlar sadece 1. oyuncu TUT ve DEVAM ET dediği zaman dönüyor. Bunu düzelt. Ayrıca zarlar dönerken 2. oyuncu da zar seçemez, zar dönüşünün bitmesini beklemek zorunda. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
TUT ve DEVAM ET butonuna basıldığı zaman zarlar bir anda fırlatılmasın, zarlar rastgele olarak 2 saniye boyunca dönsün (farklı değerler göstersin hızlıca dönüyormuş gibi) sonra dursun. Bu esnada zarlar seçilemez, zarların seçilebilmesi için durması gerekiyor bu hızlıca dönme sürecinin. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Zarların her biri için bir asset kullanmak istiyorum. 1 zarında "zar1", 2 zarında "zar2", 3 zarında "zar3", 4 zarında "zar4", 5 zarında "zar5", 6 zarında "zar6" asseti olsun.
Code edit (2 edits merged)
Please save this source code
User prompt
Zarların boyutunu biraz daha büyült.
Code edit (1 edits merged)
Please save this source code
User prompt
TUT ve TURU SONALNDIR butonunun yanına PAS GEÇ butonu ekle. Bu butona basınca sıram pas geçsin ve tur sırası rakibe (2. Oyuncu) geçsin.
User prompt
Hedef skoru 2000 yerine 5000 yapar mısın? Ayrıca attığım zar sonucunda (sıra bana gelince attığım zar da dahil) eğer hiçbir şekilde kombinasyon yapamıyorsam otomatik olarak tur sıram rakibe geçmeli.
Code edit (5 edits merged)
Please save this source code
User prompt
2. Oyuncunun seçtiği zarlar hala aşağıda dizilmiyor! Şu kısım "/* Seçili zarlar aşağıda (hem PLAYER hem de NPC için) */ var selStart = W / 2 - (sel.length - 1) * 220 / 2; var selY = H / 2 + 250; sel.forEach(function (idx, i) { var d = dice[idx]; d.x = selStart + i * 220; d.y = selY; d.face.alpha = .6; }); /* Diğer zarlar ortada */ var unStart = W / 2 - (unsel.length - 1) * 220 / 2, y = H / 2; unsel.forEach(function (idx, i) { var d = dice[idx]; d.x = unStart + i * 220; d.y = y; d.face.alpha = 1; });" 1. oyuncu için düzgün çalışıyor fakat 2. oyuncu (NPC) için düzgün çalışmıyor. Şimdi de sağda diziliyor. Ayrıca 2. oyuncu (NPC) her zar seçtiğinde "zarSecmeSesi" çalsın 1 kere. 2. oyuncu TUT ve DEVAM ET butonuna basınca "tutVeDevamEtSesi" çalsın 1 kere. 2. oyuncu TUT ve TURU SONLANDIR butonuna basınca "tutVeTuruSonlandirSesi" çalsın 1 kere. 2. oyuncu seçtiği zarı geri bırakırsa "zarBirakmaSesi" çalsın 1 kere.
User prompt
2. Oyuncunun (NPC) seçtiği zarlar aşağıda dizilmiyor, sol tarafta diziliyor. Benim mesela (1. Oyuncu) seçtiğim zarlar aşağıda diziliyor fakat 2. Oyuncunun seçtiği zarlar aşağıda dizilmiyor, solda diziliyor.
User prompt
Şu anda NPC'nin (2. Oyuncu) seçtiği zarlar sanki bir anda yok oluyor gibi. NPC (2. Oyuncu) o zarları seçtiği zaman benim seçtiğim zamandaki gibi o seçtiği zarlar aşağıda gözükmeli sonrasında oyuncu TUT ve DEVAM ET ya da TUT ve TURU SONLANDIR butonuna bastığı zaman ona göre değerlendirme yapılmalı. Şu anda 2. Oyuncu (NPC) çok hızlı oynadığı için ben 2. Oyuncunun Seçilen Skor ve Geçici Skor değerlerini tabloda göremeden bir anda Ana Skora ekliyor.
User prompt
2. Oyuncunun seçtiği zarları göremiyorum. 2. Oyuncu (NPC) çok hızlı oynuyor. 2. oyuncu her bir zarı seçerken araya 1 saniyelik bir bekleme süresi koy.
User prompt
Şu anda 2. Oyuncu çok hızlı oynuyor, daha yavaş oynamasını sağla. 2. Oyuncunun Seçilen Skor, Geçici Skor ve Ana Skor gibi skorlarını göremiyorum hep 0 yazıyor.
Code edit (1 edits merged)
Please save this source code
User prompt
NPC'nin her hareketinin arasına 500ms koy lütfen o halde.
Code edit (2 edits merged)
Please save this source code
User prompt
Hala sağda, daha fazla solda olması gerekiyor. Tam ortalanmamış çünkü. 2048'lik ekranı 1024 diye yarıya böldüğümüzü düşün sol ve sağ taraf olarak, senin yaptığında tablodaki yazıların merkezi 1024 değil ekranın sağ tarfında kalan 1024'lük yerine tam merkezi yani total ekrana göre 1536 oluyor.
User prompt
Şu anda daha da sağa doğru kaydı tablo. Neredeyse ekranımda gözükmüyor bile!
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Initialize Game ****/ // Kanvas boyutları /* --- Oyun nesnesi --- */ var game = new LK.Game({ backgroundColor: 0x1a1a1a }); /**** * Game Code ****/ // Music for each screen // Custom background images for each screen /*********************************************************** * 1. KISIM — VARLIKLAR, GENEL TANIMLAR, Dice SINIFI ************************************************************/ /* --- Zar sınıfı --- */ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) { throw o; } } } }; } function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) { return _arrayLikeToArray(r, a); } var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) { n[e] = r[e]; } return n; } function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) { return; } f = !1; } else { for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) { return; } } finally { if (o) { throw n; } } } return a; } } function _arrayWithHoles(r) { if (Array.isArray(r)) { return r; } } function _classCallCheck(a, n) { if (!(a instanceof n)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) { return t; } var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) { return i; } throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) { return e; } if (void 0 !== e) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(t); } function _assertThisInitialized(e) { if (void 0 === e) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return e; } function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } function _inherits(t, e) { if ("function" != typeof e && null !== e) { throw new TypeError("Super expression must either be null or a function"); } t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } var W = 2048, H = 2732; var Dice = /*#__PURE__*/function (_Container) { function Dice() { var _this; _classCallCheck(this, Dice); _this = _callSuper(this, Dice); /** Zar yüzü (1-6) */ _this.value = 1; /** Seçili mi? */ _this.selected = false; // Kasa _this.face = _this.attachAsset('diceFace', { anchorX: .5, anchorY: .5 }); // 6 pip _this.pip = []; for (var i = 0; i < 6; i++) { var dot = _this.attachAsset("pip".concat(i), { anchorX: .5, anchorY: .5, width: 32, height: 32, color: 0x222222, shape: 'ellipse' }); dot.visible = false; _this.pip.push(dot); } _this.updateFace(); return _this; } /** Değeri ayarla + yüzü güncelle */ _inherits(Dice, _Container); return _createClass(Dice, [{ key: "setValue", value: function setValue(v) { this.value = v; this.updateFace(); } /** Pip’leri göster/gizle */ }, { key: "updateFace", value: function updateFace() { var _this2 = this; this.pip.forEach(function (p) { return p.visible = false; }); var map = { 1: [2], 2: [0, 5], 3: [0, 2, 5], 4: [0, 1, 4, 5], 5: [0, 1, 2, 4, 5], 6: [0, 1, 3, 4, 5, 6] }; var pos = [[-40, -40], [40, -40], [0, 0], [-40, 40], [40, 40], [-40, 0], [40, 0]]; map[this.value].forEach(function (idx, i) { var _pos$idx = _slicedToArray(pos[idx], 2), x = _pos$idx[0], y = _pos$idx[1]; var d = _this2.pip[i]; d.x = x; d.y = y; d.visible = true; }); } }]); }(Container); /* --- Global durum --- */ var PLAYER = 0, NPC = 1; var scores = [0, 0], turnScore = 0, current = PLAYER, gameOver = false; var dice = []; // Aktif zarlar var selectedDiceIdx = []; // Seçili zar indeksleri var diceGroup = null, selectedDiceGroup = null; /* --- Diziyi yeniden numaralandır + doğru tıklama --- */ function renumberDice() { for (var i = 0; i < dice.length; i++) { var d = dice[i]; d.idx = i; // güncel indis d.down = function () { toggleSelect(this.idx); }; // <— closure sorunu yok } } /*********************************************************** * 2. KISIM — SKOR HESABI ve KOMBİNASYON YARDIMCILARI ************************************************************/ /* Farkle puan tablosu */ function calcScoreFarkle(vals) { var cnt = Array(7).fill(0); vals.forEach(function (v) { return cnt[v]++; }); var score = 0, used = []; /* Full straight 1-6 */ if (vals.length === 6 && [1, 2, 3, 4, 5, 6].every(function (v) { return cnt[v] === 1; })) { return { score: 1500, used: [0, 1, 2, 3, 4, 5] }; } /* Partial straight 1-5 */ if (vals.length === 5 && [1, 2, 3, 4, 5].every(function (v) { return cnt[v]; })) { return { score: 500, used: [0, 1, 2, 3, 4] }; } /* Partial straight 2-6 */ if (vals.length === 5 && [2, 3, 4, 5, 6].every(function (v) { return cnt[v]; })) { return { score: 750, used: [0, 1, 2, 3, 4] }; } /* 3-6 aynı zar kümeleri */ for (var v = 1; v <= 6; v++) { if (cnt[v] >= 3) { var base = v === 1 ? 1000 : v * 100; var factor = [1, 2, 4, 8][cnt[v] - 3]; score += base * factor; var need = cnt[v]; vals.forEach(function (val, i) { if (val === v && need) { used.push(i); need--; } }); cnt[v] = 0; // tekil sayılmasın } } /* Tekil 1 & 5 */ vals.forEach(function (v, i) { if (used.includes(i)) { return; } if (v === 1) { score += 100; used.push(i); } if (v === 5) { score += 50; used.push(i); } }); return { score: score, used: used }; } /* Seçim geçerli mi? */ function isValidSelection(selVals) { var r = calcScoreFarkle(selVals); return r.score > 0 && r.used.length === selVals.length; } /* Belirli uzunlukta kombinasyonları döndür */ function getCombinations(arr, k) { var out = []; (function helper(start, path) { if (path.length === k) { out.push(path.slice()); return; } for (var i = start; i < arr.length; i++) { path.push(arr[i]); helper(i + 1, path); path.pop(); } })(0, []); return out; } /* Kalan zarlarla **hiç** skor yapılabilir mi? */ function canMakeAnyScore(vals) { if (!vals.length) { return false; } for (var i = 1; i <= vals.length; i++) { var combs = getCombinations(vals, i); var _iterator = _createForOfIteratorHelper(combs), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var c = _step.value; if (isValidSelection(c)) { return true; } } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } } return false; } /*********************************************************** * 3. KISIM — GUI, HUD ve ZAR YÖNETİMİ ************************************************************/ /* --- Butonlar --- */ var rollBtn = new Container(); rollBtn.attachAsset('btnBlue', { anchorX: .5, anchorY: .5 }); var rollTxt = new Text2('TUT ve DEVAM ET', { size: 36, fill: '#fff' }); rollTxt.anchor.set(.5, .5); rollBtn.addChild(rollTxt); LK.gui.bottom.addChild(rollBtn); rollBtn.x = -460; rollBtn.y = -140; var bankBtn = new Container(); bankBtn.attachAsset('btnRed', { anchorX: .5, anchorY: .5 }); var bankTxt = new Text2('TUT ve TURU SONLANDIR', { size: 36, fill: '#fff' }); bankTxt.anchor.set(.5, .5); bankBtn.addChild(bankTxt); LK.gui.bottom.addChild(bankBtn); bankBtn.x = 50; bankBtn.y = -140; /* --- Reset & Pozisyon --- */ function resetDice() { var n = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 6; if (diceGroup) { diceGroup.destroy(); } if (selectedDiceGroup) { selectedDiceGroup.destroy(); } dice = []; selectedDiceIdx = []; diceGroup = new Container(); selectedDiceGroup = new Container(); game.addChild(diceGroup); game.addChild(selectedDiceGroup); var startX = W / 2 - (n - 1) * 220 / 2, y = H / 2; for (var i = 0; i < n; i++) { var d = new Dice(); d.x = startX + i * 220; d.y = y; d.setValue(1 + Math.floor(Math.random() * 6)); diceGroup.addChild(d); dice.push(d); } renumberDice(); updateDicePositions(); updateHUD(); } /* Seç/Aç seçimi */ function toggleSelect(idx) { if (gameOver || current !== PLAYER) { return; } var d = dice[idx]; if (d.selected) { d.selected = false; selectedDiceIdx = selectedDiceIdx.filter(function (i) { return i !== idx; }); // Play zarBirakmaSesi when deselecting var birakmaSesi = LK.getSound && LK.getSound('zarBirakmaSesi'); if (birakmaSesi && birakmaSesi.play) { birakmaSesi.play(); } } else { d.selected = true; if (!selectedDiceIdx.includes(idx)) { selectedDiceIdx.push(idx); } // Play zarSecmeSesi when selecting var secmeSesi = LK.getSound && LK.getSound('zarSecmeSesi'); if (secmeSesi && secmeSesi.play) { secmeSesi.play(); } } updateDicePositions(); updateHUD(); } /* Konumları güncelle */ function updateDicePositions() { if (!diceGroup || !selectedDiceGroup) { return; } diceGroup.removeChildren(); selectedDiceGroup.removeChildren(); var sel = selectedDiceIdx.slice(); // kopya var unsel = []; for (var i = 0; i < dice.length; i++) { var d = dice[i]; if (d && d.selected) { selectedDiceGroup.addChild(d); } else if (d) { unsel.push(i); diceGroup.addChild(d); } // Defensive: skip if d is undefined } /* Seçili zarlar aşağıda */ var selStart = W / 2 - (sel.length - 1) * 220 / 2, selY = H / 2 + 250; sel.forEach(function (idx, i) { var d = dice[idx]; d.x = selStart + i * 220; d.y = selY; d.face.alpha = .6; }); /* Diğer zarlar ortada */ var unStart = W / 2 - (unsel.length - 1) * 220 / 2, y = H / 2; unsel.forEach(function (idx, i) { var d = dice[idx]; d.x = unStart + i * 220; d.y = y; d.face.alpha = 1; }); } /*********************************************************** * 4. KISIM — OYUN DÖNGÜSÜ, NPC, HUD, BAŞLAT ************************************************************/ /* --- HUD --- */ // Skor tablosu için Text2 objeleri var scoreTableRows = [null, null, null, null]; var turnTxt; var TARGET_SCORE = 2000; // Hedef puan // Geçici ve seçilen skorlar için yeni değişkenler var tempScores = [0, 0]; // Geçici skorlar (her oyuncu için) var selectedScores = [0, 0]; // Seçilen skorlar (her oyuncu için) var turnNumber = 1; // Tur sayısı function updateHUD() { // --- Buton aktifliği --- var selVals = selectedDiceIdx.map(function (i) { return dice[i].value; }); var valid = isValidSelection(selVals); rollBtn.alpha = bankBtn.alpha = valid ? 1 : 0.4; rollBtn.interactive = bankBtn.interactive = valid && current === PLAYER && !gameOver; // --- Skor tablosu ilk kez oluşturuluyorsa ekle --- if (!scoreTableRows[0]) { // 1. satır: başlıklar scoreTableRows[0] = new Text2("1. Oyuncu | Hedef | 2. Oyuncu", { size: 54, fill: '#fff', fontWeight: 'bold' }); scoreTableRows[0].anchor.set(0.5, 0); LK.gui.top.addChild(scoreTableRows[0]); // Skor tablosunu ekranın tam ortasına yerleştir // Tüm satırları ve sıra göstergesini tam ekranın ortasına hizala var centerX = W / 2; // 2048/2 = 1024, ekranın tam ortası scoreTableRows[0].x = centerX; scoreTableRows[0].y = 80; // 2. satır: ana skorlar ve hedef scoreTableRows[1] = new Text2("", { size: 54, fill: '#fff' }); scoreTableRows[1].anchor.set(0.5, 0); LK.gui.top.addChild(scoreTableRows[1]); scoreTableRows[1].x = centerX; scoreTableRows[1].y = scoreTableRows[0].y + 60; // 3. satır: geçici skorlar ve tur scoreTableRows[2] = new Text2("", { size: 48, fill: '#ffe066' }); scoreTableRows[2].anchor.set(0.5, 0); LK.gui.top.addChild(scoreTableRows[2]); scoreTableRows[2].x = centerX; scoreTableRows[2].y = scoreTableRows[1].y + 54; // 4. satır: seçilen skorlar scoreTableRows[3] = new Text2("", { size: 44, fill: '#b3e6ff' }); scoreTableRows[3].anchor.set(0.5, 0); LK.gui.top.addChild(scoreTableRows[3]); scoreTableRows[3].x = centerX; scoreTableRows[3].y = scoreTableRows[2].y + 48; // Sıra göstergesi turnTxt = new Text2('', { size: 54, fill: '#ffe066', fontWeight: 'bold' }); turnTxt.anchor.set(0.5, 0); LK.gui.top.addChild(turnTxt); turnTxt.x = centerX; turnTxt.y = scoreTableRows[3].y + 60; } // --- Skor tablosunu güncelle --- scoreTableRows[1].setText(scores[PLAYER] + " | " + TARGET_SCORE + " | " + scores[NPC]); scoreTableRows[2].setText("Geçici Skor: " + tempScores[PLAYER] + " | Tur: " + turnNumber + " | Geçici Skor: " + tempScores[NPC]); // Seçilen Skor'u canlı olarak güncelle (sadece PLAYER için) var liveSelectedScore = 0; if (current === PLAYER && selectedDiceIdx.length > 0) { var selValsLive = selectedDiceIdx.map(function (i) { return dice[i].value; }); if (isValidSelection(selValsLive)) { liveSelectedScore = calcScoreFarkle(selValsLive).score; } } scoreTableRows[3].setText("Seçilen Skor: " + (current === PLAYER ? liveSelectedScore : selectedScores[PLAYER]) + " | Seçilen | Seçilen Skor: " + selectedScores[NPC]); turnTxt.setText(current === PLAYER ? 'Sıra: 1. Oyuncuda' : 'Sıra: 2. Oyuncuda'); } /* --- Tur Aksiyonları --- */ function rollAll() { if (gameOver || current !== PLAYER) { return; } dice.forEach(function (d) { if (!d.selected) { d.setValue(1 + Math.floor(Math.random() * 6)); } }); updateDicePositions(); updateHUD(); var unselVals = dice.filter(function (d) { return !d.selected; }).map(function (d) { return d.value; }); if (!canMakeAnyScore(unselVals)) { LK.effects.flashScreen(0xff0000, 600); LK.setTimeout(function () { turnScore = 0; endTurn(); }, 700); } } function keepAndContinue() { if (gameOver || current !== PLAYER) { return; } var selVals = selectedDiceIdx.map(function (i) { return dice[i].value; }); if (!isValidSelection(selVals)) { return; } // Seçilen skor hesapla ve ekle var selScore = calcScoreFarkle(selVals).score; selectedScores[current] = selScore; tempScores[current] += selectedScores[current]; selectedScores[current] = 0; // Seçilen skor sıfırlanır // turnScore artık kullanılmıyor, backward compatibility için güncelle turnScore = tempScores[current]; // Seçili zarları kaldır dice = dice.filter(function (d, i) { return !selectedDiceIdx.includes(i); }).map(function (d) { return d; }); selectedDiceIdx = []; if (dice.length === 0) { resetDice(6); } else { dice.forEach(function (d) { d.selected = false; d.setValue(1 + Math.floor(Math.random() * 6)); }); renumberDice(); updateDicePositions(); } updateHUD(); var unselVals = dice.map(function (d) { return d.value; }); if (!canMakeAnyScore(unselVals)) { LK.effects.flashScreen(0xff0000, 600); LK.setTimeout(function () { tempScores[current] = 0; selectedScores[current] = 0; turnScore = 0; updateHUD(); endTurn(); }, 700); } } function keepAndEndTurn() { if (gameOver || current !== PLAYER) { return; } var selVals = selectedDiceIdx.map(function (i) { return dice[i].value; }); if (!isValidSelection(selVals)) { return; } // Seçilen skor hesapla ve ekle var selScore = calcScoreFarkle(selVals).score; selectedScores[current] = selScore; // Ana skora ekle: geçici skor + seçilen skor scores[current] += tempScores[current] + selectedScores[current]; // Sıfırla tempScores[current] = 0; selectedScores[current] = 0; turnScore = 0; updateHUD(); endTurn(); } function endTurn() { // Kazanan kontrolü if (scores[current] >= TARGET_SCORE) { showWinner(); return; } // Sırayı değiştir current = current === PLAYER ? NPC : PLAYER; // Yeni oyuncunun geçici ve seçilen skorlarını sıfırla tempScores[current] = 0; selectedScores[current] = 0; turnScore = 0; // Tur sayısını sadece 1. oyuncuya geçerken artır if (current === PLAYER) { turnNumber++; } resetDice(6); updateHUD(); if (current === NPC) { LK.setTimeout(npcTurn, 800); } } /* --- NPC Basit AI --- */ function npcTurn() { if (gameOver || current !== NPC) { return; } dice.forEach(function (d) { d.selected = false; d.setValue(1 + Math.floor(Math.random() * 6)); }); updateDicePositions(); /* En yüksek puanlı kombinasyonu bul */ var vals = dice.map(function (d) { return d.value; }); var bestScore = 0, bestSel = []; for (var i = 1; i <= vals.length; i++) { var _iterator2 = _createForOfIteratorHelper(getCombinations(vals, i)), _step2; try { for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { var comb = _step2.value; if (isValidSelection(comb)) { var s = calcScoreFarkle(comb).score; if (s > bestScore) { bestScore = s; bestSel = comb; } } } } catch (err) { _iterator2.e(err); } finally { _iterator2.f(); } } if (bestScore === 0) { LK.effects.flashScreen(0xff0000, 600); LK.setTimeout(function () { turnScore = 0; endTurn(); }, 700); return; } /* Zarları seç */ var _iterator3 = _createForOfIteratorHelper(dice), _step3; try { for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { var d = _step3.value; d.selected = bestSel.includes(d.value); } } catch (err) { _iterator3.e(err); } finally { _iterator3.f(); } updateDicePositions(); /* Strateji: ≥400 puan veya 1 zar kalınca bank */ if (bestScore >= 400 || dice.length - bestSel.length <= 1) { turnScore += bestScore; endTurn(); } else { turnScore += bestScore; dice = dice.filter(function (d) { return !d.selected; }); selectedDiceIdx = []; renumberDice(); if (dice.length === 0) { resetDice(6); } else { dice.forEach(function (d) { d.selected = false; d.setValue(1 + Math.floor(Math.random() * 6)); }); } updateDicePositions(); updateHUD(); var unselVals = dice.map(function (d) { return d.value; }); if (!canMakeAnyScore(unselVals)) { LK.effects.flashScreen(0xff0000, 600); LK.setTimeout(function () { turnScore = 0; endTurn(); }, 700); return; } LK.setTimeout(npcTurn, 800); } } /* --- Kazanan ekranı --- */ function showWinner() { gameOver = true; var winnerText = current === PLAYER ? 'Kazandın!' : 'NPC Kazandı!'; showGameOverScreen(winnerText); } /* --- Buton Olayları --- */ rollBtn.down = function () { if (current === PLAYER) { var tutDevamSesi = LK.getSound && LK.getSound('tutVeDevamEtSesi'); if (tutDevamSesi && tutDevamSesi.play) { tutDevamSesi.play(); } keepAndContinue(); } }; bankBtn.down = function () { if (current === PLAYER) { var tutTuruSonlandirSesi = LK.getSound && LK.getSound('tutVeTuruSonlandirSesi'); if (tutTuruSonlandirSesi && tutTuruSonlandirSesi.play) { tutTuruSonlandirSesi.play(); } keepAndEndTurn(); } }; /* --- Başlat --- */ function startGame() { scores = [0, 0]; tempScores = [0, 0]; selectedScores = [0, 0]; turnScore = 0; turnNumber = 1; current = PLAYER; gameOver = false; // Set oyunEkraniArkaplani as background if (game._oyunBg) { game._oyunBg.destroy(); game._oyunBg = null; } var oyunBg = LK.getAsset('oyunEkraniArkaplani', { anchorX: 0, anchorY: 0, x: 0, y: 0, width: W, height: H }); game.addChildAt(oyunBg, 0); game._oyunBg = oyunBg; // Müzik sadece loading ekranı kalkınca başlatılacak, burada tekrar başlatılmıyor resetDice(6); updateHUD(); } // --- Ana Menü ve Oyun Sonu Ekranları --- var mainMenuContainer = null; var gameOverContainer = null; // Ana Menü Ekranını Göster function showMainMenu() { // Temizle if (mainMenuContainer) { mainMenuContainer.destroy(); mainMenuContainer = null; } if (gameOverContainer) { gameOverContainer.destroy(); gameOverContainer = null; } // Oyun alanını temizle if (diceGroup) { diceGroup.destroy(); diceGroup = null; } if (selectedDiceGroup) { selectedDiceGroup.destroy(); selectedDiceGroup = null; } dice = []; selectedDiceIdx = []; // Skor tablosunu gizle for (var i = 0; i < scoreTableRows.length; i++) { if (scoreTableRows[i]) { scoreTableRows[i].visible = false; } } if (turnTxt) { turnTxt.visible = false; } // Butonları pasifleştir rollBtn.visible = false; bankBtn.visible = false; // Remove oyun ekranı arkaplanı if exists if (game._oyunBg) { game._oyunBg.destroy(); game._oyunBg = null; } // Ana Menü Container mainMenuContainer = new Container(); mainMenuContainer.width = W; mainMenuContainer.height = H; // Arkaplan (anaMenuEkraniArkaplani) var bg = LK.getAsset('anaMenuEkraniArkaplani', { anchorX: 0, anchorY: 0, x: 0, y: 0, width: W, height: H }); mainMenuContainer.addChild(bg); // Müzik sadece loading ekranı kalkınca başlatılacak, burada tekrar başlatılmıyor // "Oyunu Başlat" Butonu var startBtn = new Container(); startBtn.attachAsset('btnBlue', { anchorX: 0.5, anchorY: 0.5, width: 600, // Buton genişliğini büyüt height: 180 // Buton yüksekliğini büyüt }); var startTxt = new Text2('Oyunu Başlat', { size: 60, // Yazı boyutunu büyüt fill: '#fff' }); startTxt.anchor.set(0.5, 0.5); startBtn.addChild(startTxt); startBtn.x = W / 2; startBtn.y = H / 2; startBtn.interactive = true; startBtn.down = function () { hideMainMenu(); startGame(); }; mainMenuContainer.addChild(startBtn); game.addChild(mainMenuContainer); } // Ana Menü Ekranını Gizle function hideMainMenu() { if (mainMenuContainer) { mainMenuContainer.destroy(); mainMenuContainer = null; } // Skor tablosunu göster for (var i = 0; i < scoreTableRows.length; i++) { if (scoreTableRows[i]) { scoreTableRows[i].visible = true; } } if (turnTxt) { turnTxt.visible = true; } // Butonları göster rollBtn.visible = true; bankBtn.visible = true; } // Oyun Sonu Ekranını Göster function showGameOverScreen(winnerText) { // Temizle if (gameOverContainer) { gameOverContainer.destroy(); gameOverContainer = null; } if (mainMenuContainer) { mainMenuContainer.destroy(); mainMenuContainer = null; } // Oyun alanını temizle if (diceGroup) { diceGroup.destroy(); diceGroup = null; } if (selectedDiceGroup) { selectedDiceGroup.destroy(); selectedDiceGroup = null; } dice = []; selectedDiceIdx = []; // Skor tablosunu gizle for (var i = 0; i < scoreTableRows.length; i++) { if (scoreTableRows[i]) { scoreTableRows[i].visible = false; } } if (turnTxt) { turnTxt.visible = false; } // Butonları pasifleştir rollBtn.visible = false; bankBtn.visible = false; // Remove oyun ekranı arkaplanı if exists if (game._oyunBg) { game._oyunBg.destroy(); game._oyunBg = null; } // Oyun Sonu Container gameOverContainer = new Container(); gameOverContainer.width = W; gameOverContainer.height = H; // Arkaplan (oyunSonuEkraniArkaplani) var bg = LK.getAsset('oyunSonuEkraniArkaplani', { anchorX: 0, anchorY: 0, x: 0, y: 0, width: W, height: H }); gameOverContainer.addChild(bg); // Müzik sadece loading ekranı kalkınca başlatılacak, burada tekrar başlatılmıyor // Kazanan/Kaybeden Metni var resultTxt = new Text2(winnerText || 'Oyun Bitti', { size: 80, fill: '#fff' }); resultTxt.anchor.set(0.5, 0.5); resultTxt.x = W / 2; resultTxt.y = H / 2 - 120; gameOverContainer.addChild(resultTxt); // "Ana Menüye Dön" Butonu var menuBtn = new Container(); menuBtn.attachAsset('btnRed', { anchorX: 0.5, anchorY: 0.5 }); var menuTxt = new Text2('Ana Menüye Dön', { size: 60, fill: '#fff' }); menuTxt.anchor.set(0.5, 0.5); menuBtn.addChild(menuTxt); menuBtn.x = W / 2; menuBtn.y = H / 2 + 60; menuBtn.interactive = true; menuBtn.down = function () { hideGameOverScreen(); showMainMenu(); }; gameOverContainer.addChild(menuBtn); game.addChild(gameOverContainer); } // Oyun Sonu Ekranını Gizle function hideGameOverScreen() { if (gameOverContainer) { gameOverContainer.destroy(); gameOverContainer = null; } // Skor tablosunu göster for (var i = 0; i < scoreTableRows.length; i++) { if (scoreTableRows[i]) { scoreTableRows[i].visible = true; } } if (turnTxt) { turnTxt.visible = true; } // Butonları göster rollBtn.visible = true; bankBtn.visible = true; } // --- Kazanan ekranı override --- // Yükleme ekranı için sınıf ve gösterme fonksiyonu var loadingContainer = null; var loadingTimeout = null; // Tween plugin import // Yükleme ekranını göster function showLoadingScreen() { // First, create the main menu in the background so resources can load showMainMenu(); // Müzik yükleme ekranında başlamasın, sadece loading kalkınca başlatacağız // (Burada playMusic çağrısı kaldırıldı) // Temizle if (loadingContainer) { loadingContainer.destroy(); loadingContainer = null; } loadingContainer = new Container(); loadingContainer.width = W; loadingContainer.height = H; // Kırmızı arkaplan var bg = LK.getAsset('loadingBgRed', { anchorX: 0, anchorY: 0, x: 0, y: 0, width: W, height: H, color: 0xff0000, shape: 'box' }); loadingContainer.addChild(bg); // Novatek logosu (ortada üstte) var logo = LK.getAsset('novatekLogosu', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1050 }); loadingContainer.addChild(logo); // "Loading..." yazısı var loadingTxt = new Text2('Yükleniyor...', { size: 90, fill: '#fff' }); loadingTxt.anchor.set(0.5, 0.5); loadingTxt.x = 1024; loadingTxt.y = 1366; loadingContainer.addChild(loadingTxt); // Alt açıklama yazısı var infoTxt = new Text2("En iyi oyun deneyimi için lütfen oyunun grafik ve ses kaynakları tamamen yüklenene kadar bekleyin. Unutmayın ki kumarbazların %99'u büyük kazanmadan hemen önce oyunu bırakıyor! %1'e girebilecek misin?", { size: 48, fill: '#fff', wordWrap: true, wordWrapWidth: 1400, align: 'center' }); infoTxt.anchor.set(0.5, 0); infoTxt.x = 1024; infoTxt.y = 1460; loadingContainer.addChild(infoTxt); // Dönen yükleme çubuğu var spinner = LK.getAsset('yuklemeCubugu', { anchorX: 0.5, anchorY: 0.5, x: W / 2, y: infoTxt.y + infoTxt.height + 120 }); loadingContainer.addChild(spinner); // Spinner animasyonu (dönme) spinner.rotation = 0; var _spinTween = function spinTween() { tween(spinner, { rotation: spinner.rotation + Math.PI * 2 }, { duration: 1200, easing: tween.linear, onFinish: _spinTween }); }; _spinTween(); // Add loading screen on top of main menu game.addChild(loadingContainer); // 10 saniye sonra loading ekranını kaldır (ana menü zaten gösteriliyor) loadingTimeout = LK.setTimeout(function () { if (loadingContainer) { loadingContainer.destroy(); loadingContainer = null; } // Ana menü zaten gösteriliyor, sadece loading overlay'ini kaldırıyoruz // Müzik burada başlatılır, sadece bir kez ve döngüde LK.playMusic('oyunEkraniMuzigi', { loop: true }); }, 10000); } // Oyun başında yükleme ekranını göster showLoadingScreen(); /* --- Responsive HUD --- */ if (!window._frvr_gui_resize_hooked) { window._frvr_gui_resize_hooked = true; LK.on('resize', function () { var centerX = W / 2; // 2048/2 = 1024, ekranın tam ortası for (var i = 0; i < scoreTableRows.length; i++) { if (scoreTableRows[i]) { scoreTableRows[i].x = centerX; } } if (turnTxt) { turnTxt.x = centerX; } }); }
===================================================================
--- original.js
+++ change.js
@@ -596,9 +596,9 @@
scoreTableRows[0].anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTableRows[0]);
// Skor tablosunu ekranın tam ortasına yerleştir
// Tüm satırları ve sıra göstergesini tam ekranın ortasına hizala
- var centerX = LK.gui.top.width ? LK.gui.top.width / 2 : W / 2;
+ var centerX = W / 2; // 2048/2 = 1024, ekranın tam ortası
scoreTableRows[0].x = centerX;
scoreTableRows[0].y = 80;
// 2. satır: ana skorlar ve hedef
scoreTableRows[1] = new Text2("", {
@@ -1224,9 +1224,9 @@
/* --- Responsive HUD --- */
if (!window._frvr_gui_resize_hooked) {
window._frvr_gui_resize_hooked = true;
LK.on('resize', function () {
- var centerX = LK.gui.top.width ? LK.gui.top.width / 2 : W / 2;
+ var centerX = W / 2; // 2048/2 = 1024, ekranın tam ortası
for (var i = 0; i < scoreTableRows.length; i++) {
if (scoreTableRows[i]) {
scoreTableRows[i].x = centerX;
}
Yeşil casino masa arkaplanı. Dikdörtgen.
Casino oyunum için buton olarak kullanmalık dikdörtgen (köşeleri yumuşatılmış, edge). Yazısız.. In-Game asset. 2d. High contrast. No shadows
Bu sefer zar 1 yerine zar 2 olsun. Delik kırmızı değil siyah olsun.
Zar 2 değil 3 olsun.
Zar 4 olsun. Deliklerinin içi dolu siyah olsun.
Zar 2 değil, zar 5 olsun.
Zar 6 olsun. İçindeki deliklerin içi dolu siyah olsun.
Zar 6 değil, zar joker olsun. Yani zarın üstünde joker sembolü olsun.
Zar 4 değil, zar 1 olsun. İçi siyah değil kırmızı olsun.
Casino tarzında yatay dikdörtgen (köşeleri yumuşatılmış, edge). İçi sarı, dışında kırmızı şerit var. Sol üst köşesinde bir çift zar var. Yazısız.. In-Game asset. 2d. High contrast. No shadows. Casino
oyunEkraniMuzigi
Music
zarBirakmaSesi
Sound effect
zarSecmeSesi
Sound effect
tutVeDevamEtSesi
Sound effect
tutVeTuruSonlandirSesi
Sound effect
ilkSenBasliyorsunSesi
Sound effect
rakibinSirasiSesi
Sound effect
siraSendeSesi
Sound effect
iflasBenSesi
Sound effect
iflasRakipSesi
Sound effect
senKazandinSesi
Sound effect
kaybettinSesi
Sound effect
pasButonuSesi
Sound effect
klavyeTusunaBasmaSesi
Sound effect
oyunuBaslatButonuSesi
Sound effect
anaMenuyeDonButonuSesi
Sound effect
hesabiSifirlaButonuSesi
Sound effect
yuklemeEkraniSesi
Sound effect
ilkRakipBasliyorSesi
Sound effect