User prompt
2x çarkı gelince alttaki ok yukarı çıksın arka planda kalmasın
User prompt
çarkta kazandın veya kaybettindeki arkadaki balonu kapat
User prompt
2x çarkı dönerken arka planı dokunulmaz yap
User prompt
ekranda çark dönerken arkadan kasa açılmasın
User prompt
ekrana farklı bir uyarı gelince arkadan open case yazısına basılıyor basılmasını engelle
User prompt
Please fix the bug: 'Uncaught ReferenceError: popupBg is not defined' in or related to this line: 'if (popupBg && popupBg.parent) {' Line Number: 714
User prompt
kaybettin yada kazandın yazısının arkasındaki baloncuğu kaldır
User prompt
çark yanlış şnsı düzgün değilş
User prompt
çarkın üstüne bir tane ok koy ondan ayrı olsun
User prompt
çarktan ayrı olsun ok
User prompt
çark dönmesi aşşağıya bir ok ekle o ddönsün ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
çarkı %45 şans olacak şekilde yeniden yap
User prompt
tam yuvarlak yap
User prompt
yuvarlak kısımdaki kırmızı yeşili pürüssüzleştir
User prompt
2x katla çarkındaki oku kaldır
User prompt
çarkın üstündeki oku kaldır
User prompt
yukardaki okta sabit olsun sadece çark dönsün ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
2x katla yazısını sabit yap o dönmesin
User prompt
çark dönmüyor artık
User prompt
çarkı çevir fakat çarktaki ok dönmesin
User prompt
çarka %45 oraanda doldur %45 gelirse 2x ver
User prompt
YUKARDAKİ çarkı kaldır
User prompt
BU ÇARKI 2X KATLAYA BASINCA GETİR
User prompt
çark ekle
User prompt
2X KATLAYA basınca birşey olmuyor
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ // CarouselSkin: a skin in the scrolling carousel var CarouselSkin = Container.expand(function () { var self = Container.call(this); self.skinData = null; self.asset = null; self.label = null; self.setSkin = function (skin) { self.skinData = skin; if (self.asset) self.removeChild(self.asset); self.asset = self.attachAsset(skin.asset, { anchorX: 0.5, anchorY: 0.5 }); if (self.label) self.removeChild(self.label); self.label = new Text2(skin.name, { size: 48, fill: RARITY_COLORS[skin.rarity] }); self.label.anchor.set(0.5, 0.5); self.label.y = 0; self.addChild(self.label); }; return self; }); // InventorySkin: a skin in the inventory grid var InventorySkin = Container.expand(function () { var self = Container.call(this); self.skinData = null; self.asset = null; self.label = null; self.setSkin = function (skin) { self.skinData = skin; if (self.asset) self.removeChild(self.asset); self.asset = self.attachAsset(skin.asset, { anchorX: 0.5, anchorY: 0.5, scaleX: 0.7, scaleY: 0.7 }); if (self.label) self.removeChild(self.label); self.label = new Text2(skin.name, { size: 32, fill: RARITY_COLORS[skin.rarity] }); self.label.anchor.set(0.5, 0.5); self.label.y = 60; self.addChild(self.label); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x181a20 }); /**** * Game Code ****/ // Arrow indicator asset (downward arrow, yellow) // Unique image assets for each skin (replace with your own images as needed) // Skin data: name, rarity, assetId /* We use simple shapes for cases and skins, and Text2 for labels. Each skin rarity gets a unique color. */ // Knife asset (replace id with your knife image asset id) // Mehmet Berat Zıvlak ultra rare skin asset var SKIN_POOL = [{ name: "Urban DDPAT", rarity: "common", asset: "skin_urban_ddpat" }, { name: "Sand Spray", rarity: "common", asset: "skin_sand_spray" }, { name: "Forest Leaves", rarity: "common", asset: "skin_forest_leaves" }, { name: "Jungle Tiger", rarity: "common", asset: "skin_jungle_tiger" }, { name: "Night Ops", rarity: "common", asset: "skin_night_ops" }, { name: "Blue Streak", rarity: "rare", asset: "skin_blue_streak" }, { name: "Redline", rarity: "rare", asset: "skin_redline" }, { name: "Firestarter", rarity: "rare", asset: "skin_firestarter" }, { name: "Ocean Foam", rarity: "rare", asset: "skin_ocean_foam" }, { name: "Hyper Beast", rarity: "mythic", asset: "skin_hyper_beast" }, { name: "Asiimov", rarity: "legendary", //{1c} // RED asset: "skin_asiimov" }, { name: "Neon Rider", rarity: "mythic", asset: "skin_neon_rider" }, { name: "Bloodsport", rarity: "mythic", asset: "skin_bloodsport" }, { name: "Dragon Lore", rarity: "ultra", //{1i} // GOLD asset: "skin_dragon_lore" }, { name: "Howl", rarity: "legendary", //{1k} // RED asset: "skin_howl" }, { name: "Medusa", rarity: "legendary", //{1m} // RED asset: "skin_medusa" }, { name: "Poseidon", rarity: "legendary", //{1o} // RED asset: "skin_poseidon" }, { name: "Gungnir", rarity: "ultra", //{1q} // GOLD asset: "skin_gungnir" }, { name: "The Prince", rarity: "ultra", //{1s} // GOLD asset: "skin_the_prince" }, { name: "Karambit Doppler", rarity: "knife", asset: "skin_knife" }, { name: "Mehmet Berat Zıvlak", rarity: "mehmet_berat_zivlak", asset: "skin_mehmet_berat_zivlak" }]; // Rarity weights for random selection // Reduce the weights for rarities where any skin price is over 200₺ // rare: 200₺ (keep as is), mythic: 250₺, legendary: 800₺, ultra: 2500₺, knife: 145000₺ var RARITY_WEIGHTS = { "common": 60, "rare": 10, // further reduced from 15 "mythic": 2, // further reduced from 4 "legendary": 0.5, // further reduced from 1.2 "ultra": 0.05, // further reduced from 0.2 "knife": 0.005, // further reduced from 0.01 "mehmet_berat_zivlak": 1 // 1% chance (relative to total, adjust as needed) }; // Rarity display colors var RARITY_COLORS = { "common": 0xCCCCCC, "rare": 0x4A90E2, "mythic": 0x9B59B6, "legendary": 0xF1C40F, "ultra": 0xFF3B3B, "knife": 0x00FFD0, // bright teal for knife, or pick a unique color "mehmet_berat_zivlak": 0xFF00FF // magenta for Mehmet Berat Zıvlak, or pick a unique color }; // Helper: get a random skin based on weights function getRandomSkin() { // First, build a list of all skins with their odds, based on the rarity weights // Count how many skins per rarity var rarityCounts = {}; for (var i = 0; i < SKIN_POOL.length; i++) { var rarity = SKIN_POOL[i].rarity; if (!rarityCounts[rarity]) rarityCounts[rarity] = 0; rarityCounts[rarity]++; } // Build a flat array of {skin, weight} var weightedSkins = []; for (var i = 0; i < SKIN_POOL.length; i++) { var skin = SKIN_POOL[i]; var rarity = skin.rarity; // Each skin gets a weight proportional to its rarity weight divided by number of skins of that rarity var weight = RARITY_WEIGHTS[rarity] / rarityCounts[rarity]; weightedSkins.push({ skin: skin, weight: weight }); } // Total weight var total = 0; for (var i = 0; i < weightedSkins.length; i++) { total += weightedSkins[i].weight; } var pick = Math.random() * total; var acc = 0; for (var i = 0; i < weightedSkins.length; i++) { acc += weightedSkins[i].weight; if (pick < acc) return weightedSkins[i].skin; } return SKIN_POOL[0]; } var caseNode = LK.getAsset('case', { anchorX: 0.5, anchorY: 0.5 }); caseNode.x = 2048 / 2; caseNode.y = 900; // moved higher up // Add the case node // "Open Case" button (Text2, acts as button) var openBtn = new Text2("OPEN CASE", { size: 90, fill: 0xFFFFFF }); openBtn.anchor.set(0.5, 0.5); openBtn.x = 2048 / 2; openBtn.y = 1850; // move button down to match new case position // Balance text (moved to top right) var balanceTxt = new Text2("Balance: 0₺", { size: 48, fill: 0xF1C40F }); balanceTxt.anchor.set(1, 0); // top right balanceTxt.x = 2048 - 40; balanceTxt.y = 40; // Add to game game.addChild(caseNode); // Carousel container (skin scroll area) var isOpening = false; var carouselSkins = []; var carouselContainer = new Container(); carouselContainer.x = 2048 / 2; // Add an arrow indicator asset (downward arrow) first, so we can position the carouselContainer right above it var arrowIndicator = LK.getAsset('arrow_indicator', { anchorX: 0.5, anchorY: 0, x: 2048 / 2, y: 1550 // moved further down }); game.addChild(arrowIndicator); // Move carouselContainer so its bottom is flush with the top of the arrow indicator carouselContainer.y = arrowIndicator.y - 220; // 220 is the height of the carousel area (skins) game.addChild(carouselContainer); // Optionally, adjust arrowIndicator.y if you want it to be a fixed distance below the case opening area game.addChild(openBtn); game.addChild(balanceTxt); // --- Skin Prompt UI --- // Removed skinPromptContainer and skinPromptBg as requested // Kasa açmadakiyle aynı popup ve animasyonu gösteren fonksiyon function showCaseOpenPopup(skin) { // Pop up effect: scale up winner skin var winnerNode = null; var minDist = 99999; for (var i = 0; i < carouselSkins.length; i++) { if (carouselSkins[i].skinData.name === skin.name) { var dist = Math.abs(carouselSkins[i].x); if (dist < minDist) { minDist = dist; winnerNode = carouselSkins[i]; } } } // Show a popup with the skin image, name, and "Close" button, and balance if (winnerNode) { if (typeof window.balance === "undefined") window.balance = 0; var sellPrices = { "common": 20, "rare": 200, "mythic": 250, "legendary": 800, "ultra": 2500, "knife": 145000, "mehmet_berat_zivlak": 99999999999 }; var sellAmount = sellPrices[skin.rarity] || 10; if (skin.name === "Redline") { sellAmount = 350; } var popupBg = new Container(); popupBg.x = 0; popupBg.y = 0; var bgRect = LK.getAsset('skin_prompt_bg', { anchorX: 0, anchorY: 0, x: 0, y: 0, width: 2048, height: 2732, color: 0x000000, scaleX: 2048 / 700, scaleY: 2732 / 220 }); popupBg.addChild(bgRect); popupBg.alpha = 0.85; game.addChild(popupBg); var popup = new Container(); popup.x = 2048 / 2; popup.y = 1200; var skinImg = LK.getAsset(skin.asset, { anchorX: 0.5, anchorY: 0.5, scaleX: 1.2, scaleY: 1.2 }); popup.addChild(skinImg); var skinLabel = new Text2(winnerNode.skinData.name, { size: 80, fill: RARITY_COLORS[winnerNode.skinData.rarity] }); skinLabel.anchor.set(0.5, 0); skinLabel.y = 120; popup.addChild(skinLabel); var soldLabel = new Text2("Otomatik satıldı +" + sellAmount + "₺", { size: 54, fill: 0x4A90E2 }); soldLabel.anchor.set(0.5, 0); soldLabel.y = 220; popup.addChild(soldLabel); var closeBtn = new Text2("Kapat", { size: 60, fill: 0x4A90E2 }); closeBtn.anchor.set(0.5, 0.5); closeBtn.x = 0; closeBtn.y = 400; popup.addChild(closeBtn); var balanceTxtPopup = new Text2("Balance: " + window.balance + "₺", { size: 44, fill: 0xFFFFFF }); balanceTxtPopup.anchor.set(0.5, 0.5); balanceTxtPopup.x = 0; balanceTxtPopup.y = 340; popup.addChild(balanceTxtPopup); if (typeof balanceTxt !== "undefined" && balanceTxt.setText) { balanceTxt.setText("Balance: " + window.balance + "₺"); } popup.scale.x = 0.1; popup.scale.y = 0.1; game.addChild(popup); tween(popup.scale, { x: 1, y: 1 }, { duration: 350, easing: tween.elasticOut, onFinish: function onFinish() { tween(popup.scale, { x: 1, y: 1 }, { duration: 200, easing: tween.linear }); } }); tween(winnerNode, { scaleX: 1.3, scaleY: 1.3 }, { duration: 350, easing: tween.elasticOut, onFinish: function onFinish() { tween(winnerNode, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.linear }); } }); isOpening = true; openBtn.setText("OPEN CASE"); closeBtn.down = function () { if (!closeBtn._balanceAdded) { window.balance += sellAmount; if (typeof balanceTxt !== "undefined" && balanceTxt.setText) { balanceTxt.setText("Balance: " + window.balance + "₺"); } if (typeof balanceTxtPopup !== "undefined" && balanceTxtPopup.setText) { balanceTxtPopup.setText("Balance: " + window.balance + "₺"); } closeBtn._balanceAdded = true; } if (popup.parent) popup.parent.removeChild(popup); if (popupBg && popupBg.parent) popupBg.parent.removeChild(popupBg); isOpening = false; openBtn.setText("OPEN CASE"); while (carouselContainer.children.length) carouselContainer.removeChild(carouselContainer.children[0]); carouselSkins = []; }; popup.down = function (x, y, obj) { if (!closeBtn._balanceAdded) { window.balance += sellAmount; if (typeof balanceTxt !== "undefined" && balanceTxt.setText) { balanceTxt.setText("Balance: " + window.balance + "₺"); } if (typeof balanceTxtPopup !== "undefined" && balanceTxtPopup.setText) { balanceTxtPopup.setText("Balance: " + window.balance + "₺"); } closeBtn._balanceAdded = true; } if (popup.parent) popup.parent.removeChild(popup); if (popupBg && popupBg.parent) popupBg.parent.removeChild(popupBg); isOpening = false; openBtn.setText("OPEN CASE"); while (carouselContainer.children.length) carouselContainer.removeChild(carouselContainer.children[0]); carouselSkins = []; }; } } // --- Functions --- // Start case opening animation function startCaseOpening() { if (isOpening) return; isOpening = true; // skinPromptContainer.visible = false; // removed, no longer exists openBtn.setText("OPENING..."); LK.getSound('case_open').play(); // Remove old carousel while (carouselContainer.children.length) carouselContainer.removeChild(carouselContainer.children[0]); carouselSkins = []; // Build carousel: 20 random skins, winner always lands in front of the arrow var winner = getRandomSkin(); var skins = []; var winnerPos = 10; // winner will always be at index 10 (centered in front of arrow) for (var i = 0; i < 20; i++) { if (i === winnerPos) { skins.push(winner); } else { // Random, but not always the winner var s; do { s = getRandomSkin(); } while (s.name === winner.name); skins.push(s); } } // Create skin nodes for (var j = 0; j < skins.length; j++) { var node = new CarouselSkin(); node.setSkin(skins[j]); node.x = (j - winnerPos) * 400; node.y = 0; carouselContainer.addChild(node); carouselSkins.push(node); } // Animate: scroll so the winner lands exactly in front of the arrow (center) // We'll spin the carousel several times before stopping at the winner var stopOffset = 0; // winnerPos is at center, so offset is 0 var spinDistance = 400 * 20 * 2; // 2 full spins (20 skins per spin, 400px per skin) var startX = 2048 / 2 + spinDistance; var endX = 2048 / 2 + stopOffset; var duration = 2200 + Math.random() * 400; // 2.2-2.6s // Reset to start position for animation carouselContainer.x = startX; // Animate with cubicOut for a nice deceleration tween(carouselContainer, { x: endX }, { duration: duration, easing: tween.cubicOut, onFinish: function onFinish() { LK.getSound('skin_land').play(); showUnboxedSkin(winner); } }); } // Show the unboxed skin, add to inventory, update UI function showUnboxedSkin(skin) { // Pop up effect: scale up winner skin var winnerNode = null; var minDist = 99999; for (var i = 0; i < carouselSkins.length; i++) { if (carouselSkins[i].skinData.name === skin.name) { var dist = Math.abs(carouselSkins[i].x); if (dist < minDist) { minDist = dist; winnerNode = carouselSkins[i]; } } } // Show a popup with the skin image, name, and "Close" button, and balance if (winnerNode) { // --- Otomatik satış işlemi --- if (typeof window.balance === "undefined") window.balance = 0; // Satış fiyatı: rarity'ye göre belirle var sellPrices = { "common": 20, "rare": 200, "mythic": 250, "legendary": 800, "ultra": 2500, "knife": 145000, "mehmet_berat_zivlak": 99999999999 // special price for Mehmet Berat Zıvlak }; var sellAmount = sellPrices[skin.rarity] || 10; if (skin.name === "Redline") { sellAmount = 350; } // Otomatik satma: 2x butonuna basılırsa, kazanç işlemi burada yapılmayacak, 2x sonucu beklenir var doubleAttempted = false; var doubleResultPending = false; var doubleResultWin = false; var doubleResultCallback = null; var doubleBaseAmount = sellAmount; var doubleSkin = skin; var doubleBalanceBefore = window.balance; // window.balance += sellAmount; // Otomatik ekleme kaldırıldı, popup ile eklenecek // Add a fullscreen black background behind the popup var popupBg = new Container(); popupBg.x = 0; popupBg.y = 0; // Use a shape as a black overlay var bgRect = LK.getAsset('skin_prompt_bg', { anchorX: 0, anchorY: 0, x: 0, y: 0, width: 2048, height: 2732, color: 0x000000, scaleX: 2048 / 700, scaleY: 2732 / 220 }); popupBg.addChild(bgRect); popupBg.alpha = 0.85; game.addChild(popupBg); var popup = new Container(); popup.x = 2048 / 2; popup.y = 1200; // Add skin asset image var skinImg = LK.getAsset(skin.asset, { anchorX: 0.5, anchorY: 0.5, scaleX: 1.2, scaleY: 1.2 }); popup.addChild(skinImg); // Add skin name label (always use winnerNode.skinData.name to ensure correct name) var skinLabel = new Text2(winnerNode.skinData.name, { size: 80, fill: RARITY_COLORS[winnerNode.skinData.rarity] }); skinLabel.anchor.set(0.5, 0); skinLabel.y = 120; popup.addChild(skinLabel); // --- Otomatik satış bildirimi --- // 2x popup açılırsa otomatik satıldı yazısı gösterme, sadece closeBtn ile ekle var soldLabel = new Text2("Otomatik satıldı +" + sellAmount + "₺", { size: 54, fill: 0x4A90E2 }); soldLabel.anchor.set(0.5, 0); soldLabel.y = 220; popup.addChild(soldLabel); // --- 2x Katla (Double) and Kapat (Close) Buttons --- var doubleBtn = new Text2("2x Katla", { size: 60, fill: 0x00FFD0 }); doubleBtn.anchor.set(0.5, 0.5); // Ortala ve popup'ın altına al doubleBtn.x = 0; doubleBtn.y = 500; popup.addChild(doubleBtn); var closeBtn = new Text2("Kapat", { size: 60, fill: 0x4A90E2 }); closeBtn.anchor.set(0.5, 0.5); // Ortala ve doubleBtn'ın hemen altına al closeBtn.x = 0; closeBtn.y = 600; popup.addChild(closeBtn); // Çark (Wheel) popup, hidden by default var wheelPopup = new Container(); wheelPopup.x = 2048 / 2; wheelPopup.y = 1200; wheelPopup.visible = false; // Wheel background var wheelBg = LK.getAsset('skin_prompt_icon', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, scaleX: 3.5, scaleY: 3.5, color: 0x222244 }); wheelPopup.addChild(wheelBg); // Wheel graphic (the spinning çark) var wheelAsset = LK.getAsset('skin_prompt_icon', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, scaleX: 2.5, scaleY: 2.5, color: 0xf1c40f }); wheelPopup.addChild(wheelAsset); // Çark label var wheelLabel = new Text2("Çark Çeviriliyor...", { size: 64, fill: 0xFFFFFF }); wheelLabel.anchor.set(0.5, 0.5); wheelLabel.y = -200; wheelPopup.addChild(wheelLabel); // Çark result label var wheelResultLabel = new Text2("", { size: 80, fill: 0xFFFFFF }); wheelResultLabel.anchor.set(0.5, 0.5); wheelResultLabel.y = 120; wheelPopup.addChild(wheelResultLabel); game.addChild(wheelPopup); // Çark spin animation helper wheelPopup.spinWheel = function (duration, _onFinish) { wheelAsset.rotation = 0; var totalRot = Math.PI * 8 + Math.random() * Math.PI * 2; // 4-5 full spins var start = { r: 0 }; var end = { r: totalRot }; tween(start, { r: totalRot }, { duration: duration, easing: tween.cubicOut, onUpdate: function onUpdate() { wheelAsset.rotation = start.r; }, onFinish: function onFinish() { wheelAsset.rotation = totalRot; if (_onFinish) _onFinish(); } }); }; // 2x Katla button logic doubleBtn.down = function (x, y, obj) { // Hide main popup if (popup.parent) popup.parent.removeChild(popup); if (popupBg && popupBg.parent) popupBg.parent.removeChild(popupBg); // Otomatik satma: 2x butonuna basıldı, önceki otomatik satış bakiyesini geri al window.balance -= doubleBaseAmount; if (typeof balanceTxt !== "undefined" && balanceTxt.setText) { balanceTxt.setText("Balance: " + window.balance + "₺"); } if (typeof balanceTxtPopup !== "undefined" && balanceTxtPopup.setText) { balanceTxtPopup.setText("Balance: " + window.balance + "₺"); } // Show main wheel with popup background var wheelPopupBg = new Container(); wheelPopupBg.x = 0; wheelPopupBg.y = 0; var bgRect = LK.getAsset('skin_prompt_bg', { anchorX: 0, anchorY: 0, x: 0, y: 0, width: 2048, height: 2732, color: 0x000000, scaleX: 2048 / 700, scaleY: 2732 / 220 }); wheelPopupBg.addChild(bgRect); wheelPopupBg.alpha = 0.85; game.addChild(wheelPopupBg); // Create wheel popup container var wheelDoublePopup = new Container(); wheelDoublePopup.x = 2048 / 2; wheelDoublePopup.y = 1366; // Wheel background circle var wheelBg = LK.getAsset('skin_prompt_icon', { anchorX: 0.5, anchorY: 0.5, scaleX: 3, scaleY: 3, color: 0x2c3e50 }); wheelDoublePopup.addChild(wheelBg); // Wheel sections (8 sections with different colors) var wheelSections = []; var sectionColors = [0xe74c3c, 0x3498db, 0x2ecc71, 0xf39c12, 0x9b59b6, 0x1abc9c, 0xe67e22, 0x34495e]; for (var i = 0; i < 8; i++) { var angle = Math.PI * 2 / 8 * i; var section = LK.getAsset('skin_prompt_icon', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.3, scaleY: 1.5, color: sectionColors[i], rotation: angle }); section.x = Math.cos(angle) * 120; section.y = Math.sin(angle) * 120; wheelDoublePopup.addChild(section); wheelSections.push(section); } // Wheel center var wheelCenter = LK.getAsset('skin_prompt_icon', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.8, color: 0xf1c40f }); wheelDoublePopup.addChild(wheelCenter); // Wheel pointer - add static arrow below wheel (not rotating with wheel) var wheelArrow = LK.getAsset('arrow_indicator', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 1366 + 150, scaleX: 0.8, scaleY: 0.8 }); // Wheel pointer - add static arrow above wheel (not rotating with wheel) var wheelArrowTop = LK.getAsset('arrow_indicator', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 1366 - 150, scaleX: 0.8, scaleY: -0.8, rotation: Math.PI }); // Add arrows after wheelDoublePopup so they are always in front game.addChild(wheelDoublePopup); game.addChild(wheelArrow); game.addChild(wheelArrowTop); // Title text - add to game instead of wheelDoublePopup so it doesn't rotate var wheelTitle = new Text2("2x Katla Çarkı", { size: 70, fill: 0xf1c40f }); wheelTitle.anchor.set(0.5, 0.5); wheelTitle.x = 2048 / 2; wheelTitle.y = 1066; // 1366 - 300 game.addChild(wheelTitle); game.addChild(wheelDoublePopup); // Çarkta %45'lik şansı doğru göster // 8 dilimde 3.6 dilim = %45, yani 3 tam dilim + 0.6 dilim // İlk 3 dilimi tamamen yeşil, 4. dilimi %60 yeşil yap for (var i = 0; i < 8; i++) { if (i < 3) { // İlk 3 dilim tamamen yeşil (kazanan) wheelSections[i].color = 0x52c483; // yumuşak yeşil if (wheelSections[i].tint !== undefined) wheelSections[i].tint = 0x52c483; } else if (i === 3) { // 4. dilim yarı yeşil yarı kırmızı (0.6 oranında yeşil) wheelSections[i].color = 0x52c483; // yumuşak yeşil if (wheelSections[i].tint !== undefined) wheelSections[i].tint = 0x52c483; } else { // Kalan dilimler kırmızı (kaybeden) wheelSections[i].color = 0xdc7063; // yumuşak kırmızı if (wheelSections[i].tint !== undefined) wheelSections[i].tint = 0xdc7063; } } // Kazanmayı belirle: önce çarkın hangi dilimde duracağını hesapla var randomAngle = Math.random() * Math.PI * 2; var totalRotation = Math.PI * 8 + randomAngle; var duration = 3000; // Çarkın durduğu açıya göre hangi dilimde olduğunu hesapla var finalAngle = (wheelDoublePopup.rotation + totalRotation) % (Math.PI * 2); if (finalAngle < 0) finalAngle += Math.PI * 2; var sectionIndex = Math.floor(finalAngle / (Math.PI * 2 / 8)); // Kazanma durumunu çarkın gerçek konumuna göre belirle var kazandin = false; if (sectionIndex < 3) { // İlk 3 dilim tamamen kazanan kazandin = true; } else if (sectionIndex === 3) { // 4. dilimde %60 şans ile kazanma (0.6 * 45% = 27% toplam şansın bir kısmı) kazandin = Math.random() < 0.6; } // Diğer dilimler tamamen kaybeden tween(wheelDoublePopup, { rotation: wheelDoublePopup.rotation + totalRotation }, { duration: duration, easing: tween.cubicOut, onFinish: function onFinish() { // Sonuç zaten yukarıda hesaplandı, sadece göster // Show result var resultText; var resultAmount; if (kazandin) { resultText = "Tebrikler! 2x kazandın!"; resultAmount = doubleBaseAmount * 2; window.balance += resultAmount; } else { resultText = "Kaybettin!"; resultAmount = 0; } // Update balance if (typeof balanceTxt !== "undefined" && balanceTxt.setText) { balanceTxt.setText("Balance: " + window.balance + "₺"); } // Show result popup var resultPopup = new Container(); resultPopup.x = 2048 / 2; resultPopup.y = 1200; var resultBg = LK.getAsset('skin_prompt_icon', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0, scaleX: 3, scaleY: 1.5, color: 0x222244 }); resultPopup.addChild(resultBg); var resultTextObj = new Text2(resultText + "\n" + (kazandin ? "+" + resultAmount + "₺" : "0₺"), { size: 70, fill: kazandin ? 0x00FFD0 : 0xff3b3b }); resultTextObj.anchor.set(0.5, 0.5); resultTextObj.y = 0; resultPopup.addChild(resultTextObj); var resultCloseBtn = new Text2("Kapat", { size: 60, fill: 0x4A90E2 }); resultCloseBtn.anchor.set(0.5, 0.5); resultCloseBtn.y = 120; resultPopup.addChild(resultCloseBtn); resultCloseBtn.down = function (x, y, obj) { if (resultPopup.parent) resultPopup.parent.removeChild(resultPopup); if (wheelDoublePopup.parent) wheelDoublePopup.parent.removeChild(wheelDoublePopup); if (wheelPopupBg && wheelPopupBg.parent) wheelPopupBg.parent.removeChild(wheelPopupBg); if (wheelTitle.parent) wheelTitle.parent.removeChild(wheelTitle); if (wheelArrow.parent) wheelArrow.parent.removeChild(wheelArrow); if (wheelArrowTop.parent) wheelArrowTop.parent.removeChild(wheelArrowTop); isOpening = false; openBtn.setText("OPEN CASE"); while (carouselContainer.children.length) carouselContainer.removeChild(carouselContainer.children[0]); carouselSkins = []; }; resultPopup.down = resultCloseBtn.down; game.addChild(resultPopup); } }); }; // Show current balance var balanceTxtPopup = new Text2("Balance: " + window.balance + "₺", { size: 44, fill: 0xFFFFFF }); balanceTxtPopup.anchor.set(0.5, 0.5); balanceTxtPopup.x = 0; balanceTxtPopup.y = 340; popup.addChild(balanceTxtPopup); // Ana ekrandaki balance'ı da güncelle if (typeof balanceTxt !== "undefined" && balanceTxt.setText) { balanceTxt.setText("Balance: " + window.balance + "₺"); } // Animate popup in popup.scale.x = 0.1; popup.scale.y = 0.1; game.addChild(popup); tween(popup.scale, { x: 1, y: 1 }, { duration: 350, easing: tween.elasticOut, onFinish: function onFinish() { tween(popup.scale, { x: 1, y: 1 }, { duration: 200, easing: tween.linear }); } }); // Animate winner node tween(winnerNode, { scaleX: 1.3, scaleY: 1.3 }, { duration: 350, easing: tween.elasticOut, onFinish: function onFinish() { tween(winnerNode, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.linear }); } }); // Pause opening until popup is closed isOpening = true; openBtn.setText("OPEN CASE"); // Sell button logic removed // Close button logic closeBtn.down = function () { // Bakiyeye ekle, tekrar eklenmesini engelle if (!closeBtn._balanceAdded) { window.balance += sellAmount; if (typeof balanceTxt !== "undefined" && balanceTxt.setText) { balanceTxt.setText("Balance: " + window.balance + "₺"); } if (typeof balanceTxtPopup !== "undefined" && balanceTxtPopup.setText) { balanceTxtPopup.setText("Balance: " + window.balance + "₺"); } closeBtn._balanceAdded = true; } if (popup.parent) popup.parent.removeChild(popup); if (popupBg && popupBg.parent) popupBg.parent.removeChild(popupBg); if (typeof wheelPopup !== "undefined" && wheelPopup.parent) wheelPopup.parent.removeChild(wheelPopup); isOpening = false; openBtn.setText("OPEN CASE"); while (carouselContainer.children.length) carouselContainer.removeChild(carouselContainer.children[0]); carouselSkins = []; }; // Also allow closing popup by tapping anywhere else on popup popup.down = function (x, y, obj) { // Bakiyeye ekle, tekrar eklenmesini engelle if (!closeBtn._balanceAdded) { window.balance += sellAmount; if (typeof balanceTxt !== "undefined" && balanceTxt.setText) { balanceTxt.setText("Balance: " + window.balance + "₺"); } if (typeof balanceTxtPopup !== "undefined" && balanceTxtPopup.setText) { balanceTxtPopup.setText("Balance: " + window.balance + "₺"); } closeBtn._balanceAdded = true; } if (popup.parent) popup.parent.removeChild(popup); if (popupBg && popupBg.parent) popupBg.parent.removeChild(popupBg); if (typeof wheelPopup !== "undefined" && wheelPopup.parent) wheelPopup.parent.removeChild(wheelPopup); isOpening = false; openBtn.setText("OPEN CASE"); while (carouselContainer.children.length) carouselContainer.removeChild(carouselContainer.children[0]); carouselSkins = []; }; } } // --- Event Handlers --- // Open case on tap openBtn.down = function (x, y, obj) { // Check if any popup is currently visible on screen var hasVisiblePopup = false; // Check for wheel popups and other popup containers for (var i = 0; i < game.children.length; i++) { var child = game.children[i]; if (child.constructor.name === 'Container' && child.children.length > 0) { // Check if this is a popup background (skin_prompt_bg asset) or wheel popup for (var j = 0; j < child.children.length; j++) { var grandchild = child.children[j]; // Check for popup backgrounds or wheel assets if (grandchild._texture && grandchild._texture.baseTexture || grandchild.width && grandchild.height && (grandchild.width > 1000 || grandchild.height > 1000)) { // This is likely a popup background or large popup element hasVisiblePopup = true; break; } } } if (hasVisiblePopup) break; } // Also check for any visible wheel titles, arrows, or result popups for (var i = 0; i < game.children.length; i++) { var child = game.children[i]; if (child.constructor.name === 'Text2' && child.visible !== false) { var text = child.text || ''; if (text.indexOf('Çark') !== -1 || text.indexOf('Tebrikler') !== -1 || text.indexOf('Kaybettin') !== -1) { hasVisiblePopup = true; break; } } } // Check for spinning wheel animations (tween in progress) for (var i = 0; i < game.children.length; i++) { var child = game.children[i]; if (child.constructor.name === 'Container') { // Check if this container has wheel sections (8 colored sections) var hasWheelSections = false; var sectionCount = 0; for (var j = 0; j < child.children.length; j++) { var grandchild = child.children[j]; if (grandchild.color !== undefined && (grandchild.color === 0x52c483 || grandchild.color === 0xdc7063 || grandchild.color === 0xe74c3c || grandchild.color === 0x3498db)) { sectionCount++; } } if (sectionCount >= 8) { hasVisiblePopup = true; break; } } } // Only allow case opening if no popups are visible and not currently opening if (!isOpening && !hasVisiblePopup) { startCaseOpening(); } }; // Prevent accidental tap on top left (menu area) caseNode.down = function (x, y, obj) { if (x < 100 && y < 100) return; }; // --- Initial UI --- // updateInventory removed // Move the 'bombardilo' text (game title) higher up on the screen // --- No update loop needed, all is event-driven ---;
===================================================================
--- original.js
+++ change.js
@@ -67,17 +67,17 @@
/****
* Game Code
****/
-// Mehmet Berat Zıvlak ultra rare skin asset
-// Knife asset (replace id with your knife image asset id)
+// Arrow indicator asset (downward arrow, yellow)
+// Unique image assets for each skin (replace with your own images as needed)
+// Skin data: name, rarity, assetId
/*
We use simple shapes for cases and skins, and Text2 for labels.
Each skin rarity gets a unique color.
*/
-// Skin data: name, rarity, assetId
-// Unique image assets for each skin (replace with your own images as needed)
-// Arrow indicator asset (downward arrow, yellow)
+// Knife asset (replace id with your knife image asset id)
+// Mehmet Berat Zıvlak ultra rare skin asset
var SKIN_POOL = [{
name: "Urban DDPAT",
rarity: "common",
asset: "skin_urban_ddpat"
@@ -754,9 +754,8 @@
y: 1366 + 150,
scaleX: 0.8,
scaleY: 0.8
});
- game.addChild(wheelArrow);
// Wheel pointer - add static arrow above wheel (not rotating with wheel)
var wheelArrowTop = LK.getAsset('arrow_indicator', {
anchorX: 0.5,
anchorY: 0.5,
@@ -765,8 +764,11 @@
scaleX: 0.8,
scaleY: -0.8,
rotation: Math.PI
});
+ // Add arrows after wheelDoublePopup so they are always in front
+ game.addChild(wheelDoublePopup);
+ game.addChild(wheelArrow);
game.addChild(wheelArrowTop);
// Title text - add to game instead of wheelDoublePopup so it doesn't rotate
var wheelTitle = new Text2("2x Katla Çarkı", {
size: 70,
Awp Asimov ekle ve görünüş karikatür olmasın oyundakiyle aynı olsun. In-Game asset. 2d. High contrast. No shadows
Cs2 deki ak 47 bloodsport skinini ekle. In-Game asset. 2d. High contrast. No shadows
Cs2 neon rider skinini ekle. In-Game asset. 2d. High contrast. No shadows
Ayakları olmasın ve altında bombardilo crocodilo case yazsın
triangle. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat