User prompt
2x katlaya basınca coinflip yap
User prompt
ortadaki çarkı 2 kez çevir
User prompt
ekrana kasa açmadaki aynı şeyi getir
User prompt
2x katladan 2x gelmezse parayı verme
User prompt
BİR Çark ekle dönsübn
User prompt
hala skin çıkar çıkmaz bakiyeye ekleniyo
User prompt
otomatik satma 2x butonuna bastıktan sonra kazanırsak 2x kaybedersek normal bakiye olarak eklensin
User prompt
2x katla butonunu ortala ve aşşağıya al
User prompt
2x katla butonuna basılmöıyor
User prompt
2x katla çalışmıyor
User prompt
%45 şans ile 2x bakiyeye eklensin bunu gösteren bir popup yap
User prompt
2x katlaya basınca ekrana bir çark gelsin %45 şansı olsun
User prompt
çıkan skini 2x katlamak için ekrana İki Katı Yada Kapat seçeneği ekle katla seçeneği seçilince %45 şansla çark çevir
User prompt
200 price üstü skinler hala çıkıyor ayarla daha az gelsin şansı düşür
User prompt
mehmet berat zıvlakın parasını 99999999999 yap
User prompt
kasaya %1 şanla çıkabilen adıda Mehmet Berat Zıvlak olsun asset olarakta ekle
User prompt
fiyatı 200 ü geçen her skinin şansını düşür
User prompt
skinin adını karambit doppler yap
User prompt
eklediğin nadir bıçağı asset olarak ekle kasayada ekle
User prompt
oyuna en nadir skin olarak bıçak ekle 145000 tl olsun
User prompt
yukardaki bombardilo yazısını kaldır
User prompt
farklı 2 3 tane market ekle hepsini farklı kodla yaz
User prompt
market hala çalışmıyor ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please fix the bug: 'Uncaught TypeError: storage.getItem is not a function' in or related to this line: 'var equipped = storage.getItem("equipped_skin");' Line Number: 195
User prompt
Please fix the bug: 'Uncaught TypeError: storage.get is not a function' in or related to this line: 'var equipped = storage.get("equipped_skin");' Line Number: 195
/****
* 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
****/
// Mehmet Berat Zıvlak ultra rare skin asset
// Knife asset (replace id with your knife image asset id)
/*
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)
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_bg', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0,
width: 700,
height: 700,
scaleX: 1.2,
scaleY: 1.2,
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, show wheel
if (popup.parent) popup.parent.removeChild(popup);
if (popupBg && popupBg.parent) popupBg.parent.removeChild(popupBg);
wheelPopup.visible = true;
wheelLabel.setText("Coinflip Yapılıyor...");
wheelResultLabel.setText("");
// Remove any previous close button from wheelPopup
for (var i = wheelPopup.children.length - 1; i >= 0; i--) {
var ch = wheelPopup.children[i];
if (ch && ch.setText && ch.setText.toString().indexOf("Kapat") !== -1) {
wheelPopup.removeChild(ch);
}
}
// 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 + "₺");
}
// Coinflip: 50% şans, yazı/tura animasyonu
var coinflipResult = Math.random() < 0.5 ? "Kazandın" : "Kaybettin";
var kazandin = coinflipResult === "Kazandın";
// Animasyon: coin döndürme efekti (wheelAsset'i kullan)
wheelAsset.rotation = 0;
var totalRot = Math.PI * 6 + Math.random() * Math.PI * 2; // 3-4 tam tur
var start = {
r: 0
};
var end = {
r: totalRot
};
tween(start, {
r: totalRot
}, {
duration: 1200,
easing: tween.cubicOut,
onUpdate: function onUpdate() {
wheelAsset.rotation = start.r;
},
onFinish: function onFinish() {
wheelAsset.rotation = totalRot;
// Sonucu göster
if (kazandin) {
wheelLabel.setText("Coinflip: Kazandın!");
wheelResultLabel.setText("+" + doubleBaseAmount * 2 + "₺");
window.balance += doubleBaseAmount * 2;
if (typeof balanceTxt !== "undefined" && balanceTxt.setText) {
balanceTxt.setText("Balance: " + window.balance + "₺");
}
if (typeof balanceTxtPopup !== "undefined" && balanceTxtPopup.setText) {
balanceTxtPopup.setText("Balance: " + window.balance + "₺");
}
// Show a popup for 2x kazanç
var doublePopup = new Container();
doublePopup.x = 2048 / 2;
doublePopup.y = 1200;
var doubleBg = LK.getAsset('skin_prompt_bg', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0,
width: 700,
height: 300,
scaleX: 1.2,
scaleY: 1.2,
color: 0x222244
});
doublePopup.addChild(doubleBg);
var doubleText = new Text2("Tebrikler! 2x kazandın\n+" + doubleBaseAmount * 2 + "₺", {
size: 70,
fill: 0x00FFD0
});
doubleText.anchor.set(0.5, 0.5);
doubleText.y = 0;
doublePopup.addChild(doubleText);
var doubleCloseBtn = new Text2("Kapat", {
size: 60,
fill: 0x4A90E2
});
doubleCloseBtn.anchor.set(0.5, 0.5);
doubleCloseBtn.y = 120;
doublePopup.addChild(doubleCloseBtn);
doubleCloseBtn.down = function (x, y, obj) {
if (doublePopup.parent) doublePopup.parent.removeChild(doublePopup);
if (wheelPopup && wheelPopup.parent) wheelPopup.parent.removeChild(wheelPopup);
isOpening = false;
openBtn.setText("OPEN CASE");
while (carouselContainer.children.length) carouselContainer.removeChild(carouselContainer.children[0]);
carouselSkins = [];
};
doublePopup.down = doubleCloseBtn.down;
game.addChild(doublePopup);
} else {
wheelLabel.setText("Coinflip: Kaybettin!");
wheelResultLabel.setText("0₺");
// Show Kapat button after result
var wheelCloseBtn = new Text2("Kapat", {
size: 60,
fill: 0x4A90E2
});
wheelCloseBtn.anchor.set(0.5, 0.5);
wheelCloseBtn.x = 0;
wheelCloseBtn.y = 260;
wheelPopup.addChild(wheelCloseBtn);
wheelCloseBtn.down = function (x, y, obj) {
if (wheelPopup && 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 wheel by tapping anywhere
wheelPopup.down = wheelCloseBtn.down;
}
}
});
};
// 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) {
if (!isOpening) 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
@@ -682,9 +682,9 @@
// Hide main popup, show wheel
if (popup.parent) popup.parent.removeChild(popup);
if (popupBg && popupBg.parent) popupBg.parent.removeChild(popupBg);
wheelPopup.visible = true;
- wheelLabel.setText("Çark Çeviriliyor...");
+ wheelLabel.setText("Coinflip Yapılıyor...");
wheelResultLabel.setText("");
// Remove any previous close button from wheelPopup
for (var i = wheelPopup.children.length - 1; i >= 0; i--) {
var ch = wheelPopup.children[i];
@@ -699,138 +699,105 @@
}
if (typeof balanceTxtPopup !== "undefined" && balanceTxtPopup.setText) {
balanceTxtPopup.setText("Balance: " + window.balance + "₺");
}
- // Spin the wheel 2 times in a row, only if both are won, give 2x, else 0₺
- var spinCount = 0;
- var winCount = 0;
- function spinWheelTwice() {
- spinCount = 0;
- winCount = 0;
- function spinOnce() {
- var wonDouble = Math.random() < 0.45;
- wheelPopup.spinWheel(1200, function () {
- spinCount++;
- if (wonDouble) {
- winCount++;
- // Show intermediate result for first spin
- if (spinCount === 1) {
- wheelLabel.setText("1. Çark: Kazandın!");
- wheelResultLabel.setText("+0₺");
- // Short pause before next spin
- tween(wheelPopup, {}, {
- duration: 600,
- onFinish: spinOnce
- });
- } else {
- // 2. spin, check if both won
- if (winCount === 2) {
- window.balance += doubleBaseAmount * 2;
- wheelLabel.setText("Tebrikler! 2x kazandın");
- wheelResultLabel.setText("+" + doubleBaseAmount * 2 + "₺");
- if (typeof balanceTxt !== "undefined" && balanceTxt.setText) {
- balanceTxt.setText("Balance: " + window.balance + "₺");
- }
- if (typeof balanceTxtPopup !== "undefined" && balanceTxtPopup.setText) {
- balanceTxtPopup.setText("Balance: " + window.balance + "₺");
- }
- // Show a popup for 2x kazanç
- var doublePopup = new Container();
- doublePopup.x = 2048 / 2;
- doublePopup.y = 1200;
- var doubleBg = LK.getAsset('skin_prompt_bg', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: 0,
- y: 0,
- width: 700,
- height: 300,
- scaleX: 1.2,
- scaleY: 1.2,
- color: 0x222244
- });
- doublePopup.addChild(doubleBg);
- var doubleText = new Text2("Tebrikler! 2x kazandın\n+" + doubleBaseAmount * 2 + "₺", {
- size: 70,
- fill: 0x00FFD0
- });
- doubleText.anchor.set(0.5, 0.5);
- doubleText.y = 0;
- doublePopup.addChild(doubleText);
- var doubleCloseBtn = new Text2("Kapat", {
- size: 60,
- fill: 0x4A90E2
- });
- doubleCloseBtn.anchor.set(0.5, 0.5);
- doubleCloseBtn.y = 120;
- doublePopup.addChild(doubleCloseBtn);
- doubleCloseBtn.down = function (x, y, obj) {
- if (doublePopup.parent) doublePopup.parent.removeChild(doublePopup);
- if (wheelPopup && wheelPopup.parent) wheelPopup.parent.removeChild(wheelPopup);
- isOpening = false;
- openBtn.setText("OPEN CASE");
- while (carouselContainer.children.length) carouselContainer.removeChild(carouselContainer.children[0]);
- carouselSkins = [];
- };
- doublePopup.down = doubleCloseBtn.down;
- game.addChild(doublePopup);
- } else {
- // 2. spin kaybetti
- wheelLabel.setText("2. Çark: Kaybettin!");
- wheelResultLabel.setText("0₺");
- // Show Kapat button after result
- var wheelCloseBtn = new Text2("Kapat", {
- size: 60,
- fill: 0x4A90E2
- });
- wheelCloseBtn.anchor.set(0.5, 0.5);
- wheelCloseBtn.x = 0;
- wheelCloseBtn.y = 260;
- wheelPopup.addChild(wheelCloseBtn);
- wheelCloseBtn.down = function (x, y, obj) {
- if (wheelPopup && 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 wheel by tapping anywhere
- wheelPopup.down = wheelCloseBtn.down;
- }
- }
- } else {
- // Kaybetti, hemen bitir
- if (spinCount === 1) {
- wheelLabel.setText("1. Çark: Kaybettin!");
- wheelResultLabel.setText("0₺");
- } else {
- wheelLabel.setText("2. Çark: Kaybettin!");
- wheelResultLabel.setText("0₺");
- }
- // Show Kapat button after result
- var wheelCloseBtn2 = new Text2("Kapat", {
- size: 60,
- fill: 0x4A90E2
- });
- wheelCloseBtn2.anchor.set(0.5, 0.5);
- wheelCloseBtn2.x = 0;
- wheelCloseBtn2.y = 260;
- wheelPopup.addChild(wheelCloseBtn2);
- wheelCloseBtn2.down = function (x, y, obj) {
- if (wheelPopup && 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 wheel by tapping anywhere
- wheelPopup.down = wheelCloseBtn2.down;
+ // Coinflip: 50% şans, yazı/tura animasyonu
+ var coinflipResult = Math.random() < 0.5 ? "Kazandın" : "Kaybettin";
+ var kazandin = coinflipResult === "Kazandın";
+ // Animasyon: coin döndürme efekti (wheelAsset'i kullan)
+ wheelAsset.rotation = 0;
+ var totalRot = Math.PI * 6 + Math.random() * Math.PI * 2; // 3-4 tam tur
+ var start = {
+ r: 0
+ };
+ var end = {
+ r: totalRot
+ };
+ tween(start, {
+ r: totalRot
+ }, {
+ duration: 1200,
+ easing: tween.cubicOut,
+ onUpdate: function onUpdate() {
+ wheelAsset.rotation = start.r;
+ },
+ onFinish: function onFinish() {
+ wheelAsset.rotation = totalRot;
+ // Sonucu göster
+ if (kazandin) {
+ wheelLabel.setText("Coinflip: Kazandın!");
+ wheelResultLabel.setText("+" + doubleBaseAmount * 2 + "₺");
+ window.balance += doubleBaseAmount * 2;
+ if (typeof balanceTxt !== "undefined" && balanceTxt.setText) {
+ balanceTxt.setText("Balance: " + window.balance + "₺");
}
- });
+ if (typeof balanceTxtPopup !== "undefined" && balanceTxtPopup.setText) {
+ balanceTxtPopup.setText("Balance: " + window.balance + "₺");
+ }
+ // Show a popup for 2x kazanç
+ var doublePopup = new Container();
+ doublePopup.x = 2048 / 2;
+ doublePopup.y = 1200;
+ var doubleBg = LK.getAsset('skin_prompt_bg', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 0,
+ y: 0,
+ width: 700,
+ height: 300,
+ scaleX: 1.2,
+ scaleY: 1.2,
+ color: 0x222244
+ });
+ doublePopup.addChild(doubleBg);
+ var doubleText = new Text2("Tebrikler! 2x kazandın\n+" + doubleBaseAmount * 2 + "₺", {
+ size: 70,
+ fill: 0x00FFD0
+ });
+ doubleText.anchor.set(0.5, 0.5);
+ doubleText.y = 0;
+ doublePopup.addChild(doubleText);
+ var doubleCloseBtn = new Text2("Kapat", {
+ size: 60,
+ fill: 0x4A90E2
+ });
+ doubleCloseBtn.anchor.set(0.5, 0.5);
+ doubleCloseBtn.y = 120;
+ doublePopup.addChild(doubleCloseBtn);
+ doubleCloseBtn.down = function (x, y, obj) {
+ if (doublePopup.parent) doublePopup.parent.removeChild(doublePopup);
+ if (wheelPopup && wheelPopup.parent) wheelPopup.parent.removeChild(wheelPopup);
+ isOpening = false;
+ openBtn.setText("OPEN CASE");
+ while (carouselContainer.children.length) carouselContainer.removeChild(carouselContainer.children[0]);
+ carouselSkins = [];
+ };
+ doublePopup.down = doubleCloseBtn.down;
+ game.addChild(doublePopup);
+ } else {
+ wheelLabel.setText("Coinflip: Kaybettin!");
+ wheelResultLabel.setText("0₺");
+ // Show Kapat button after result
+ var wheelCloseBtn = new Text2("Kapat", {
+ size: 60,
+ fill: 0x4A90E2
+ });
+ wheelCloseBtn.anchor.set(0.5, 0.5);
+ wheelCloseBtn.x = 0;
+ wheelCloseBtn.y = 260;
+ wheelPopup.addChild(wheelCloseBtn);
+ wheelCloseBtn.down = function (x, y, obj) {
+ if (wheelPopup && 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 wheel by tapping anywhere
+ wheelPopup.down = wheelCloseBtn.down;
+ }
}
- spinOnce();
- }
- spinWheelTwice();
+ });
};
// Show current balance
var balanceTxtPopup = new Text2("Balance: " + window.balance + "₺", {
size: 44,
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