/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // BingoCell: Represents a single cell on the bingo card var BingoCell = Container.expand(function () { var self = Container.call(this); // Properties self.number = 0; self.marked = false; // Create cell background var cellBg = self.attachAsset('bingoCellBg', { width: cellSize, height: cellSize, color: 0xffffff, shape: 'box', anchorX: 0.5, anchorY: 0.5 }); // Number text var numberText = new Text2('', { size: Math.floor(cellSize * 0.45), fill: 0x222222 }); numberText.anchor.set(0.5, 0.5); self.addChild(numberText); // Mark overlay (hidden by default) var markOverlay = self.attachAsset('bingoMark', { width: cellSize * 0.7, height: cellSize * 0.7, color: 0x4caf50, shape: 'ellipse', anchorX: 0.5, anchorY: 0.5 }); markOverlay.alpha = 0; self.markOverlay = markOverlay; // Set number and update text self.setNumber = function (num) { self.number = num; numberText.setText(num > 0 ? num : ''); }; // Mark/unmark cell self.setMarked = function (val) { self.marked = val; if (val) { tween(markOverlay, { alpha: 0.7 }, { duration: 200, easing: tween.easeOut }); numberText.setText(self.number); numberText.style.fill = "#ffffff"; } else { tween(markOverlay, { alpha: 0 }, { duration: 200, easing: tween.easeOut }); numberText.style.fill = "#222222"; } }; // Touch event self.down = function (x, y, obj) { if (self.marked) return; if (game.state !== 'playing') return; if (self.number === game.currentNumber) { self.setMarked(true); LK.effects.flashObject(self, 0x4caf50, 200); game.checkWin(); } else { LK.effects.flashObject(self, 0xff0000, 200); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a237e }); /**** * Game Code ****/ // --- Config --- var gridSize = 5; // 5x5 bingo var cellSize = 300; // px, will be scaled to fit var cardPadding = 30; var cardWidth = gridSize * cellSize; var cardHeight = gridSize * cellSize; var cardStartX = (2048 - cardWidth) / 2; var cardStartY = 400; var callIntervalStart = 2000; // ms var callIntervalMin = 800; // ms var callIntervalStep = 100; // ms, decrease per call var gameDuration = 60000; // ms (1 min) var numbersRange = 75; // 1-75 // --- State --- var bingoCells = []; var calledNumbers = []; var availableNumbers = []; var callTimer = null; var timeLeft = gameDuration; var timerInterval = null; var cardNumbers = []; var gameOver = false; // --- UI Elements --- var numberCallText = new Text2('', { size: 180, fill: 0xFFD600 }); numberCallText.anchor.set(0.5, 0.5); numberCallText.x = 2048 / 2; numberCallText.y = 220; game.addChild(numberCallText); var timerText = new Text2('', { size: 90, fill: 0xFFFFFF }); timerText.anchor.set(0.5, 0); LK.gui.top.addChild(timerText); var winText = new Text2('', { size: 120, fill: 0x4CAF50 }); winText.anchor.set(0.5, 0.5); winText.x = 2048 / 2; winText.y = 2732 / 2; winText.visible = false; game.addChild(winText); // --- Functions --- // Generate a random bingo card (5x5, center is free) function generateCardNumbers() { var nums = []; var used = []; for (var col = 0; col < gridSize; col++) { var colNums = []; var min = col * 15 + 1; var max = min + 14; for (var row = 0; row < gridSize; row++) { if (col === 2 && row === 2) { colNums.push(0); // Free space continue; } var n; do { n = min + Math.floor(Math.random() * (max - min + 1)); } while (used.indexOf(n) !== -1); used.push(n); colNums.push(n); } nums.push(colNums); } return nums; } // Create bingo card UI function createBingoCard() { bingoCells = []; cardNumbers = generateCardNumbers(); for (var col = 0; col < gridSize; col++) { for (var row = 0; row < gridSize; row++) { var cell = new BingoCell(); var x = cardStartX + col * cellSize + cellSize / 2; var y = cardStartY + row * cellSize + cellSize / 2; cell.x = x; cell.y = y; var num = cardNumbers[col][row]; cell.setNumber(num); if (col === 2 && row === 2) { cell.setMarked(true); // Free space } game.addChild(cell); bingoCells.push(cell); } } } // Start a new game function startGame() { game.state = 'playing'; gameOver = false; calledNumbers = []; availableNumbers = []; for (var i = 1; i <= numbersRange; i++) availableNumbers.push(i); createBingoCard(); numberCallText.setText(''); winText.visible = false; timeLeft = gameDuration; updateTimerText(); if (timerInterval) LK.clearInterval(timerInterval); timerInterval = LK.setInterval(function () { timeLeft -= 100; if (timeLeft < 0) timeLeft = 0; updateTimerText(); if (timeLeft <= 0 && !gameOver) { endGame(false); } }, 100); nextNumberCall(callIntervalStart); } // Call the next number game.currentNumber = null; function nextNumberCall(interval) { if (gameOver) return; if (availableNumbers.length === 0) { endGame(false); return; } var idx = Math.floor(Math.random() * availableNumbers.length); var num = availableNumbers[idx]; availableNumbers.splice(idx, 1); calledNumbers.push(num); game.currentNumber = num; numberCallText.setText(num); LK.effects.flashObject(numberCallText, 0xffd600, 300); // Speed up calls as game progresses var nextInterval = Math.max(callIntervalMin, interval - callIntervalStep); if (callTimer) LK.clearTimeout(callTimer); callTimer = LK.setTimeout(function () { nextNumberCall(nextInterval); }, nextInterval); } // Update timer UI function updateTimerText() { var sec = Math.ceil(timeLeft / 1000); timerText.setText("Time: " + sec + "s"); } // Check for win (row, col, diag) game.checkWin = function () { // Build marked grid var marked = []; for (var col = 0; col < gridSize; col++) { marked[col] = []; for (var row = 0; row < gridSize; row++) { var idx = col * gridSize + row; marked[col][row] = bingoCells[idx].marked; } } // Check rows for (var row = 0; row < gridSize; row++) { var win = true; for (var col = 0; col < gridSize; col++) { if (!marked[col][row]) win = false; } if (win) return endGame(true); } // Check cols for (var col = 0; col < gridSize; col++) { var win = true; for (var row = 0; row < gridSize; row++) { if (!marked[col][row]) win = false; } if (win) return endGame(true); } // Check diag TL-BR var win = true; for (var i = 0; i < gridSize; i++) { if (!marked[i][i]) win = false; } if (win) return endGame(true); // Check diag TR-BL win = true; for (var i = 0; i < gridSize; i++) { if (!marked[gridSize - 1 - i][i]) win = false; } if (win) return endGame(true); }; // End game: win or lose function endGame(won) { gameOver = true; game.state = 'ended'; if (callTimer) LK.clearTimeout(callTimer); if (timerInterval) LK.clearInterval(timerInterval); if (won) { winText.setText("BINGO!\nYou Win!"); winText.style.fill = "#4caf50"; LK.effects.flashScreen(0x4caf50, 1000); LK.showYouWin(); } else { winText.setText("Time's Up!\nGame Over"); winText.style.fill = "#ff1744"; LK.effects.flashScreen(0xff1744, 1000); LK.showGameOver(); } winText.visible = true; } // --- Input: Restart on game over/win --- game.down = function (x, y, obj) { if (game.state === 'ended') { // Wait for LK to reset game } }; // --- Start --- startGame();
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,302 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+// BingoCell: Represents a single cell on the bingo card
+var BingoCell = Container.expand(function () {
+ var self = Container.call(this);
+ // Properties
+ self.number = 0;
+ self.marked = false;
+ // Create cell background
+ var cellBg = self.attachAsset('bingoCellBg', {
+ width: cellSize,
+ height: cellSize,
+ color: 0xffffff,
+ shape: 'box',
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Number text
+ var numberText = new Text2('', {
+ size: Math.floor(cellSize * 0.45),
+ fill: 0x222222
+ });
+ numberText.anchor.set(0.5, 0.5);
+ self.addChild(numberText);
+ // Mark overlay (hidden by default)
+ var markOverlay = self.attachAsset('bingoMark', {
+ width: cellSize * 0.7,
+ height: cellSize * 0.7,
+ color: 0x4caf50,
+ shape: 'ellipse',
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ markOverlay.alpha = 0;
+ self.markOverlay = markOverlay;
+ // Set number and update text
+ self.setNumber = function (num) {
+ self.number = num;
+ numberText.setText(num > 0 ? num : '');
+ };
+ // Mark/unmark cell
+ self.setMarked = function (val) {
+ self.marked = val;
+ if (val) {
+ tween(markOverlay, {
+ alpha: 0.7
+ }, {
+ duration: 200,
+ easing: tween.easeOut
+ });
+ numberText.setText(self.number);
+ numberText.style.fill = "#ffffff";
+ } else {
+ tween(markOverlay, {
+ alpha: 0
+ }, {
+ duration: 200,
+ easing: tween.easeOut
+ });
+ numberText.style.fill = "#222222";
+ }
+ };
+ // Touch event
+ self.down = function (x, y, obj) {
+ if (self.marked) return;
+ if (game.state !== 'playing') return;
+ if (self.number === game.currentNumber) {
+ self.setMarked(true);
+ LK.effects.flashObject(self, 0x4caf50, 200);
+ game.checkWin();
+ } else {
+ LK.effects.flashObject(self, 0xff0000, 200);
+ }
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x1a237e
+});
+
+/****
+* Game Code
+****/
+// --- Config ---
+var gridSize = 5; // 5x5 bingo
+var cellSize = 300; // px, will be scaled to fit
+var cardPadding = 30;
+var cardWidth = gridSize * cellSize;
+var cardHeight = gridSize * cellSize;
+var cardStartX = (2048 - cardWidth) / 2;
+var cardStartY = 400;
+var callIntervalStart = 2000; // ms
+var callIntervalMin = 800; // ms
+var callIntervalStep = 100; // ms, decrease per call
+var gameDuration = 60000; // ms (1 min)
+var numbersRange = 75; // 1-75
+// --- State ---
+var bingoCells = [];
+var calledNumbers = [];
+var availableNumbers = [];
+var callTimer = null;
+var timeLeft = gameDuration;
+var timerInterval = null;
+var cardNumbers = [];
+var gameOver = false;
+// --- UI Elements ---
+var numberCallText = new Text2('', {
+ size: 180,
+ fill: 0xFFD600
+});
+numberCallText.anchor.set(0.5, 0.5);
+numberCallText.x = 2048 / 2;
+numberCallText.y = 220;
+game.addChild(numberCallText);
+var timerText = new Text2('', {
+ size: 90,
+ fill: 0xFFFFFF
+});
+timerText.anchor.set(0.5, 0);
+LK.gui.top.addChild(timerText);
+var winText = new Text2('', {
+ size: 120,
+ fill: 0x4CAF50
+});
+winText.anchor.set(0.5, 0.5);
+winText.x = 2048 / 2;
+winText.y = 2732 / 2;
+winText.visible = false;
+game.addChild(winText);
+// --- Functions ---
+// Generate a random bingo card (5x5, center is free)
+function generateCardNumbers() {
+ var nums = [];
+ var used = [];
+ for (var col = 0; col < gridSize; col++) {
+ var colNums = [];
+ var min = col * 15 + 1;
+ var max = min + 14;
+ for (var row = 0; row < gridSize; row++) {
+ if (col === 2 && row === 2) {
+ colNums.push(0); // Free space
+ continue;
+ }
+ var n;
+ do {
+ n = min + Math.floor(Math.random() * (max - min + 1));
+ } while (used.indexOf(n) !== -1);
+ used.push(n);
+ colNums.push(n);
+ }
+ nums.push(colNums);
+ }
+ return nums;
+}
+// Create bingo card UI
+function createBingoCard() {
+ bingoCells = [];
+ cardNumbers = generateCardNumbers();
+ for (var col = 0; col < gridSize; col++) {
+ for (var row = 0; row < gridSize; row++) {
+ var cell = new BingoCell();
+ var x = cardStartX + col * cellSize + cellSize / 2;
+ var y = cardStartY + row * cellSize + cellSize / 2;
+ cell.x = x;
+ cell.y = y;
+ var num = cardNumbers[col][row];
+ cell.setNumber(num);
+ if (col === 2 && row === 2) {
+ cell.setMarked(true); // Free space
+ }
+ game.addChild(cell);
+ bingoCells.push(cell);
+ }
+ }
+}
+// Start a new game
+function startGame() {
+ game.state = 'playing';
+ gameOver = false;
+ calledNumbers = [];
+ availableNumbers = [];
+ for (var i = 1; i <= numbersRange; i++) availableNumbers.push(i);
+ createBingoCard();
+ numberCallText.setText('');
+ winText.visible = false;
+ timeLeft = gameDuration;
+ updateTimerText();
+ if (timerInterval) LK.clearInterval(timerInterval);
+ timerInterval = LK.setInterval(function () {
+ timeLeft -= 100;
+ if (timeLeft < 0) timeLeft = 0;
+ updateTimerText();
+ if (timeLeft <= 0 && !gameOver) {
+ endGame(false);
+ }
+ }, 100);
+ nextNumberCall(callIntervalStart);
+}
+// Call the next number
+game.currentNumber = null;
+function nextNumberCall(interval) {
+ if (gameOver) return;
+ if (availableNumbers.length === 0) {
+ endGame(false);
+ return;
+ }
+ var idx = Math.floor(Math.random() * availableNumbers.length);
+ var num = availableNumbers[idx];
+ availableNumbers.splice(idx, 1);
+ calledNumbers.push(num);
+ game.currentNumber = num;
+ numberCallText.setText(num);
+ LK.effects.flashObject(numberCallText, 0xffd600, 300);
+ // Speed up calls as game progresses
+ var nextInterval = Math.max(callIntervalMin, interval - callIntervalStep);
+ if (callTimer) LK.clearTimeout(callTimer);
+ callTimer = LK.setTimeout(function () {
+ nextNumberCall(nextInterval);
+ }, nextInterval);
+}
+// Update timer UI
+function updateTimerText() {
+ var sec = Math.ceil(timeLeft / 1000);
+ timerText.setText("Time: " + sec + "s");
+}
+// Check for win (row, col, diag)
+game.checkWin = function () {
+ // Build marked grid
+ var marked = [];
+ for (var col = 0; col < gridSize; col++) {
+ marked[col] = [];
+ for (var row = 0; row < gridSize; row++) {
+ var idx = col * gridSize + row;
+ marked[col][row] = bingoCells[idx].marked;
+ }
+ }
+ // Check rows
+ for (var row = 0; row < gridSize; row++) {
+ var win = true;
+ for (var col = 0; col < gridSize; col++) {
+ if (!marked[col][row]) win = false;
+ }
+ if (win) return endGame(true);
+ }
+ // Check cols
+ for (var col = 0; col < gridSize; col++) {
+ var win = true;
+ for (var row = 0; row < gridSize; row++) {
+ if (!marked[col][row]) win = false;
+ }
+ if (win) return endGame(true);
+ }
+ // Check diag TL-BR
+ var win = true;
+ for (var i = 0; i < gridSize; i++) {
+ if (!marked[i][i]) win = false;
+ }
+ if (win) return endGame(true);
+ // Check diag TR-BL
+ win = true;
+ for (var i = 0; i < gridSize; i++) {
+ if (!marked[gridSize - 1 - i][i]) win = false;
+ }
+ if (win) return endGame(true);
+};
+// End game: win or lose
+function endGame(won) {
+ gameOver = true;
+ game.state = 'ended';
+ if (callTimer) LK.clearTimeout(callTimer);
+ if (timerInterval) LK.clearInterval(timerInterval);
+ if (won) {
+ winText.setText("BINGO!\nYou Win!");
+ winText.style.fill = "#4caf50";
+ LK.effects.flashScreen(0x4caf50, 1000);
+ LK.showYouWin();
+ } else {
+ winText.setText("Time's Up!\nGame Over");
+ winText.style.fill = "#ff1744";
+ LK.effects.flashScreen(0xff1744, 1000);
+ LK.showGameOver();
+ }
+ winText.visible = true;
+}
+// --- Input: Restart on game over/win ---
+game.down = function (x, y, obj) {
+ if (game.state === 'ended') {
+ // Wait for LK to reset game
+ }
+};
+// --- Start ---
+startGame();
\ No newline at end of file
Bingo thema. In-Game asset. 2d. High contrast. No shadows
Aİ player. In-Game asset. 2d. High contrast. No shadows
Bingo Mark. In-Game asset. 2d. High contrast. No shadows
Streakbackground bingo. In-Game asset. 2d. High contrast. No shadows
Card border. In-Game asset. 2d. High contrast. No shadows
Yellow ball. In-Game asset. 2d. High contrast. No shadows
Siyah X işaretli jeton. In-Game asset. 2d. High contrast. No shadows
YOU yazısını yaz. In-Game asset. 2d. High contrast. No shadows
Click
Sound effect
Numberthree
Sound effect
ses1
Sound effect
ses2
Sound effect
ses3
Sound effect
ses4
Sound effect
ses5
Sound effect
ses6
Sound effect
ses7
Sound effect
ses8
Sound effect
ses9
Sound effect
ses10
Sound effect
ses11
Sound effect
ses12
Sound effect
ses13
Sound effect
ses14
Sound effect
ses15
Sound effect
ses16
Sound effect
ses17
Sound effect
ses18
Sound effect
ses19
Sound effect
ses20
Sound effect
ses21
Sound effect
ses22
Sound effect
ses23
Sound effect
ses24
Sound effect
ses25
Sound effect
ses26
Sound effect
ses27
Sound effect
ses28
Sound effect
ses29
Sound effect
ses30
Sound effect
ses31
Sound effect
ses32
Sound effect
ses33
Sound effect
ses34
Sound effect
ses35
Sound effect
ses36
Sound effect
ses37
Sound effect
ses38
Sound effect
ses39
Sound effect
ses40
Sound effect
ses41
Sound effect
ses42
Sound effect
ses43
Sound effect
ses44
Sound effect
ses45
Sound effect
ses46
Sound effect
ses47
Sound effect
ses48
Sound effect
ses49
Sound effect
ses50
Sound effect
ses51
Sound effect
ses52
Sound effect
ses53
Sound effect
ses54
Sound effect
ses55
Sound effect
ses56
Sound effect
ses57
Sound effect
ses58
Sound effect
ses59
Sound effect
ses60
Sound effect
ses61
Sound effect
ses62
Sound effect
ses64
Sound effect
ses65
Sound effect
ses66
Sound effect
ses67
Sound effect
ses68
Sound effect
ses69
Sound effect
ses70
Sound effect
ses71
Sound effect
ses72
Sound effect
ses75
Sound effect
Ses73
Sound effect
Ses74
Sound effect
Sonikidakika
Sound effect
Sonbirdakika
Sound effect
Oyunahosgeldin
Sound effect
oyunahosgeldin
Sound effect