User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 507
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 507
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 507
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 507
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 507
Code edit (9 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 417
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 417
User prompt
Gerekeni yap ve kodu düzelt!
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 417
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 417
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 417
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 417
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 417
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 417
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 417
User prompt
Şu anda ekranda tur sırasının kimde olduğunu göremiyorum, 1. oyuncu mu 2. oyuncu bunu görebiliyor olmam gerekiyor. 2. oyuncu yapay zeka falan değil, onu da benim kontrol etmem gerekiyor. Ayrıca 1. oyuncunun skoru sol üstte, 2. oyuncunun skoru sağ üstte yazmalı. Tur sırası kimdeyse ekranın ortasında üstte yazmalı.
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 417
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 417
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 417
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 417
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'selected')' in or related to this line: 'if (d.selected) {' Line Number: 417
/**** * Initialize Game ****/ /**** * Oyun Nesneleri ****/ var game = new LK.Game({ backgroundColor: 0x1a1a1a }); /**** * Game Code ****/ /**** * Dice Sınıfı ****/ // Ekran parametreleri 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 _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 Dice = /*#__PURE__*/function (_Container) { function Dice() { var _this; _classCallCheck(this, Dice); _this = _callSuper(this, Dice); /** Zarın yüzü (1-6) */ _this.value = 1; /** Seçili mi? */ _this.selected = false; // Zar kutusu _this.face = _this.attachAsset('diceFace', { anchorX: .5, anchorY: .5 }); // 6 nokta (pip) için alt container _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 güncelle & yüzü çiz */ _inherits(Dice, _Container); return _createClass(Dice, [{ key: "setValue", value: function setValue(v) { this.value = v; this.updateFace(); } }, { key: "updateFace", value: function updateFace() { var _this2 = this; // Tüm noktaları gizle this.pip.forEach(function (p) { return p.visible = false; }); // Hangi noktaların görüneceği var map = { 1: [2], // orta 2: [0, 5], // sol-üst, sağ-alt 3: [0, 2, 5], // sol-üst, orta, sağ-alt 4: [0, 1, 4, 5], // köşeler 5: [0, 1, 2, 4, 5], // köşeler + orta 6: [0, 1, 3, 4, 5, 6] // tüm satırlar }; // Pip koordinatları 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); /**** * Puan Hesabı (Farkle kuralları) ****/ function calcScore(values) { /* values: ör. [1,5,3,3,3,6] */ var cnt = Array(7).fill(0); values.forEach(function (v) { return cnt[v]++; }); var score = 0; // Tam straight 1-6 if (cnt.slice(1).every(function (c) { return c === 1; })) { return { score: 1500, used: [0, 1, 2, 3, 4, 5] }; } // Üç çift if (cnt.filter(function (c) { return c === 2; }).length === 3) { return { score: 750, used: [0, 1, 2, 3, 4, 5] }; } var usedIdx = []; /* 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; // İlk cnt[v] adeti kullanıldı say var need = cnt[v]; values.forEach(function (val, i) { if (val === v && need) { usedIdx.push(i); need--; } }); cnt[v] = 0; // artık tekil sayılmasın } } /* Tekil 1-5'ler */ values.forEach(function (v, i) { if (usedIdx.includes(i)) { return; } if (v === 1) { score += 100; usedIdx.push(i); } if (v === 5) { score += 50; usedIdx.push(i); } }); return { score: score, used: usedIdx }; } var W = 2048, H = 2732; /**** * GUI – ROLL ve BANK butonları ****/ var rollBtn = new Container(); rollBtn.attachAsset('btnBlue', { anchorX: .5, anchorY: .5 }); var rollTxt = new Text2('ROLL', { size: 80, fill: '#fff' }); rollTxt.anchor.set(.5, .5); rollBtn.addChild(rollTxt); LK.gui.bottom.addChild(rollBtn); // << artık her cihazda görünür rollBtn.x = -460; rollBtn.y = -140; // bottom’dan yukarı 140px var bankBtn = new Container(); bankBtn.attachAsset('btnRed', { anchorX: .5, anchorY: .5 }); var bankTxt = new Text2('BANK', { size: 80, fill: '#fff' }); bankTxt.anchor.set(.5, .5); bankBtn.addChild(bankTxt); LK.gui.bottom.addChild(bankBtn); bankBtn.x = 460; bankBtn.y = -140; /**** * Oyun Durum Değişkenleri ****/ var PLAYER = 0, NPC = 1; var scores = [0, 0], turnScore = 0, current = PLAYER, dice = [], gameOver = false; /**** * Yardımcı Fonksiyonlar ****/ // Zarlar ve seçili zarlar için pozisyonlar var dice = []; var selectedDiceIdx = []; var diceGroup = null; var selectedDiceGroup = null; // Zarları sıfırla ve rastgele ata, seçili zarları aşağıya indir function resetDice(n) { if (typeof n === "undefined") n = 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.selected = false; d.face.alpha = 1; d.setValue(1 + Math.floor(Math.random() * 6)); d.origX = d.x; d.origY = d.y; d.idx = i; d.down = function () { toggleSelect(this.idx); }; diceGroup.addChild(d); dice.push(d); } updateDicePositions(); updateHUD(); } // Zar seçimini aç/kapat, seçili zarları aşağıya indir/göster function toggleSelect(idx) { if (gameOver || current !== PLAYER) return; var d = dice[idx]; if (d.selected) { d.selected = false; var i = selectedDiceIdx.indexOf(idx); if (i !== -1) selectedDiceIdx.splice(i, 1); } else { d.selected = true; if (selectedDiceIdx.indexOf(idx) === -1) selectedDiceIdx.push(idx); } updateDicePositions(); updateHUD(); } // Zarların pozisyonunu güncelle (seçili olanlar aşağıda) function updateDicePositions() { if (!diceGroup || !selectedDiceGroup) return; diceGroup.removeChildren(); selectedDiceGroup.removeChildren(); var n = dice.length; var sel = selectedDiceIdx.slice(); var unsel = []; for (var i = 0; i < n; i++) { if (dice[i].selected) { selectedDiceGroup.addChild(dice[i]); } else { unsel.push(i); diceGroup.addChild(dice[i]); } } // Seçili zarlar aşağıda var selStartX = W / 2 - (sel.length - 1) * 220 / 2, selY = H / 2 + 250; for (var i = 0; i < sel.length; i++) { var d = dice[sel[i]]; d.x = selStartX + i * 220; d.y = selY; d.face.alpha = 0.6; } // Seçili olmayan zarlar ortada var unselStartX = W / 2 - (unsel.length - 1) * 220 / 2, unselY = H / 2; for (var i = 0; i < unsel.length; i++) { var d = dice[unsel[i]]; d.x = unselStartX + i * 220; d.y = unselY; d.face.alpha = 1; } } // Zarları tekrar at (sadece seçili olmayanlar), seçili zarları aşağıda bırak function rollAll() { if (gameOver || current !== PLAYER) return; // Sadece seçili olmayan zarları rastgele ata for (var i = 0; i < dice.length; i++) { if (!dice[i].selected) { dice[i].setValue(1 + Math.floor(Math.random() * 6)); } } // Seçili zarlar seçili kalır, pozisyonlar güncellenir updateDicePositions(); updateHUD(); // Bust kontrolü: kalan zarlarla hiçbir kombinasyon yapılamıyorsa tur biter var unselVals = dice.filter(function (d) { return !d.selected; }).map(function (d) { return d.value; }); var canScore = canMakeAnyScore(unselVals); if (!canScore) { LK.effects.flashScreen(0xff0000, 600); LK.setTimeout(function () { turnScore = 0; endTurn(); }, 700); } } // Seçili zar kombinasyonunun puanını hesapla (yeni kurallara göre) function calcScoreFarkle(selectedVals) { // Sıralı kopya var vals = selectedVals.slice().sort(); var cnt = Array(7).fill(0); vals.forEach(function (v) { cnt[v]++; }); var score = 0; var used = []; // Full straight 1-6 if (vals.length === 6 && [1, 2, 3, 4, 5, 6].every(function (v, i) { return vals[i] === v; })) { return { score: 1500, used: [0, 1, 2, 3, 4, 5] }; } // Partial straight 1-2-3-4-5 if (vals.length === 5 && [1, 2, 3, 4, 5].every(function (v) { return vals.indexOf(v) !== -1; })) { return { score: 500, used: [0, 1, 2, 3, 4] }; } // Partial straight 2-3-4-5-6 if (vals.length === 5 && [2, 3, 4, 5, 6].every(function (v) { return vals.indexOf(v) !== -1; })) { 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; if (cnt[v] === 3) score += base; if (cnt[v] === 4) score += base * 2; if (cnt[v] === 5) score += base * 4; if (cnt[v] === 6) score += base * 8; // Kullanılan indexleri ekle var need = cnt[v]; for (var i = 0; i < vals.length; i++) { if (vals[i] === v && need > 0) { used.push(i); need--; } } cnt[v] = 0; // Tekil sayılmasın } } // Tekil 1 ve 5'ler for (var i = 0; i < vals.length; i++) { if (used.indexOf(i) !== -1) continue; if (vals[i] === 1) { score += 100; used.push(i); } if (vals[i] === 5) { score += 50; used.push(i); } } // Sadece kullanılan indexler döndürülür return { score: score, used: used }; } // Seçili zar kombinasyonu yukarıdaki kurallardan birine uyuyor mu? function isValidSelection(selectedVals) { var res = calcScoreFarkle(selectedVals); // Seçili zarların tamamı skor kombinasyonunda kullanılmalı return res.score > 0 && res.used.length === selectedVals.length; } // Kalan zarlarla herhangi bir skor kombinasyonu yapılabiliyor mu? function canMakeAnyScore(vals) { if (vals.length === 0) return false; // Tüm alt kümeleri dene (1'den n'e kadar) for (var i = 1; i <= vals.length; i++) { var combs = getCombinations(vals, i); for (var j = 0; j < combs.length; j++) { if (isValidSelection(combs[j])) return true; } } return false; } // Alt kümeleri üret function getCombinations(arr, k) { var results = []; function helper(start, path) { if (path.length === k) { results.push(path.slice()); return; } for (var i = start; i < arr.length; i++) { path.push(arr[i]); helper(i + 1, path); path.pop(); } } helper(0, []); return results; } // TUT ve DEVAM ET (rollBtn) işlevi: seçili zarların puanını al, kalan zarları tekrar ata function keepAndContinue() { if (gameOver || current !== PLAYER) return; var selVals = selectedDiceIdx.map(function (idx) { return dice[idx].value; }); if (!isValidSelection(selVals)) return; var res = calcScoreFarkle(selVals); turnScore += res.score; // Seçili zarları çıkar var newDice = []; for (var i = 0; i < dice.length; i++) { var d = dice[i]; if (d && typeof d.selected !== "undefined" && !d.selected) { newDice.push(d); } else if (d) { d.destroy(); } } dice = newDice; selectedDiceIdx = []; // Hot dice: tüm zarlar seçildiyse 6 zarla tekrar başla if (dice.length === 0) { resetDice(6); } else { // Kalan zarları tekrar ata for (var i = 0; i < dice.length; i++) { dice[i].selected = false; dice[i].setValue(1 + Math.floor(Math.random() * 6)); } updateDicePositions(); } updateHUD(); // Bust kontrolü: kalan zarlarla hiçbir kombinasyon yapılamıyorsa tur biter var unselVals = dice.map(function (d) { return d.value; }); var canScore = canMakeAnyScore(unselVals); if (!canScore) { LK.effects.flashScreen(0xff0000, 600); LK.setTimeout(function () { turnScore = 0; endTurn(); }, 700); } } // TUT ve TURU SONLANDIR (bankBtn) işlevi: seçili zarların puanını al, turu bitir function keepAndEndTurn() { if (gameOver || current !== PLAYER) return; var selVals = selectedDiceIdx.map(function (idx) { return dice[idx].value; }); if (!isValidSelection(selVals)) return; var res = calcScoreFarkle(selVals); turnScore += res.score; // Seçili zarları çıkar var newDice = []; for (var i = 0; i < dice.length; i++) { var d = dice[i]; if (d && typeof d.selected !== "undefined" && !d.selected) { newDice.push(d); } else if (d) { d.destroy(); } } dice = newDice; selectedDiceIdx = []; updateHUD(); endTurn(); } // Tur sonu: puanları ekle, kazananı kontrol et, sırayı değiştir function endTurn() { scores[current] += turnScore; if (scores[current] >= 2000) { showWinner(); return; } current = current === PLAYER ? NPC : PLAYER; turnScore = 0; resetDice(6); updateHUD(); if (current === NPC) { LK.setTimeout(npcTurn, 800); } } // NPC hamlesi: otomatik oynar function npcTurn() { if (gameOver || current !== NPC) return; // NPC zarları atar for (var i = 0; i < dice.length; i++) { dice[i].selected = false; dice[i].setValue(1 + Math.floor(Math.random() * 6)); } updateDicePositions(); // NPC en yüksek puanlı kombinasyonu seçer var vals = dice.map(function (d) { return d.value; }); var bestScore = 0, bestSel = []; for (var i = 1; i <= vals.length; i++) { var combs = getCombinations(vals, i); for (var j = 0; j < combs.length; j++) { if (isValidSelection(combs[j])) { var res = calcScoreFarkle(combs[j]); if (res.score > bestScore) { bestScore = res.score; bestSel = combs[j]; } } } } if (bestScore === 0) { LK.effects.flashScreen(0xff0000, 600); LK.setTimeout(function () { turnScore = 0; endTurn(); }, 700); return; } // En iyi kombinasyonu seç for (var i = 0; i < dice.length; i++) { dice[i].selected = bestSel.indexOf(dice[i].value) !== -1; } updateDicePositions(); // NPC basit strateji: 400+ puan veya 1 zar kalınca turu bitirir, yoksa devam eder if (bestScore >= 400 || dice.length - bestSel.length <= 1) { var res = calcScoreFarkle(bestSel); turnScore += res.score; // Seçili zarları çıkar var newDice = []; for (var i = 0; i < dice.length; i++) { var d = dice[i]; if (d && typeof d.selected !== "undefined" && !d.selected) { newDice.push(d); } else if (d) { d.destroy(); } } dice = newDice; selectedDiceIdx = []; updateHUD(); endTurn(); } else { // Devam et: seçili zarları al, kalanları tekrar ata var res = calcScoreFarkle(bestSel); turnScore += res.score; var newDice = []; for (var i = 0; i < dice.length; i++) { var d = dice[i]; if (d && typeof d.selected !== "undefined" && !d.selected) { newDice.push(d); } else if (d) { d.destroy(); } } dice = newDice; selectedDiceIdx = []; // Hot dice: tüm zarlar seçildiyse 6 zarla tekrar başla if (dice.length === 0) { resetDice(6); } else { for (var i = 0; i < dice.length; i++) { dice[i].selected = false; dice[i].setValue(1 + Math.floor(Math.random() * 6)); } updateDicePositions(); } updateHUD(); // Bust kontrolü var unselVals = dice.map(function (d) { return d.value; }); var canScore = canMakeAnyScore(unselVals); if (!canScore) { LK.effects.flashScreen(0xff0000, 600); LK.setTimeout(function () { turnScore = 0; endTurn(); }, 700); return; } LK.setTimeout(npcTurn, 800); } } // HUD ve buton aktifliklerini güncelle function updateHUD() { // Buton isimleri rollTxt.setText('TUT ve DEVAM ET'); bankTxt.setText('TUT ve TURU SONLANDIR'); // Seçili zarlar var selVals = selectedDiceIdx.map(function (idx) { return dice[idx].value; }); var valid = isValidSelection(selVals); // Buton aktiflikleri rollBtn.alpha = valid ? 1 : 0.4; bankBtn.alpha = valid ? 1 : 0.4; rollBtn.interactive = valid && current === PLAYER && !gameOver; bankBtn.interactive = valid && current === PLAYER && !gameOver; // Skor yazısı örnek // scoreTxt.setText(`SEN: ${scores[PLAYER]} NPC: ${scores[NPC]} TUR: ${turnScore}`); // Skor ve tur göstergeleri if (!window.playerScoreTxt) { window.playerScoreTxt = new Text2('', { size: 70, fill: '#fff' }); window.playerScoreTxt.anchor.set(0, 0); LK.gui.top.addChild(window.playerScoreTxt); window.playerScoreTxt.x = 120; // avoid top left 100x100 window.playerScoreTxt.y = 10; } if (!window.npcScoreTxt) { window.npcScoreTxt = new Text2('', { size: 70, fill: '#fff' }); window.npcScoreTxt.anchor.set(1, 0); LK.gui.top.addChild(window.npcScoreTxt); window.npcScoreTxt.x = LK.gui.top.width - 120; window.npcScoreTxt.y = 10; } if (!window.turnTxt) { window.turnTxt = new Text2('', { size: 90, fill: '#ffe066', fontWeight: 'bold' }); window.turnTxt.anchor.set(0.5, 0); LK.gui.top.addChild(window.turnTxt); window.turnTxt.x = LK.gui.top.width / 2; window.turnTxt.y = 30; } // Update texts window.playerScoreTxt.setText("1. Oyuncu: ".concat(scores[PLAYER])); window.npcScoreTxt.setText("2. Oyuncu: ".concat(scores[NPC])); window.turnTxt.setText(current === PLAYER ? 'Sıra: 1. Oyuncu' : 'Sıra: 2. Oyuncu'); } function showWinner() { gameOver = true; LK.showYouWin(current === PLAYER ? 'Kazandın!' : 'NPC Kazandı!'); } /**** * BUTON OLAYLARI ****/ rollBtn.down = function () { keepAndContinue(); }; bankBtn.down = function () { keepAndEndTurn(); }; /**** * BAŞLAT ****/ function startGame() { scores = [0, 0]; turnScore = 0; current = PLAYER; gameOver = false; resetDice(6); updateHUD(); } startGame(); // GUI yeniden boyutlanınca skor ve tur yazılarını güncelle if (!window._frvr_gui_resize_hooked) { window._frvr_gui_resize_hooked = true; LK.on('resize', function () { if (window.npcScoreTxt) { window.npcScoreTxt.x = LK.gui.top.width - 120; } if (window.turnTxt) { window.turnTxt.x = LK.gui.top.width / 2; } }); }
===================================================================
--- original.js
+++ change.js
@@ -781,8 +781,44 @@
rollBtn.interactive = valid && current === PLAYER && !gameOver;
bankBtn.interactive = valid && current === PLAYER && !gameOver;
// Skor yazısı örnek
// scoreTxt.setText(`SEN: ${scores[PLAYER]} NPC: ${scores[NPC]} TUR: ${turnScore}`);
+ // Skor ve tur göstergeleri
+ if (!window.playerScoreTxt) {
+ window.playerScoreTxt = new Text2('', {
+ size: 70,
+ fill: '#fff'
+ });
+ window.playerScoreTxt.anchor.set(0, 0);
+ LK.gui.top.addChild(window.playerScoreTxt);
+ window.playerScoreTxt.x = 120; // avoid top left 100x100
+ window.playerScoreTxt.y = 10;
+ }
+ if (!window.npcScoreTxt) {
+ window.npcScoreTxt = new Text2('', {
+ size: 70,
+ fill: '#fff'
+ });
+ window.npcScoreTxt.anchor.set(1, 0);
+ LK.gui.top.addChild(window.npcScoreTxt);
+ window.npcScoreTxt.x = LK.gui.top.width - 120;
+ window.npcScoreTxt.y = 10;
+ }
+ if (!window.turnTxt) {
+ window.turnTxt = new Text2('', {
+ size: 90,
+ fill: '#ffe066',
+ fontWeight: 'bold'
+ });
+ window.turnTxt.anchor.set(0.5, 0);
+ LK.gui.top.addChild(window.turnTxt);
+ window.turnTxt.x = LK.gui.top.width / 2;
+ window.turnTxt.y = 30;
+ }
+ // Update texts
+ window.playerScoreTxt.setText("1. Oyuncu: ".concat(scores[PLAYER]));
+ window.npcScoreTxt.setText("2. Oyuncu: ".concat(scores[NPC]));
+ window.turnTxt.setText(current === PLAYER ? 'Sıra: 1. Oyuncu' : 'Sıra: 2. Oyuncu');
}
function showWinner() {
gameOver = true;
LK.showYouWin(current === PLAYER ? 'Kazandın!' : 'NPC Kazandı!');
@@ -806,5 +842,17 @@
gameOver = false;
resetDice(6);
updateHUD();
}
-startGame();
\ No newline at end of file
+startGame();
+// GUI yeniden boyutlanınca skor ve tur yazılarını güncelle
+if (!window._frvr_gui_resize_hooked) {
+ window._frvr_gui_resize_hooked = true;
+ LK.on('resize', function () {
+ if (window.npcScoreTxt) {
+ window.npcScoreTxt.x = LK.gui.top.width - 120;
+ }
+ if (window.turnTxt) {
+ window.turnTxt.x = LK.gui.top.width / 2;
+ }
+ });
+}
\ No newline at end of file
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