User prompt
Bet butonunu 3x küçült
User prompt
BET Textini Bolt yap, 5X büyüt ve Bet butonunun ortasına yerleştir.
User prompt
Bacground ekle ve assetlere eklediğinde değiştirelim. Sağ üst köseye logo ekle ve logo için assetlere alan ekle.
User prompt
Please fix the bug: 'TypeError: setTimeout is not a function' in or related to this line: 'setTimeout(function () {' Line Number: 267
Code edit (1 edits merged)
Please save this source code
User prompt
Ocean's Gamble
Initial prompt
1. 🧠 Game Logic: The game is played on a 5x5 grid (25 boxes total). The user starts by selecting a bet amount. Once the game starts, the system automatically opens a random unopened box every 3 seconds. Each opened box contains either: 🐠 A Fish (reward) 🐚 A Seashell (bomb equivalent; game over) 2. 🎨 Theme & Visuals: Theme: Underwater / Ocean Background: Coral reef or aquarium scene Symbols: Fish types (5 visually distinct fish): All have the same function/value; only the appearance differs. Examples: Clownfish, Blue Tang, Goldfish, Angelfish, Lionfish. Seashell (Bomb): If revealed, the game ends and the user loses their entire bet. 3. 🔁 Game Flow: Player selects a bet amount (e.g., 10, 20, 50 units). The system randomly places 1 to 5 seashells in the grid (number is random each round). Every 3 seconds, a new unopened box is automatically revealed. If a fish is revealed: Player survives Multiplier increases Game continues If a seashell is revealed: Game ends Player loses the bet The player can "Cash Out" at any time before hitting a seashell to secure current winnings. 4. 💰 RTP & Multiplier System: The game must maintain a 96% RTP (Return to Player) over time. Each successful fish reveal increases the multiplier (e.g., 1.1x, 1.3x, 1.6x, 2.0x, 2.6x, etc.). The multiplier values should be dynamically calculated based on the remaining unopened boxes and unrevealed seashells. Probability and rewards must be balanced using statistical simulation to ensure long-term RTP. 5. 📊 Technical Requirements: Grid size: 5x5 Randomly place 1–5 seashells per round System reveals one new box every 3 seconds UI must include: Bet selection Game status (live multiplier, number of safe boxes opened) Cashout button Grid with visual feedback on opened boxes (fish/seashell) Responsive UI (mobile and web-friendly) Visuals: Animations for opening boxes Sound effects for reveal events (fish/seashell) 🧪 Optional Enhancements: Add real-time game statistics (e.g., longest win streak, highest cashout) Include animated fish swimming across the grid The unopened boxes can resemble rocks or sand piles that reveal a fish or shell when clicked
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var BetButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('betButton', { anchorX: 0.5, anchorY: 0.5 }); self.betAmount = 0; self.betText = new Text2('BET', { size: 200, fill: 0xFFFFFF, font: "'GillSans-Bold',Impact,'Arial Black',Tahoma" }); self.betText.anchor.set(0.5, 0.5); self.addChild(self.betText); self.setBetAmount = function (amount) { self.betAmount = amount; self.betText.setText('BET'); }; self.down = function (x, y, obj) { if (gameState === 'betting') { startGame(); } }; return self; }); var CashOutButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('cashOutButton', { anchorX: 0.5, anchorY: 0.5 }); self.cashOutText = new Text2('Cash Out: $0.00', { size: 40, fill: 0x000000 }); self.cashOutText.anchor.set(0.5, 0.5); self.addChild(self.cashOutText); self.visible = false; self.updateAmount = function (amount) { self.cashOutText.setText('Cash Out: $' + amount.toFixed(2)); }; self.down = function (x, y, obj) { if (gameState === 'playing') { cashOut(); } }; return self; }); var GameBox = Container.expand(function () { var self = Container.call(this); var boxGraphics = self.attachAsset('gameBox', { anchorX: 0.5, anchorY: 0.5 }); self.isRevealed = false; self.content = null; // 'fish' or 'seashell' self.fishType = null; // 1-5 for fish types self.reveal = function () { if (self.isRevealed) return; self.isRevealed = true; if (self.content === 'seashell') { var seashell = self.attachAsset('seashell', { anchorX: 0.5, anchorY: 0.5 }); boxGraphics.tint = 0x8B4513; } else if (self.content === 'fish') { var fishAsset = 'fish' + self.fishType; var fish = self.attachAsset(fishAsset, { anchorX: 0.5, anchorY: 0.5 }); boxGraphics.tint = 0x90EE90; // Animate fish appearing fish.alpha = 0; tween(fish, { alpha: 1 }, { duration: 500 }); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x006994 }); /**** * Game Code ****/ // Add background var background = game.attachAsset('coralBackground', { anchorX: 0, anchorY: 0, x: 0, y: 0 }); // Game state var gameState = 'betting'; // 'betting', 'playing', 'ended' var boxes = []; var grid = []; var currentBet = 50; var currentMultiplier = 1.0; var revealedBoxes = 0; var totalSeashells = 0; var lastRevealTime = 0; var revealInterval = 3000; // 3 seconds var gameWinnings = 0; // Multiplier progression for balanced 96% RTP var multipliers = [1.1, 1.3, 1.6, 2.0, 2.6, 3.4, 4.5, 6.0, 8.0, 10.7, 14.3, 19.1, 25.5, 34.1, 45.5]; // UI Elements var betAmounts = [10, 25, 50, 100, 250]; var currentBetIndex = 2; // Create UI var titleText = new Text2("Ocean's Gamble", { size: 80, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0); titleText.x = 1024; titleText.y = 100; game.addChild(titleText); var betButton = game.addChild(new BetButton()); betButton.x = 1024; betButton.y = 2400; betButton.setBetAmount(currentBet); var cashOutButton = game.addChild(new CashOutButton()); cashOutButton.x = 1024; cashOutButton.y = 2300; var multiplierText = new Text2('Multiplier: 1.00x', { size: 60, fill: 0xFFFFFF }); multiplierText.anchor.set(0.5, 0.5); multiplierText.x = 1024; multiplierText.y = 300; game.addChild(multiplierText); var winningsText = new Text2('Winnings: $0.00', { size: 50, fill: 0xFFFFFF }); winningsText.anchor.set(0.5, 0.5); winningsText.x = 1024; winningsText.y = 400; game.addChild(winningsText); var statusText = new Text2('Select bet amount and start!', { size: 40, fill: 0xFFFF00 }); statusText.anchor.set(0.5, 0.5); statusText.x = 1024; statusText.y = 500; game.addChild(statusText); // Add logo to top right corner var logo = game.attachAsset('logo', { anchorX: 1, anchorY: 0 }); logo.x = 2048 - 50; // 50px margin from right edge logo.y = 50; // 50px margin from top edge game.addChild(logo); // Create 5x5 grid function createGrid() { boxes = []; var startX = 1024 - 4 * 200 / 2; // Center the grid var startY = 800; for (var row = 0; row < 5; row++) { for (var col = 0; col < 5; col++) { var box = new GameBox(); box.x = startX + col * 200; box.y = startY + row * 200; boxes.push(box); game.addChild(box); } } } // Initialize grid createGrid(); // Setup game content function setupGameContent() { // Random number of seashells (1-5) totalSeashells = Math.floor(Math.random() * 5) + 1; // Create array of positions var positions = []; for (var i = 0; i < 25; i++) { positions.push(i); } // Shuffle positions for (var i = positions.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = positions[i]; positions[i] = positions[j]; positions[j] = temp; } // Place seashells for (var i = 0; i < totalSeashells; i++) { boxes[positions[i]].content = 'seashell'; } // Place fish for (var i = totalSeashells; i < 25; i++) { boxes[positions[i]].content = 'fish'; boxes[positions[i]].fishType = Math.floor(Math.random() * 5) + 1; } } function startGame() { gameState = 'playing'; currentBet = betAmounts[currentBetIndex]; currentMultiplier = 1.0; revealedBoxes = 0; lastRevealTime = Date.now(); gameWinnings = currentBet; // Reset all boxes for (var i = 0; i < boxes.length; i++) { boxes[i].isRevealed = false; boxes[i].removeChildren(); var boxGraphics = boxes[i].attachAsset('gameBox', { anchorX: 0.5, anchorY: 0.5 }); } setupGameContent(); betButton.visible = false; cashOutButton.visible = true; cashOutButton.updateAmount(gameWinnings); statusText.setText('Game started! Cash out before hitting seashell!'); LK.playMusic('underwater'); } function revealNextBox() { var unrevealedBoxes = []; for (var i = 0; i < boxes.length; i++) { if (!boxes[i].isRevealed) { unrevealedBoxes.push(i); } } if (unrevealedBoxes.length === 0) { // All boxes revealed - player wins everything cashOut(); return; } // Pick random unrevealed box var randomIndex = Math.floor(Math.random() * unrevealedBoxes.length); var boxIndex = unrevealedBoxes[randomIndex]; var box = boxes[boxIndex]; box.reveal(); revealedBoxes++; if (box.content === 'seashell') { // Game over gameState = 'ended'; statusText.setText('Seashell revealed! You lost $' + currentBet); LK.getSound('seashell').play(); LK.setTimeout(function () { resetGame(); }, 3000); } else if (box.content === 'fish') { // Increase multiplier if (revealedBoxes <= multipliers.length) { currentMultiplier = multipliers[revealedBoxes - 1]; } else { currentMultiplier *= 1.5; // Continue scaling for longer games } gameWinnings = currentBet * currentMultiplier; multiplierText.setText('Multiplier: ' + currentMultiplier.toFixed(2) + 'x'); winningsText.setText('Winnings: $' + gameWinnings.toFixed(2)); cashOutButton.updateAmount(gameWinnings); statusText.setText('Fish found! Multiplier increased!'); LK.getSound('reveal').play(); } } function cashOut() { if (gameState !== 'playing') return; gameState = 'ended'; LK.setScore(LK.getScore() + Math.floor(gameWinnings - currentBet)); statusText.setText('Cashed out! Won $' + (gameWinnings - currentBet).toFixed(2)); LK.getSound('cashout').play(); LK.setTimeout(function () { resetGame(); }, 3000); } function resetGame() { gameState = 'betting'; betButton.visible = true; cashOutButton.visible = false; statusText.setText('Select bet amount and start!'); multiplierText.setText('Multiplier: 1.00x'); winningsText.setText('Winnings: $0.00'); // Reset visual state of all boxes for (var i = 0; i < boxes.length; i++) { boxes[i].isRevealed = false; boxes[i].removeChildren(); var boxGraphics = boxes[i].attachAsset('gameBox', { anchorX: 0.5, anchorY: 0.5 }); } LK.stopMusic(); } // Handle bet amount cycling game.down = function (x, y, obj) { if (gameState === 'betting' && y > 2350) { // Cycle through bet amounts currentBetIndex = (currentBetIndex + 1) % betAmounts.length; currentBet = betAmounts[currentBetIndex]; betButton.setBetAmount(currentBet); } }; game.update = function () { if (gameState === 'playing') { var currentTime = Date.now(); if (currentTime - lastRevealTime >= revealInterval) { revealNextBox(); lastRevealTime = currentTime; } } };
===================================================================
--- original.js
+++ change.js
A fantasy underwater scene in a dark deep ocean, illustrated in highly detailed fantasy art style. The background is a dark abyss with faint rays of light piercing from above, casting soft glows through the water. At the bottom of the scene, vibrant and colorful coral reefs in hues of red, purple, teal, and orange spread across the sea floor. Exotic fish swim gently among the coral. The entire scene is viewed with a cinematic wide angle. Shadows of sea creatures loom faintly in the background. The water has particles suspended, giving it a mysterious and immersive depth. Bioluminescent algae softly glow in some areas of the coral. The overall tone is mysterious yet magical. Black background base. Ideal for a 5x5 grid overlay. No text, pure environment. 4K ultra-detailed fantasy illustration.. In-Game asset. 2d. High contrast. No shadows