User prompt
en altta küçük bir yeşil daire olucak bi şifre yazılması gereken bir kısım gelecek şu yazılmalık 12345678900987654321tıkla1029384756 otomatik olarak 9999999 prit coin 9999999 altın kazanılır ↪💡 Aşağıdaki eklentileri içe aktarmayı ve kullanmayı ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
para -200e düşmeden kaybedilmez ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please fix the bug: 'printSellButtonText is not defined' in or related to this line: 'printSellButtonText.y = 700;' Line Number: 1689
User prompt
Please fix the bug: 'printSellButtonText is not defined' in or related to this line: 'printSellButtonText.y = 700;' Line Number: 1689
User prompt
print satın alda bi miktar belirlenir yanlarında max ve min tuşlarıda olur satarkende aynı şekilde borç al ve ödede max ve min tuşları çarkı çevirdede ↪💡 Consider importing and using the following plugins: @upit/storage.v1, @upit/tween.v1
User prompt
print coins satılabilir veya alınabilir değerinde risk alarak artma olasılığı %60 artma olasılığı artar ↪💡 Consider importing and using the following plugins: @upit/storage.v1, @upit/tween.v1
User prompt
sv3 kasa açılınca çark kaybolur bir grafik çıkar risk alarak risk coins değer değişimi sağlanır ve bu olmadan önce kasa çevirlir 20 risk coins 30 risk coins 40 risk coins 100 risk coins 200 risk coins 999999 risk coins ↪💡 Consider importing and using the following plugins: @upit/storage.v1, @upit/tween.v1
User prompt
altın bakiyesinin yanında prit sauısı yazıcak 3 sv kasa değer riski 10000 açılır ekranda bir değer grafiği raskele şekilde yukarı yeşil aşşağa kırmızı ilerleristenen değerde prit coinini satarak para alınır arttırmak için değerinin rasgele fiyat değerlenip değerlenmesi için arttırma 500 ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
User prompt
kasa açılırken normal çark kaybolur kasa çarkı oluşur kasa açılımı bitince normal çark geri gelir ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
2. sv kasa prit coins 1000 paraya çevrilir sonrasında şunlar gelebilir 50 print 100 print 200 print 500 print 800 print 1000 print bu çarkın üstünde bi çark daha dönücek üst üste gelenler çıkacak kısımda geldiğinde 2si alıncak üst katman 2ye katla 3e katla 4e katla 5e katla -4e katla -10a katla -2yee katla ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please fix the bug: 'Uncaught TypeError: storage.clear is not a function' in or related to this line: 'storage.clear();' Line Number: 1066 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
olmuyo sıfırlanmıyo,
User prompt
oyun yeniden başladığında borç etkenleri sıfırlanır
User prompt
para çantası özelliğini ve öncceki oyun butonunu kaldır
User prompt
kenara kasa sırala 1 lv kasa 250 para bu kasadan 10 altın 20 altın 30 altın 40 altın kaybetme 50 altın çıkar eyerr kasadan başarılı çıkarsa para ödülleri çekilebilir veya tkerar çevirebilir eyerki çekilirse kazanılan tüm parayla ayrılır çekilmesse ve kaybetme denk gelirse tüm çarktan çıkan ve ana bakiyeden -20 gider ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
para çantası şöyle çalışır sen hatalı yaptn para çantasına tıklayınca oraya koyulcak miktar girilir bu ana bakiyeden eksilir bir şifre belirleninr ve para çantası kapanır başka bir oynanışta para çantasına tıklayarak para çek seçeneği ile şifreyi girerek koyulan para alınabilir para çantasına tıklanırsa ana bakiye 0 olur ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
para çantası seçeneği bu seçeneği seçekrek seçilen miktarda para koyulabilir ve bakiyeden eksilir para koyulunca bi şifre belirler oyuncu sonra çanta kapanır ve sonrasında tekrar para koyulabilir ama şifre belirlendiyse değiştiremez taki şifreyi giri p açana kadar sonra tekrar kapatırsa tekrar şifre oluşturmalı para almak için o şifre girilmeli sonrasında başka bir oyunda oyun sıfırlandığında çantanın şifresini girerek önceki elden parayı o anki oyuna aktarılabilir ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please fix the bug: 'Uncaught TypeError: storage.clear is not a function' in or related to this line: 'storage.clear();' Line Number: 863 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
oyun her türlü yeniden başlayınca herşey sıfırlanır
User prompt
oyun tekrar başladığında borçta baştan başlar yani borç olmaz ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
borç alma seçeneği 10 ile 500 arası borç alınabilir borç alındıktan sonra 5 dakikalık bir geri sayım başlar 5 dakika içinde alınan borç geri ödenmezse oyun kaybedilir borç alındığında tekrar borç alınamaz istenen miktar ödenebilir mesela 50 para borç alındı 20 20 10 ödenebilir ↪💡 Consider importing and using the following plugins: @upit/storage.v1
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var VaultSlot = Container.expand(function (hasJackpot) {
var self = Container.call(this);
var slotGraphic = self.attachAsset('vaultSlot', {
anchorX: 0.5,
anchorY: 0.5
});
var slotText = new Text2(hasJackpot ? "8000 ALTIN!" : "BOŞ", {
size: 42,
fill: hasJackpot ? "#ffd700" : "#666666"
});
slotText.anchor.set(0.5, 0.5);
self.addChild(slotText);
self.hasJackpot = hasJackpot;
self.revealed = false;
self.down = function (x, y, obj) {
if (!self.revealed && vaultMode) {
self.revealed = true;
if (self.hasJackpot) {
playerGold += 8000;
addTransaction(8000, "Süper Kasa Jackpot");
LK.getSound('win').play();
showMessage("BÜYÜK İKRAMİYE! +8000 ALTIN!");
} else {
addTransaction(0, "Boş Kasa Slotu");
LK.getSound('lose').play();
showMessage("Boş slot!");
}
// Hide other vault slots after selection
for (var i = 0; i < vaultSlots.length; i++) {
if (vaultSlots[i] !== self) {
vaultSlots[i].visible = false;
}
}
// After selection, hide the vault and continue multi-spin
updateGoldDisplay();
LK.setTimeout(function () {
hideVault();
}, 1000);
}
};
return self;
});
var WheelSegment = Container.expand(function (segmentNumber, text, color) {
var self = Container.call(this);
var segmentGraphic = self.attachAsset('segment', {
anchorX: 0.5,
anchorY: 0.5
});
segmentGraphic.tint = color;
var segmentText = new Text2(text, {
size: 42,
fill: 0x000000
});
segmentText.anchor.set(0.5, 0.5);
self.addChild(segmentText);
self.segmentNumber = segmentNumber;
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x0f4c0f
});
/****
* Game Code
****/
var playerGold = 50;
var currentBet = 10;
var isSpinning = false;
var wheelRotation = 0;
var vaultMode = false;
var vaultRevealed = 0;
var multiSpinCount = 1;
var currentSpinNumber = 0;
var loanAmount = storage.loanAmount || 0;
var loanStartTime = storage.loanStartTime || 0;
var loanTimeRemaining = 0;
var loanTimerActive = false;
// Case system variables
var caseActive = false;
var caseWinnings = 0;
var caseSpinning = false;
var caseWheelRotation = 0;
var showingCaseResult = false;
// Case segments data (Level 1 case)
var caseSegments = [{
text: "10 ALTIN",
color: 0x90EE90,
outcome: "win10"
}, {
text: "20 ALTIN",
color: 0x87CEEB,
outcome: "win20"
}, {
text: "30 ALTIN",
color: 0xFFA500,
outcome: "win30"
}, {
text: "40 ALTIN",
color: 0x9932CC,
outcome: "win40"
}, {
text: "KAYBETTİN",
color: 0xFF0000,
outcome: "lose"
}, {
text: "50 ALTIN",
color: 0xFFD700,
outcome: "win50"
}];
// Wheel segments data
var segments = [{
text: "40 ALTIN\nKAZAN",
color: 0x90ee90,
outcome: "win40"
}, {
text: "İKİYE KATLA\nYA DA KAYBİM",
color: 0xffa500,
outcome: "doubleOrNothing"
}, {
text: "BAHİSİN\n2 KATI",
color: 0x87ceeb,
outcome: "doubleBet"
}, {
text: "BAHİSİNİ\nKAYBET",
color: 0xff6b6b,
outcome: "loseBet"
}, {
text: "SÜPER\nKASA",
color: 0xffd700,
outcome: "superVault"
}, {
text: "HACİZ\n-100 ALTIN",
color: 0x8b0000,
outcome: "bankruptcy"
}, {
text: "SIFIRLA\nHEPSİNİ",
color: 0x2f2f2f,
outcome: "reset"
}, {
text: "4 KATINA\nÇIKAR",
color: 0x9932cc,
outcome: "quadruple"
}];
// Create wheel
var wheelContainer = new Container();
wheelContainer.x = 1024;
wheelContainer.y = 900;
game.addChild(wheelContainer);
var wheelBase = wheelContainer.attachAsset('wheel', {
anchorX: 0.5,
anchorY: 0.5
});
// Create segments
var segmentContainers = [];
for (var i = 0; i < 8; i++) {
var angle = i * Math.PI * 2 / 8;
var segment = new WheelSegment(i, segments[i].text, segments[i].color);
segment.x = Math.cos(angle - Math.PI / 2) * 270;
segment.y = Math.sin(angle - Math.PI / 2) * 270;
segment.rotation = angle;
wheelContainer.addChild(segment);
segmentContainers.push(segment);
}
// Create wheel center
var wheelCenter = wheelContainer.attachAsset('wheelCenter', {
anchorX: 0.5,
anchorY: 0.5
});
// Create pointer
var pointer = game.attachAsset('pointer', {
anchorX: 0.5,
anchorY: 1.0,
x: 1024,
y: 650
});
// Create UI elements
var goldText = new Text2("Altın: 50", {
size: 80,
fill: 0xFFD700
});
goldText.anchor.set(0.5, 0);
goldText.x = 1024;
goldText.y = 50;
game.addChild(goldText);
var betText = new Text2("Bahis: 10", {
size: 70,
fill: 0xFFFFFF
});
betText.anchor.set(0.5, 0);
betText.x = 1024;
betText.y = 150;
game.addChild(betText);
var betDisplayText = new Text2("10", {
size: 120,
fill: 0xFFD700
});
betDisplayText.anchor.set(0.5, 0);
betDisplayText.x = 1024;
betDisplayText.y = 250;
game.addChild(betDisplayText);
var spinButton = game.attachAsset('spinButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1600
});
var spinButtonText = new Text2("ÇARKI ÇEVİR", {
size: 48,
fill: 0xFFFFFF
});
spinButtonText.anchor.set(0.5, 0.5);
spinButtonText.x = 1024;
spinButtonText.y = 1600;
game.addChild(spinButtonText);
// Multi-spin counter UI
var multiSpinCount = 1;
var multiSpinDisplay = new Text2("1", {
size: 60,
fill: 0xFFFFFF
});
multiSpinDisplay.anchor.set(0.5, 0.5);
multiSpinDisplay.x = 1024;
multiSpinDisplay.y = 1720;
game.addChild(multiSpinDisplay);
var multiSpinDownButton = game.attachAsset('betButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 900,
y: 1720
});
var multiSpinDownText = new Text2("-", {
size: 40,
fill: 0xFFFFFF
});
multiSpinDownText.anchor.set(0.5, 0.5);
multiSpinDownText.x = 900;
multiSpinDownText.y = 1720;
game.addChild(multiSpinDownText);
var multiSpinUpButton = game.attachAsset('betButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1148,
y: 1720
});
var multiSpinUpText = new Text2("+", {
size: 40,
fill: 0xFFFFFF
});
multiSpinUpText.anchor.set(0.5, 0.5);
multiSpinUpText.x = 1148;
multiSpinUpText.y = 1720;
game.addChild(multiSpinUpText);
// Bet adjustment buttons
var betUpButton = game.attachAsset('betButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 900,
y: 420
});
var betUpText = new Text2("+10", {
size: 40,
fill: 0xFFFFFF
});
betUpText.anchor.set(0.5, 0.5);
betUpText.x = 900;
betUpText.y = 420;
game.addChild(betUpText);
var betDownButton = game.attachAsset('betButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1148,
y: 420
});
var betDownText = new Text2("-10", {
size: 40,
fill: 0xFFFFFF
});
betDownText.anchor.set(0.5, 0.5);
betDownText.x = 1148;
betDownText.y = 420;
game.addChild(betDownText);
// Max bet button
var maxBetButton = game.attachAsset('betButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 800,
y: 520
});
var maxBetText = new Text2("MAX", {
size: 35,
fill: 0xFFFFFF
});
maxBetText.anchor.set(0.5, 0.5);
maxBetText.x = 800;
maxBetText.y = 520;
game.addChild(maxBetText);
// Min bet button
var minBetButton = game.attachAsset('betButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1248,
y: 520
});
var minBetText = new Text2("MIN", {
size: 35,
fill: 0xFFFFFF
});
minBetText.anchor.set(0.5, 0.5);
minBetText.x = 1248;
minBetText.y = 520;
game.addChild(minBetText);
// Loan button
var loanButton = game.attachAsset('spinButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 200,
y: 1900
});
var loanButtonText = new Text2("BORÇ AL", {
size: 48,
fill: 0xFFFFFF
});
loanButtonText.anchor.set(0.5, 0.5);
loanButtonText.x = 200;
loanButtonText.y = 1900;
game.addChild(loanButtonText);
// Loan amount input buttons
var loanAmountDisplay = new Text2("10", {
size: 60,
fill: 0xFFD700
});
loanAmountDisplay.anchor.set(0.5, 0.5);
loanAmountDisplay.x = 200;
loanAmountDisplay.y = 2000;
game.addChild(loanAmountDisplay);
var loanDownButton = game.attachAsset('betButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 100,
y: 2000
});
var loanDownText = new Text2("-", {
size: 40,
fill: 0xFFFFFF
});
loanDownText.anchor.set(0.5, 0.5);
loanDownText.x = 100;
loanDownText.y = 2000;
game.addChild(loanDownText);
var loanUpButton = game.attachAsset('betButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 300,
y: 2000
});
var loanUpText = new Text2("+", {
size: 40,
fill: 0xFFFFFF
});
loanUpText.anchor.set(0.5, 0.5);
loanUpText.x = 300;
loanUpText.y = 2000;
game.addChild(loanUpText);
// Loan repay button
var repayButton = game.attachAsset('spinButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 200,
y: 2100
});
var repayButtonText = new Text2("BORÇ ÖDE", {
size: 48,
fill: 0xFFFFFF
});
repayButtonText.anchor.set(0.5, 0.5);
repayButtonText.x = 200;
repayButtonText.y = 2100;
game.addChild(repayButtonText);
// Loan status display
var loanStatusText = new Text2("", {
size: 50,
fill: 0xFF4444
});
loanStatusText.anchor.set(0.5, 0.5);
loanStatusText.x = 200;
loanStatusText.y = 2200;
game.addChild(loanStatusText);
// Loan timer display
var loanTimerText = new Text2("", {
size: 45,
fill: 0xFFAA00
});
loanTimerText.anchor.set(0.5, 0.5);
loanTimerText.x = 200;
loanTimerText.y = 2250;
game.addChild(loanTimerText);
// Vault system variables
var vaultAmount = storage.vaultAmount || 0;
var vaultPassword = storage.vaultPassword || "";
var vaultIsOpen = false;
var vaultAmountToStore = 10;
var enteredPassword = "";
// Vault button
var vaultButton = game.attachAsset('spinButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1800,
y: 1900
});
var vaultButtonText = new Text2("PARA ÇANTASI", {
size: 48,
fill: 0xFFFFFF
});
vaultButtonText.anchor.set(0.5, 0.5);
vaultButtonText.x = 1800;
vaultButtonText.y = 1900;
game.addChild(vaultButtonText);
// Vault amount input display
var vaultAmountDisplay = new Text2("10", {
size: 60,
fill: 0xFFD700
});
vaultAmountDisplay.anchor.set(0.5, 0.5);
vaultAmountDisplay.x = 1800;
vaultAmountDisplay.y = 2000;
game.addChild(vaultAmountDisplay);
// Vault amount adjustment buttons
var vaultDownButton = game.attachAsset('betButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1700,
y: 2000
});
var vaultDownText = new Text2("-", {
size: 40,
fill: 0xFFFFFF
});
vaultDownText.anchor.set(0.5, 0.5);
vaultDownText.x = 1700;
vaultDownText.y = 2000;
game.addChild(vaultDownText);
var vaultUpButton = game.attachAsset('betButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1900,
y: 2000
});
var vaultUpText = new Text2("+", {
size: 40,
fill: 0xFFFFFF
});
vaultUpText.anchor.set(0.5, 0.5);
vaultUpText.x = 1900;
vaultUpText.y = 2000;
game.addChild(vaultUpText);
// Vault status display
var vaultStatusText = new Text2("", {
size: 50,
fill: 0x00FF00
});
vaultStatusText.anchor.set(0.5, 0.5);
vaultStatusText.x = 1800;
vaultStatusText.y = 2100;
game.addChild(vaultStatusText);
// Password display (hidden)
var passwordDisplay = new Text2("Şifre: ****", {
size: 40,
fill: 0xFFFFFF
});
passwordDisplay.anchor.set(0.5, 0.5);
passwordDisplay.x = 1800;
passwordDisplay.y = 2150;
passwordDisplay.visible = false;
game.addChild(passwordDisplay);
// Password buttons (0-9)
var passwordButtons = [];
for (var i = 0; i < 10; i++) {
var row = Math.floor(i / 3);
var col = i % 3;
if (i === 9) {
// Button 0 goes to bottom center
row = 3;
col = 1;
}
var button = game.attachAsset('betButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1700 + col * 100,
y: 2200 + row * 80
});
var buttonText = new Text2(i.toString(), {
size: 35,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
buttonText.x = 1700 + col * 100;
buttonText.y = 2200 + row * 80;
buttonText.visible = false;
game.addChild(buttonText);
button.visible = false;
button.digit = i;
passwordButtons.push({
button: button,
text: buttonText
});
}
// Password clear and confirm buttons
var clearPasswordButton = game.attachAsset('betButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1600,
y: 2440
});
var clearPasswordText = new Text2("TEMİZLE", {
size: 30,
fill: 0xFFFFFF
});
clearPasswordText.anchor.set(0.5, 0.5);
clearPasswordText.x = 1600;
clearPasswordText.y = 2440;
clearPasswordButton.visible = false;
clearPasswordText.visible = false;
game.addChild(clearPasswordText);
var confirmPasswordButton = game.attachAsset('betButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1900,
y: 2440
});
var confirmPasswordText = new Text2("ONAYLA", {
size: 30,
fill: 0xFFFFFF
});
confirmPasswordText.anchor.set(0.5, 0.5);
confirmPasswordText.x = 1900;
confirmPasswordText.y = 2440;
confirmPasswordButton.visible = false;
confirmPasswordText.visible = false;
game.addChild(confirmPasswordText);
// Message display
var messageText = new Text2("", {
size: 64,
fill: 0xFFFF00
});
messageText.anchor.set(0.5, 0.5);
messageText.x = 1024;
messageText.y = 1800;
game.addChild(messageText);
// Transaction history
var transactionHistory = [];
var historyContainer = new Container();
historyContainer.x = 100;
historyContainer.y = 400;
game.addChild(historyContainer);
var historyTitle = new Text2("İŞLEM GEÇMİŞİ:", {
size: 40,
fill: 0xFFFFFF
});
historyTitle.anchor.set(0, 0);
historyTitle.x = 0;
historyTitle.y = 0;
historyContainer.addChild(historyTitle);
// Vault slots (hidden initially)
var vaultSlots = [];
for (var i = 0; i < 4; i++) {
var hasJackpot = i === Math.floor(Math.random() * 4);
var slot = new VaultSlot(hasJackpot);
slot.x = 400 + i * 320;
slot.y = 1366;
slot.visible = false;
game.addChild(slot);
vaultSlots.push(slot);
}
var vaultTitle = new Text2("BİR KASA SLOT SEÇ:", {
size: 80,
fill: 0xFFD700
});
vaultTitle.anchor.set(0.5, 0.5);
vaultTitle.x = 1024;
vaultTitle.y = 1100;
vaultTitle.visible = false;
game.addChild(vaultTitle);
function addTransaction(amount, description) {
transactionHistory.unshift({
amount: amount,
description: description
});
if (transactionHistory.length > 8) {
transactionHistory.pop();
}
updateHistoryDisplay();
}
function updateHistoryDisplay() {
// Clear existing history texts
for (var i = historyContainer.children.length - 1; i > 0; i--) {
historyContainer.removeChild(historyContainer.children[i]);
}
// Add new history entries
for (var i = 0; i < transactionHistory.length; i++) {
var entry = transactionHistory[i];
var color = entry.amount >= 0 ? "#00FF00" : "#FF0000";
var sign = entry.amount >= 0 ? "+" : "";
var historyText = new Text2(sign + entry.amount + " - " + entry.description, {
size: 30,
fill: color
});
historyText.anchor.set(0, 0);
historyText.x = 0;
historyText.y = 50 + i * 35;
historyContainer.addChild(historyText);
}
}
function updateGoldDisplay() {
goldText.setText("Altın: " + playerGold);
betText.setText("Bahis: " + currentBet);
betDisplayText.setText(currentBet.toString());
// Check for jumpscare condition at -50 gold
if (playerGold <= -50) {
triggerJumpscare();
}
}
function showMessage(text) {
messageText.setText(text);
LK.setTimeout(function () {
messageText.setText("");
}, 3000);
}
function showVault() {
// Regenerate jackpot position first
for (var i = 0; i < vaultSlots.length; i++) {
vaultSlots[i].hasJackpot = false;
}
var jackpotIndex = Math.floor(Math.random() * 4);
vaultSlots[jackpotIndex].hasJackpot = true;
vaultTitle.visible = true;
for (var i = 0; i < vaultSlots.length; i++) {
vaultSlots[i].visible = true;
vaultSlots[i].revealed = false;
var slotText = vaultSlots[i].children[1];
slotText.setText(vaultSlots[i].hasJackpot ? "8000 ALTIN!" : "BOŞ");
slotText.visible = false;
}
}
function hideVault() {
vaultTitle.visible = false;
for (var i = 0; i < vaultSlots.length; i++) {
vaultSlots[i].visible = false;
}
vaultMode = false;
// Continue multi-spin sequence if still spinning
if (currentSpinNumber < multiSpinCount && isSpinning) {
LK.setTimeout(function () {
performSingleSpin();
}, 500);
} else {
isSpinning = false;
}
}
function spinWheel() {
if (isSpinning) return;
// Check if player has enough gold for all spins
var totalCost = currentBet * multiSpinCount;
if (playerGold < totalCost) {
showMessage("Yeterli altının yok!");
return;
}
// Deduct total cost upfront for all spins
playerGold -= totalCost;
addTransaction(-totalCost, "Toplam Bahis (" + multiSpinCount + "x)");
updateGoldDisplay();
isSpinning = true;
currentSpinNumber = 0;
performSingleSpin();
}
function performSingleSpin() {
LK.getSound('spin').play();
var spins = 8 + Math.random() * 6;
var finalAngle = Math.random() * Math.PI * 2;
var totalRotation = spins * Math.PI * 2 + finalAngle;
tween(wheelContainer, {
rotation: wheelContainer.rotation + totalRotation
}, {
duration: 8000,
easing: tween.easeOut,
onFinish: function onFinish() {
var segmentAngle = Math.PI * 2 / 8;
var normalizedAngle = (finalAngle + Math.PI / 2) % (Math.PI * 2);
var segmentIndex = Math.floor(normalizedAngle / segmentAngle);
segmentIndex = (8 - segmentIndex) % 8;
handleWheelResult(segmentIndex);
currentSpinNumber++;
// Continue multi-spin if not finished, vault mode will be handled separately
if (currentSpinNumber < multiSpinCount && !vaultMode) {
LK.setTimeout(function () {
performSingleSpin();
}, 500);
} else if (currentSpinNumber >= multiSpinCount) {
isSpinning = false;
}
}
});
}
function handleWheelResult(segmentIndex) {
var outcome = segments[segmentIndex].outcome;
switch (outcome) {
case "win40":
playerGold += 40;
addTransaction(40, "40 Altın Kazan");
LK.getSound('win').play();
showMessage("40 altın kazandın!");
break;
case "doubleOrNothing":
playerGold -= 10;
addTransaction(-10, "İkiye Katla Girişi");
updateGoldDisplay();
showMessage("İkiye katla ya da kaybım! Otomatik çevriliyor...");
LK.setTimeout(function () {
if (Math.random() < 0.5) {
playerGold += 40;
addTransaction(40, "İkiye Katla Kazandı");
LK.getSound('win').play();
showMessage("İkiye katla KAZANDIN! +40 altın!");
} else {
playerGold -= 20;
addTransaction(-20, "İkiye Katla Kaybetti");
LK.getSound('lose').play();
showMessage("İkiye katla KAYBETTİN! -20 altın!");
}
updateGoldDisplay();
}, 1000);
return;
case "doubleBet":
var winAmount = currentBet * 2;
playerGold += winAmount;
addTransaction(winAmount, "Bahis 2 Katı");
LK.getSound('win').play();
showMessage("Bahisin 2 katını kazandın! +" + winAmount + " altın!");
break;
case "loseBet":
addTransaction(0, "Bahis Kaybetti");
LK.getSound('lose').play();
showMessage("Bahsini kaybettin! -" + currentBet + " altın!");
break;
case "superVault":
vaultMode = true;
vaultRevealed = 0;
showVault();
showMessage("Bir kasa slot seç!");
break;
case "bankruptcy":
playerGold -= 100;
addTransaction(-100, "Haciz Cezası");
LK.getSound('lose').play();
showMessage("Haciz cezası! -100 altın!");
break;
case "reset":
var lostAmount = playerGold;
playerGold = 0;
addTransaction(-lostAmount, "Tümü Sıfırlandı");
LK.getSound('lose').play();
showMessage("Tüm paran sıfırlandı!");
break;
case "quadruple":
var oldGold = playerGold;
playerGold *= 4;
var gainAmount = playerGold - oldGold;
addTransaction(gainAmount, "4X Çarpan");
LK.getSound('win').play();
showMessage("4X ÇARPAN! Tüm paran 4 katına çıktı!");
break;
}
updateGoldDisplay();
}
// Event handlers
spinButton.down = function (x, y, obj) {
spinWheel();
};
betUpButton.down = function (x, y, obj) {
if (currentBet < 10000) {
currentBet += 10;
updateGoldDisplay();
}
};
betDownButton.down = function (x, y, obj) {
if (currentBet > 10) {
currentBet -= 10;
updateGoldDisplay();
}
};
multiSpinUpButton.down = function (x, y, obj) {
if (multiSpinCount < 50) {
multiSpinCount += 1;
multiSpinDisplay.setText(multiSpinCount.toString());
}
};
multiSpinDownButton.down = function (x, y, obj) {
if (multiSpinCount > 1) {
multiSpinCount -= 1;
multiSpinDisplay.setText(multiSpinCount.toString());
}
};
maxBetButton.down = function (x, y, obj) {
// Set bet to maximum affordable amount or 10000 (whichever is lower)
var maxAffordable = Math.floor(playerGold / multiSpinCount) * 10;
maxAffordable = Math.floor(maxAffordable / 10) * 10; // Round down to nearest 10
currentBet = Math.min(maxAffordable, 10000);
if (currentBet < 10) currentBet = 10;
updateGoldDisplay();
};
minBetButton.down = function (x, y, obj) {
currentBet = 10;
updateGoldDisplay();
};
var loanAmountToTake = 10;
loanAmountDisplay.setText(loanAmountToTake.toString());
loanButton.down = function (x, y, obj) {
takeLoan(loanAmountToTake);
};
loanUpButton.down = function (x, y, obj) {
if (loanAmountToTake < 500) {
loanAmountToTake += 10;
loanAmountDisplay.setText(loanAmountToTake.toString());
}
};
loanDownButton.down = function (x, y, obj) {
if (loanAmountToTake > 10) {
loanAmountToTake -= 10;
loanAmountDisplay.setText(loanAmountToTake.toString());
}
};
repayButton.down = function (x, y, obj) {
repayLoan(loanAmountToTake);
};
// Vault system event handlers
vaultButton.down = function (x, y, obj) {
if (vaultAmount > 0) {
// Vault has money, show withdraw option
showVaultOptions();
} else {
// Vault is empty, deposit money
depositToVault();
}
};
vaultUpButton.down = function (x, y, obj) {
if (vaultAmountToStore < 500) {
vaultAmountToStore += 10;
vaultAmountDisplay.setText(vaultAmountToStore.toString());
}
};
vaultDownButton.down = function (x, y, obj) {
if (vaultAmountToStore > 10) {
vaultAmountToStore -= 10;
vaultAmountDisplay.setText(vaultAmountToStore.toString());
}
};
// Password button event handlers
for (var i = 0; i < passwordButtons.length; i++) {
(function (digit) {
passwordButtons[digit].button.down = function (x, y, obj) {
if (enteredPassword.length < 4) {
enteredPassword += digit.toString();
updatePasswordDisplay();
}
};
})(i);
}
clearPasswordButton.down = function (x, y, obj) {
enteredPassword = "";
updatePasswordDisplay();
};
confirmPasswordButton.down = function (x, y, obj) {
confirmPassword();
};
function updateLoanDisplay() {
if (loanAmount > 0) {
loanStatusText.setText("Borç: " + loanAmount);
var currentTime = Date.now();
var timeElapsed = currentTime - loanStartTime;
var timeLeft = Math.max(0, 300000 - timeElapsed); // 5 minutes = 300000ms
if (timeLeft > 0) {
var minutes = Math.floor(timeLeft / 60000);
var seconds = Math.floor(timeLeft % 60000 / 1000);
loanTimerText.setText("Süre: " + minutes + ":" + (seconds < 10 ? "0" : "") + seconds);
loanTimeRemaining = timeLeft;
} else {
loanTimerText.setText("Süre Doldu!");
if (loanTimerActive) {
// Game over due to unpaid loan
showMessage("Borcu zamanında ödemedin! Oyun bitti!");
LK.setTimeout(function () {
LK.showGameOver();
}, 2000);
}
}
} else {
loanStatusText.setText("");
loanTimerText.setText("");
}
}
function takeLoan(amount) {
if (loanAmount > 0) {
showMessage("Zaten borcun var!");
return;
}
if (amount < 10 || amount > 500) {
showMessage("Borç miktarı 10-500 arası olmalı!");
return;
}
loanAmount = amount;
loanStartTime = Date.now();
loanTimerActive = true;
playerGold += amount;
// Save to storage
storage.loanAmount = loanAmount;
storage.loanStartTime = loanStartTime;
addTransaction(amount, "Borç Alındı");
updateGoldDisplay();
updateLoanDisplay();
showMessage(amount + " altın borç aldın! 5 dakikan var!");
}
function repayLoan(amount) {
// Initialize vault system
updateVaultDisplay();
if (loanAmount <= 0) {
showMessage("Borcun yok!");
return;
}
if (playerGold < amount) {
showMessage("Yeterli altının yok!");
return;
}
var repayAmount = Math.min(amount, loanAmount);
playerGold -= repayAmount;
loanAmount -= repayAmount;
// Save to storage
storage.loanAmount = loanAmount;
if (loanAmount <= 0) {
storage.loanStartTime = 0;
loanTimerActive = false;
}
addTransaction(-repayAmount, "Borç Ödendi");
updateGoldDisplay();
updateLoanDisplay();
if (loanAmount <= 0) {
showMessage("Tüm borcunu ödedin!");
} else {
showMessage(repayAmount + " altın ödendi! Kalan borç: " + loanAmount);
}
}
function updateVaultDisplay() {
if (vaultAmount > 0) {
vaultStatusText.setText("Çanta: " + vaultAmount + " altın");
vaultButtonText.setText("PARA ÇEK");
} else {
vaultStatusText.setText("Çanta boş");
vaultButtonText.setText("PARA ÇANTASI");
}
}
function showPasswordInput() {
passwordDisplay.visible = true;
clearPasswordButton.visible = true;
clearPasswordText.visible = true;
confirmPasswordButton.visible = true;
confirmPasswordText.visible = true;
for (var i = 0; i < passwordButtons.length; i++) {
passwordButtons[i].button.visible = true;
passwordButtons[i].text.visible = true;
}
updatePasswordDisplay();
}
function hidePasswordInput() {
passwordDisplay.visible = false;
clearPasswordButton.visible = false;
clearPasswordText.visible = false;
confirmPasswordButton.visible = false;
confirmPasswordText.visible = false;
for (var i = 0; i < passwordButtons.length; i++) {
passwordButtons[i].button.visible = false;
passwordButtons[i].text.visible = false;
}
}
function updatePasswordDisplay() {
var displayText = "Şifre: ";
for (var i = 0; i < enteredPassword.length; i++) {
displayText += "*";
}
passwordDisplay.setText(displayText);
}
function depositToVault() {
if (playerGold <= 0) {
showMessage("Hiç altının yok!");
return;
}
if (vaultPassword === "") {
// First time depositing, need to set password
// Use ALL current gold
vaultAmountToStore = playerGold;
enteredPassword = "";
showPasswordInput();
showMessage("Tüm altın çantaya gidecek. Yeni şifre belirle (4 haneli):");
vaultIsOpen = "setting_password";
} else {
// Vault already has password, show options
showVaultOptions();
}
}
function showVaultOptions() {
// Show withdraw option
enteredPassword = "";
showPasswordInput();
showMessage("Para çekmek için şifreyi gir:");
vaultIsOpen = "withdrawing";
}
function withdrawFromVault() {
if (vaultAmount <= 0) {
showMessage("Çanta boş!");
return;
}
if (vaultPassword === "") {
showMessage("Çantada şifre yok!");
return;
}
enteredPassword = "";
showPasswordInput();
showMessage("Şifreyi gir:");
vaultIsOpen = "withdrawing";
}
function startCaseGame() {
if (playerGold < 250) {
showMessage("Kasa için 250 altın gerekli!");
return;
}
playerGold -= 250;
addTransaction(-250, "Kasa LV1 Açıldı");
updateGoldDisplay();
caseActive = true;
caseWinnings = 0;
showingCaseResult = false;
// Show case wheel
caseWheelContainer.visible = true;
casePointer.visible = true;
caseWinningsText.visible = true;
updateCaseWinningsDisplay();
showMessage("Kasa açıldı! Çark otomatik olarak dönüyor...");
// Auto spin after 1 second
LK.setTimeout(function () {
spinCaseWheel();
}, 1000);
}
function spinCaseWheel() {
if (caseSpinning) return;
caseSpinning = true;
LK.getSound('spin').play();
var spins = 6 + Math.random() * 4;
var finalAngle = Math.random() * Math.PI * 2;
var totalRotation = spins * Math.PI * 2 + finalAngle;
tween(caseWheelContainer, {
rotation: caseWheelContainer.rotation + totalRotation
}, {
duration: 6000,
easing: tween.easeOut,
onFinish: function onFinish() {
var segmentAngle = Math.PI * 2 / 6;
var normalizedAngle = (finalAngle + Math.PI / 2) % (Math.PI * 2);
var segmentIndex = Math.floor(normalizedAngle / segmentAngle);
segmentIndex = (6 - segmentIndex) % 6;
handleCaseResult(segmentIndex);
caseSpinning = false;
}
});
}
function handleCaseResult(segmentIndex) {
var outcome = caseSegments[segmentIndex].outcome;
switch (outcome) {
case "win10":
caseWinnings += 10;
LK.getSound('win').play();
showMessage("Kasadan 10 altın kazandın!");
break;
case "win20":
caseWinnings += 20;
LK.getSound('win').play();
showMessage("Kasadan 20 altın kazandın!");
break;
case "win30":
caseWinnings += 30;
LK.getSound('win').play();
showMessage("Kasadan 30 altın kazandın!");
break;
case "win40":
caseWinnings += 40;
LK.getSound('win').play();
showMessage("Kasadan 40 altın kazandın!");
break;
case "win50":
caseWinnings += 50;
LK.getSound('win').play();
showMessage("Kasadan 50 altın kazandın!");
break;
case "lose":
LK.getSound('lose').play();
showMessage("Kaybettin! Tüm kasa kazançları ve -20 altın!");
// Lose all case winnings and -20 from main balance
playerGold -= 20;
addTransaction(-20, "Kasa Kaybı Cezası");
addTransaction(-caseWinnings, "Kasa Kazançları Kaybedildi");
caseWinnings = 0;
updateGoldDisplay();
// End case game
LK.setTimeout(function () {
endCaseGame();
}, 2000);
return;
}
updateCaseWinningsDisplay();
showingCaseResult = true;
// Show withdraw/continue options
LK.setTimeout(function () {
withdrawButton.visible = true;
withdrawButtonText.visible = true;
continueButton.visible = true;
continueButtonText.visible = true;
showMessage("Kazançları çek veya devam et!");
}, 2000);
}
function updateCaseWinningsDisplay() {
caseWinningsText.setText("Kasa Kazançları: " + caseWinnings);
}
function withdrawCaseWinnings() {
if (caseWinnings > 0) {
playerGold += caseWinnings;
addTransaction(caseWinnings, "Kasa Kazançları Çekildi");
showMessage("Tüm kazançlarınızla ayrıldınız! +" + caseWinnings + " altın!");
updateGoldDisplay();
}
endCaseGame();
}
function continueCaseGame() {
showingCaseResult = false;
withdrawButton.visible = false;
withdrawButtonText.visible = false;
continueButton.visible = false;
continueButtonText.visible = false;
showMessage("Devam ediyorsunuz! Çark tekrar dönüyor...");
// Auto spin after 1 second
LK.setTimeout(function () {
spinCaseWheel();
}, 1000);
}
function endCaseGame() {
caseActive = false;
caseWinnings = 0;
showingCaseResult = false;
// Hide case UI
caseWheelContainer.visible = false;
casePointer.visible = false;
caseWinningsText.visible = false;
withdrawButton.visible = false;
withdrawButtonText.visible = false;
continueButton.visible = false;
continueButtonText.visible = false;
// Reset case wheel rotation
caseWheelContainer.rotation = 0;
}
function transferVaultToGame() {
if (vaultAmount <= 0) {
showMessage("Çanta boş!");
return;
}
if (vaultPassword === "") {
showMessage("Çantada şifre yok!");
return;
}
enteredPassword = "";
showPasswordInput();
showMessage("Transfer için şifreyi gir:");
vaultIsOpen = "transferring";
}
function confirmPassword() {
if (enteredPassword.length !== 4) {
showMessage("Şifre 4 haneli olmalı!");
return;
}
if (vaultIsOpen === "setting_password") {
// Setting new password - use ALL player gold
vaultPassword = enteredPassword;
storage.vaultPassword = vaultPassword;
vaultAmount = playerGold; // Take all player gold
addTransaction(-playerGold, "Çantaya Tüm Para Yatırıldı");
playerGold = 0; // Player balance becomes 0
storage.vaultAmount = vaultAmount;
updateGoldDisplay();
updateVaultDisplay();
hidePasswordInput();
showMessage(vaultAmount + " altın çantaya yatırıldı ve şifre belirlendi!");
vaultIsOpen = false;
} else if (vaultIsOpen === "withdrawing") {
// Checking password for withdrawal
if (enteredPassword === vaultPassword) {
var withdrawAmount = vaultAmount; // Withdraw all money from vault
playerGold += withdrawAmount;
addTransaction(withdrawAmount, "Çantadan Para Alındı");
vaultAmount = 0;
vaultPassword = "";
storage.vaultAmount = 0;
storage.vaultPassword = "";
updateGoldDisplay();
updateVaultDisplay();
hidePasswordInput();
showMessage(withdrawAmount + " altın çantadan alındı! Çanta boşaldı, şifre sıfırlandı!");
vaultIsOpen = false;
} else {
showMessage("Yanlış şifre!");
enteredPassword = "";
updatePasswordDisplay();
}
} else if (vaultIsOpen === "transferring") {
// Checking password for transfer from previous game
if (enteredPassword === vaultPassword) {
playerGold += vaultAmount;
addTransaction(vaultAmount, "Önceki Oyundan Transfer");
var transferredAmount = vaultAmount;
vaultAmount = 0;
vaultPassword = "";
storage.vaultAmount = 0;
storage.vaultPassword = "";
updateGoldDisplay();
updateVaultDisplay();
hidePasswordInput();
showMessage("Önceki oyundan " + transferredAmount + " altın aktarıldı!");
vaultIsOpen = false;
} else {
showMessage("Yanlış şifre!");
enteredPassword = "";
updatePasswordDisplay();
}
}
}
function triggerJumpscare() {
// Create black overlay
var blackOverlay = game.attachAsset('segment', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0,
scaleX: 10,
scaleY: 30
});
blackOverlay.tint = 0x000000;
// Create spotlight effect (white circle)
var spotlight = game.attachAsset('wheel', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
scaleX: 0.5,
scaleY: 0.5
});
spotlight.tint = 0xffffff;
spotlight.alpha = 0.8;
// Create jumpscare man (red figure)
var jumpscareMan = game.attachAsset('segment', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
scaleX: 3,
scaleY: 8
});
jumpscareMan.tint = 0xff0000;
jumpscareMan.alpha = 0;
// Animate spotlight flickering
tween(spotlight, {
alpha: 0.3
}, {
duration: 200,
onFinish: function onFinish() {
tween(spotlight, {
alpha: 0.8
}, {
duration: 200,
onFinish: function onFinish() {
// Show jumpscare man suddenly
jumpscareMan.alpha = 1;
tween(jumpscareMan, {
scaleX: 5,
scaleY: 12
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
// End game after jumpscare
LK.setTimeout(function () {
LK.showGameOver();
}, 1000);
}
});
}
});
}
});
}
// Vault transfer button (for recovering money from previous games)
var transferButton = game.attachAsset('spinButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1800,
y: 2550
});
var transferButtonText = new Text2("ÖNCEKİ OYUN", {
size: 48,
fill: 0xFFFFFF
});
transferButtonText.anchor.set(0.5, 0.5);
transferButtonText.x = 1800;
transferButtonText.y = 2550;
game.addChild(transferButtonText);
// Case system UI
var caseButton = game.attachAsset('caseButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 200,
y: 700
});
var caseButtonText = new Text2("KASA LV1\n250 ALTIN", {
size: 36,
fill: 0xFFFFFF
});
caseButtonText.anchor.set(0.5, 0.5);
caseButtonText.x = 200;
caseButtonText.y = 700;
game.addChild(caseButtonText);
// Case wheel (hidden initially)
var caseWheelContainer = new Container();
caseWheelContainer.x = 1024;
caseWheelContainer.y = 1366;
caseWheelContainer.visible = false;
game.addChild(caseWheelContainer);
var caseWheelBase = caseWheelContainer.attachAsset('caseWheel', {
anchorX: 0.5,
anchorY: 0.5
});
// Create case segments
var caseSegmentContainers = [];
for (var i = 0; i < 6; i++) {
var angle = i * Math.PI * 2 / 6;
var segment = new Container();
var segmentGraphic = segment.attachAsset('caseSegment', {
anchorX: 0.5,
anchorY: 0.5
});
segmentGraphic.tint = caseSegments[i].color;
var segmentText = new Text2(caseSegments[i].text, {
size: 32,
fill: 0x000000
});
segmentText.anchor.set(0.5, 0.5);
segment.addChild(segmentText);
segment.x = Math.cos(angle - Math.PI / 2) * 200;
segment.y = Math.sin(angle - Math.PI / 2) * 200;
segment.rotation = angle;
caseWheelContainer.addChild(segment);
caseSegmentContainers.push(segment);
}
// Case wheel center
var caseWheelCenter = caseWheelContainer.attachAsset('wheelCenter', {
anchorX: 0.5,
anchorY: 0.5
});
// Case pointer
var casePointer = game.attachAsset('pointer', {
anchorX: 0.5,
anchorY: 1.0,
x: 1024,
y: 1100
});
casePointer.visible = false;
// Case winnings display
var caseWinningsText = new Text2("Kasa Kazançları: 0", {
size: 60,
fill: 0xFFD700
});
caseWinningsText.anchor.set(0.5, 0.5);
caseWinningsText.x = 1024;
caseWinningsText.y = 1500;
caseWinningsText.visible = false;
game.addChild(caseWinningsText);
// Withdraw and continue buttons (hidden initially)
var withdrawButton = game.attachAsset('withdrawButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 900,
y: 1600
});
withdrawButton.visible = false;
var withdrawButtonText = new Text2("ÇEK", {
size: 40,
fill: 0xFFFFFF
});
withdrawButtonText.anchor.set(0.5, 0.5);
withdrawButtonText.x = 900;
withdrawButtonText.y = 1600;
withdrawButtonText.visible = false;
game.addChild(withdrawButtonText);
var continueButton = game.attachAsset('continueButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1148,
y: 1600
});
continueButton.visible = false;
var continueButtonText = new Text2("DEVAM", {
size: 40,
fill: 0xFFFFFF
});
continueButtonText.anchor.set(0.5, 0.5);
continueButtonText.x = 1148;
continueButtonText.y = 1600;
continueButtonText.visible = false;
game.addChild(continueButtonText);
// Transfer button event handler
transferButton.down = function (x, y, obj) {
transferVaultToGame();
};
// Case system event handlers
caseButton.down = function (x, y, obj) {
if (!caseActive && !isSpinning) {
startCaseGame();
}
};
withdrawButton.down = function (x, y, obj) {
if (showingCaseResult) {
withdrawCaseWinnings();
}
};
continueButton.down = function (x, y, obj) {
if (showingCaseResult) {
continueCaseGame();
}
};
// Create surrender button
var surrenderButton = game.attachAsset('spinButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 2600
});
var surrenderButtonText = new Text2("TESLIM OL", {
size: 48,
fill: 0xFFFFFF
});
surrenderButtonText.anchor.set(0.5, 0.5);
surrenderButtonText.x = 1024;
surrenderButtonText.y = 2600;
game.addChild(surrenderButtonText);
// Surrender button event handler
surrenderButton.down = function (x, y, obj) {
// Reset game to initial state
playerGold = 50;
currentBet = 10;
isSpinning = false;
wheelRotation = 0;
vaultMode = false;
vaultRevealed = 0;
multiSpinCount = 1;
currentSpinNumber = 0;
// Reset loan system
loanAmount = 0;
loanStartTime = 0;
loanTimerActive = false;
loanAmountToTake = 10;
loanAmountDisplay.setText("10");
storage.loanAmount = 0;
storage.loanStartTime = 0;
// Clear all persistent storage data
storage.loanAmount = 0;
storage.loanStartTime = 0;
// Reset transaction history
transactionHistory = [];
updateHistoryDisplay();
// Update all displays
updateGoldDisplay();
updateLoanDisplay();
multiSpinDisplay.setText("1");
messageText.setText("");
hideVault();
// Reset case system
caseActive = false;
caseWinnings = 0;
caseSpinning = false;
showingCaseResult = false;
endCaseGame();
// Reset wheel rotation
wheelContainer.rotation = 0;
showMessage("Oyun yeniden başladı!");
};
// Initialize loan system
if (loanAmount > 0) {
loanTimerActive = true;
updateLoanDisplay();
}
// Initialize vault display
updateVaultDisplay();
game.update = function () {
// Update loan timer every frame
if (loanAmount > 0) {
updateLoanDisplay();
}
}; ===================================================================
--- original.js
+++ change.js
@@ -87,8 +87,40 @@
var loanAmount = storage.loanAmount || 0;
var loanStartTime = storage.loanStartTime || 0;
var loanTimeRemaining = 0;
var loanTimerActive = false;
+// Case system variables
+var caseActive = false;
+var caseWinnings = 0;
+var caseSpinning = false;
+var caseWheelRotation = 0;
+var showingCaseResult = false;
+// Case segments data (Level 1 case)
+var caseSegments = [{
+ text: "10 ALTIN",
+ color: 0x90EE90,
+ outcome: "win10"
+}, {
+ text: "20 ALTIN",
+ color: 0x87CEEB,
+ outcome: "win20"
+}, {
+ text: "30 ALTIN",
+ color: 0xFFA500,
+ outcome: "win30"
+}, {
+ text: "40 ALTIN",
+ color: 0x9932CC,
+ outcome: "win40"
+}, {
+ text: "KAYBETTİN",
+ color: 0xFF0000,
+ outcome: "lose"
+}, {
+ text: "50 ALTIN",
+ color: 0xFFD700,
+ outcome: "win50"
+}];
// Wheel segments data
var segments = [{
text: "40 ALTIN\nKAZAN",
color: 0x90ee90,
@@ -1005,8 +1037,145 @@
showPasswordInput();
showMessage("Şifreyi gir:");
vaultIsOpen = "withdrawing";
}
+function startCaseGame() {
+ if (playerGold < 250) {
+ showMessage("Kasa için 250 altın gerekli!");
+ return;
+ }
+ playerGold -= 250;
+ addTransaction(-250, "Kasa LV1 Açıldı");
+ updateGoldDisplay();
+ caseActive = true;
+ caseWinnings = 0;
+ showingCaseResult = false;
+ // Show case wheel
+ caseWheelContainer.visible = true;
+ casePointer.visible = true;
+ caseWinningsText.visible = true;
+ updateCaseWinningsDisplay();
+ showMessage("Kasa açıldı! Çark otomatik olarak dönüyor...");
+ // Auto spin after 1 second
+ LK.setTimeout(function () {
+ spinCaseWheel();
+ }, 1000);
+}
+function spinCaseWheel() {
+ if (caseSpinning) return;
+ caseSpinning = true;
+ LK.getSound('spin').play();
+ var spins = 6 + Math.random() * 4;
+ var finalAngle = Math.random() * Math.PI * 2;
+ var totalRotation = spins * Math.PI * 2 + finalAngle;
+ tween(caseWheelContainer, {
+ rotation: caseWheelContainer.rotation + totalRotation
+ }, {
+ duration: 6000,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ var segmentAngle = Math.PI * 2 / 6;
+ var normalizedAngle = (finalAngle + Math.PI / 2) % (Math.PI * 2);
+ var segmentIndex = Math.floor(normalizedAngle / segmentAngle);
+ segmentIndex = (6 - segmentIndex) % 6;
+ handleCaseResult(segmentIndex);
+ caseSpinning = false;
+ }
+ });
+}
+function handleCaseResult(segmentIndex) {
+ var outcome = caseSegments[segmentIndex].outcome;
+ switch (outcome) {
+ case "win10":
+ caseWinnings += 10;
+ LK.getSound('win').play();
+ showMessage("Kasadan 10 altın kazandın!");
+ break;
+ case "win20":
+ caseWinnings += 20;
+ LK.getSound('win').play();
+ showMessage("Kasadan 20 altın kazandın!");
+ break;
+ case "win30":
+ caseWinnings += 30;
+ LK.getSound('win').play();
+ showMessage("Kasadan 30 altın kazandın!");
+ break;
+ case "win40":
+ caseWinnings += 40;
+ LK.getSound('win').play();
+ showMessage("Kasadan 40 altın kazandın!");
+ break;
+ case "win50":
+ caseWinnings += 50;
+ LK.getSound('win').play();
+ showMessage("Kasadan 50 altın kazandın!");
+ break;
+ case "lose":
+ LK.getSound('lose').play();
+ showMessage("Kaybettin! Tüm kasa kazançları ve -20 altın!");
+ // Lose all case winnings and -20 from main balance
+ playerGold -= 20;
+ addTransaction(-20, "Kasa Kaybı Cezası");
+ addTransaction(-caseWinnings, "Kasa Kazançları Kaybedildi");
+ caseWinnings = 0;
+ updateGoldDisplay();
+ // End case game
+ LK.setTimeout(function () {
+ endCaseGame();
+ }, 2000);
+ return;
+ }
+ updateCaseWinningsDisplay();
+ showingCaseResult = true;
+ // Show withdraw/continue options
+ LK.setTimeout(function () {
+ withdrawButton.visible = true;
+ withdrawButtonText.visible = true;
+ continueButton.visible = true;
+ continueButtonText.visible = true;
+ showMessage("Kazançları çek veya devam et!");
+ }, 2000);
+}
+function updateCaseWinningsDisplay() {
+ caseWinningsText.setText("Kasa Kazançları: " + caseWinnings);
+}
+function withdrawCaseWinnings() {
+ if (caseWinnings > 0) {
+ playerGold += caseWinnings;
+ addTransaction(caseWinnings, "Kasa Kazançları Çekildi");
+ showMessage("Tüm kazançlarınızla ayrıldınız! +" + caseWinnings + " altın!");
+ updateGoldDisplay();
+ }
+ endCaseGame();
+}
+function continueCaseGame() {
+ showingCaseResult = false;
+ withdrawButton.visible = false;
+ withdrawButtonText.visible = false;
+ continueButton.visible = false;
+ continueButtonText.visible = false;
+ showMessage("Devam ediyorsunuz! Çark tekrar dönüyor...");
+ // Auto spin after 1 second
+ LK.setTimeout(function () {
+ spinCaseWheel();
+ }, 1000);
+}
+function endCaseGame() {
+ caseActive = false;
+ caseWinnings = 0;
+ showingCaseResult = false;
+ // Hide case UI
+ caseWheelContainer.visible = false;
+ casePointer.visible = false;
+ caseWinningsText.visible = false;
+ withdrawButton.visible = false;
+ withdrawButtonText.visible = false;
+ continueButton.visible = false;
+ continueButtonText.visible = false;
+ // Reset case wheel rotation
+ caseWheelContainer.rotation = 0;
+}
function transferVaultToGame() {
if (vaultAmount <= 0) {
showMessage("Çanta boş!");
return;
@@ -1158,12 +1327,131 @@
transferButtonText.anchor.set(0.5, 0.5);
transferButtonText.x = 1800;
transferButtonText.y = 2550;
game.addChild(transferButtonText);
+// Case system UI
+var caseButton = game.attachAsset('caseButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 200,
+ y: 700
+});
+var caseButtonText = new Text2("KASA LV1\n250 ALTIN", {
+ size: 36,
+ fill: 0xFFFFFF
+});
+caseButtonText.anchor.set(0.5, 0.5);
+caseButtonText.x = 200;
+caseButtonText.y = 700;
+game.addChild(caseButtonText);
+// Case wheel (hidden initially)
+var caseWheelContainer = new Container();
+caseWheelContainer.x = 1024;
+caseWheelContainer.y = 1366;
+caseWheelContainer.visible = false;
+game.addChild(caseWheelContainer);
+var caseWheelBase = caseWheelContainer.attachAsset('caseWheel', {
+ anchorX: 0.5,
+ anchorY: 0.5
+});
+// Create case segments
+var caseSegmentContainers = [];
+for (var i = 0; i < 6; i++) {
+ var angle = i * Math.PI * 2 / 6;
+ var segment = new Container();
+ var segmentGraphic = segment.attachAsset('caseSegment', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ segmentGraphic.tint = caseSegments[i].color;
+ var segmentText = new Text2(caseSegments[i].text, {
+ size: 32,
+ fill: 0x000000
+ });
+ segmentText.anchor.set(0.5, 0.5);
+ segment.addChild(segmentText);
+ segment.x = Math.cos(angle - Math.PI / 2) * 200;
+ segment.y = Math.sin(angle - Math.PI / 2) * 200;
+ segment.rotation = angle;
+ caseWheelContainer.addChild(segment);
+ caseSegmentContainers.push(segment);
+}
+// Case wheel center
+var caseWheelCenter = caseWheelContainer.attachAsset('wheelCenter', {
+ anchorX: 0.5,
+ anchorY: 0.5
+});
+// Case pointer
+var casePointer = game.attachAsset('pointer', {
+ anchorX: 0.5,
+ anchorY: 1.0,
+ x: 1024,
+ y: 1100
+});
+casePointer.visible = false;
+// Case winnings display
+var caseWinningsText = new Text2("Kasa Kazançları: 0", {
+ size: 60,
+ fill: 0xFFD700
+});
+caseWinningsText.anchor.set(0.5, 0.5);
+caseWinningsText.x = 1024;
+caseWinningsText.y = 1500;
+caseWinningsText.visible = false;
+game.addChild(caseWinningsText);
+// Withdraw and continue buttons (hidden initially)
+var withdrawButton = game.attachAsset('withdrawButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 900,
+ y: 1600
+});
+withdrawButton.visible = false;
+var withdrawButtonText = new Text2("ÇEK", {
+ size: 40,
+ fill: 0xFFFFFF
+});
+withdrawButtonText.anchor.set(0.5, 0.5);
+withdrawButtonText.x = 900;
+withdrawButtonText.y = 1600;
+withdrawButtonText.visible = false;
+game.addChild(withdrawButtonText);
+var continueButton = game.attachAsset('continueButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 1148,
+ y: 1600
+});
+continueButton.visible = false;
+var continueButtonText = new Text2("DEVAM", {
+ size: 40,
+ fill: 0xFFFFFF
+});
+continueButtonText.anchor.set(0.5, 0.5);
+continueButtonText.x = 1148;
+continueButtonText.y = 1600;
+continueButtonText.visible = false;
+game.addChild(continueButtonText);
// Transfer button event handler
transferButton.down = function (x, y, obj) {
transferVaultToGame();
};
+// Case system event handlers
+caseButton.down = function (x, y, obj) {
+ if (!caseActive && !isSpinning) {
+ startCaseGame();
+ }
+};
+withdrawButton.down = function (x, y, obj) {
+ if (showingCaseResult) {
+ withdrawCaseWinnings();
+ }
+};
+continueButton.down = function (x, y, obj) {
+ if (showingCaseResult) {
+ continueCaseGame();
+ }
+};
// Create surrender button
var surrenderButton = game.attachAsset('spinButton', {
anchorX: 0.5,
anchorY: 0.5,
@@ -1208,8 +1496,14 @@
updateLoanDisplay();
multiSpinDisplay.setText("1");
messageText.setText("");
hideVault();
+ // Reset case system
+ caseActive = false;
+ caseWinnings = 0;
+ caseSpinning = false;
+ showingCaseResult = false;
+ endCaseGame();
// Reset wheel rotation
wheelContainer.rotation = 0;
showMessage("Oyun yeniden başladı!");
};