User prompt
marketi açarken hata vermesin
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: 191
User prompt
marketi açılabilir yap ve oraya kasadan çıkmayan yeni skinler koy
User prompt
Please fix the bug: 'Uncaught TypeError: storage.get is not a function' in or related to this line: 'return storage.get("equipped_skin") || null;' Line Number: 170
User prompt
market ekle ordan parayla kostüm alına bilsin
User prompt
biraz daha aşşağı
User prompt
kasa açma yerini oka yapıştır
User prompt
ok işaretini kasa açma yerinin altına al
User prompt
bombardilo yazısını ve kasayı biraz yukarı kaldır
User prompt
ok işaretinin altına taşı açma yerini
User prompt
kasanın açıldığı yeri birazdaha aşşağıda aç
User prompt
onu aşşağıya al ve simgeyi değiştir asset olarak ekle
User prompt
ok işareti değil hala
User prompt
yukardaki noktayı okla değiştir
User prompt
redline nadir silah fakat 80 tl fiyatını arttır nadirliktekileri
User prompt
silahların fiyatını nadirliğe göre ayarla fiyatlar çok ucuz
User prompt
hep aynı şeyler çıkıyor şans oranlarını düzgün ayarla oyundaki skin şanslarına eşitle
User prompt
artık dönmüyor çark
User prompt
çark dönmüyor artık dönsün
User prompt
okun önüne gelen skin gelsin item olarak
User prompt
kasanın açıldığı yere 1 tane ok koy belli olsun çıkan item
User prompt
kasayı açtıktan sonra gelen itemin adı aynı değil
User prompt
Biraz daha aşşa al
User prompt
Close yazısını biraz daha sağ aşşa al çok az
User prompt
Çıkan item otomatik satılsın
/****
* 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
****/
// 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.
*/
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"
}];
// Rarity weights for random selection
var RARITY_WEIGHTS = {
"common": 60,
"rare": 25,
"mythic": 10,
"legendary": 4,
"ultra": 1
};
// Rarity display colors
var RARITY_COLORS = {
"common": 0xCCCCCC,
"rare": 0x4A90E2,
"mythic": 0x9B59B6,
"legendary": 0xF1C40F,
"ultra": 0xFF3B3B
};
// Helper: get a random skin based on weights
function getRandomSkin() {
var total = 0;
for (var i = 0; i < SKIN_POOL.length; i++) {
total += RARITY_WEIGHTS[SKIN_POOL[i].rarity];
}
var pick = Math.random() * total;
var acc = 0;
for (var j = 0; j < SKIN_POOL.length; j++) {
acc += RARITY_WEIGHTS[SKIN_POOL[j].rarity];
if (pick < acc) return SKIN_POOL[j];
}
return SKIN_POOL[0];
}
var caseNode = LK.getAsset('case', {
anchorX: 0.5,
anchorY: 0.5
});
caseNode.x = 2048 / 2;
caseNode.y = 900;
// Add an arrow indicator above the case to show where the unboxed item will land
var arrowIndicator = LK.getAsset('skin_prompt_icon', {
anchorX: 0.5,
anchorY: 1,
scaleX: 0.7,
scaleY: 0.7,
x: 2048 / 2,
y: caseNode.y - 220
});
game.addChild(arrowIndicator);
// "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 = 1550;
// 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);
game.addChild(openBtn);
game.addChild(balanceTxt);
// --- Skin Prompt UI ---
// Removed skinPromptContainer and skinPromptBg as requested
// --- State ---
var isOpening = false;
var carouselSkins = [];
var carouselContainer = new Container();
carouselContainer.x = 2048 / 2;
carouselContainer.y = 900;
game.addChild(carouselContainer);
// --- 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": 2,
"rare": 8,
"mythic": 25,
"legendary": 80,
"ultra": 250
};
var sellAmount = sellPrices[skin.rarity] || 1;
window.balance += sellAmount;
// 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 ---
var soldLabel = new Text2("Otomatik satıldı +" + sellAmount + "₺", {
size: 54,
fill: 0x4A90E2
});
soldLabel.anchor.set(0.5, 0);
soldLabel.y = 220;
popup.addChild(soldLabel);
// --- CLOSE BUTTON ---
var closeBtn = new Text2("CLOSE", {
size: 60,
fill: 0x4A90E2
});
closeBtn.anchor.set(0.5, 0.5);
closeBtn.x = 260;
closeBtn.y = 340;
popup.addChild(closeBtn);
// 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 () {
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 = [];
};
// Also allow closing popup by tapping anywhere else on popup
popup.down = function (x, y, obj) {
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 = [];
};
}
}
// --- 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
// --- No update loop needed, all is event-driven --- ===================================================================
--- original.js
+++ change.js
@@ -271,11 +271,11 @@
}
// 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 * 10 * 2; // 2 full spins (20 skins per spin, 400px per skin)
- var startX = carouselContainer.x;
- var endX = 2048 / 2 + stopOffset - spinDistance;
+ 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
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