User prompt
Level complete yazısını biraz daha üste alır mısın
User prompt
Play kısmında ekran tam ekran olmuyo onu ayarlayabilir misin
User prompt
Sondaki ekranda arkadaki oyun kısmı kaybolsun tamamen yeni bir ekrana geçilsin assetleri de yeni assetler olaraka ayarla ben onları değiştireceğim
User prompt
Sondaki ekranda ki tebrikler yazısı baştaki ana ekran gibi farklı bir şekilde çıksa birde oraya bir kaç asset ekler misin ben onları süsleyeceğim
User prompt
oyun level 5 te bitsin eğer level 5 i de bitirebilirse oyuncunun karşısına tebrik ekranı çıksın
User prompt
oyuncu ana menüdeki hayvanlara basınca da oyun başlıyor sadece start game tuşuna basınca oyun başlasın
User prompt
ana menüyü oyundak hayvan assetleriyle süsler misin biraz bi de oyunun adını animal match yapar mısın
User prompt
oyuna bir ana menü ekler misin her oyun başladığında o gözüksün oyuncu ordaki start tuşuna basınca oyun başlasın
User prompt
eğer doğru bilebilirsek bir animasyon ekler misin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
bi de oyundan çıkınca tekrardan level sıfırdan başlayalım
User prompt
yeni levele geçince level complete yazısı gitmiyor onu düzeltir misin
User prompt
yeni levele geçince level completed yazısı ortadan kalksın
User prompt
level completed yazısının yerini kutuların üstüne çeker misin
User prompt
kutuların boyutunu biraz büyütebilir misin
User prompt
bunu aynı kutuları bulma tarzında yapaar mısın
Code edit (1 edits merged)
Please save this source code
User prompt
Level Puzzle Master
Initial prompt
senden basit bulmaca türünde bir oyun istiyorum ama seviyeler olacak her bulmacadan sonrafarklı bir levele geçilecek
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var MainMenu = Container.expand(function () { var self = Container.call(this); self.titleText = new Text2('Animal Match', { size: 80, fill: 0xFFFFFF }); self.titleText.anchor.set(0.5, 0.5); self.titleText.x = 1024; self.titleText.y = 800; self.addChild(self.titleText); self.startButton = self.attachAsset('startButton', { anchorX: 0.5, anchorY: 0.5 }); self.startButton.x = 1024; self.startButton.y = 1200; self.startButtonText = new Text2('START GAME', { size: 50, fill: 0xFFFFFF }); self.startButtonText.anchor.set(0.5, 0.5); self.startButtonText.x = 1024; self.startButtonText.y = 1200; self.addChild(self.startButtonText); // Add decorative animals around the menu self.animal1 = self.attachAsset('cardFront1', { anchorX: 0.5, anchorY: 0.5 }); self.animal1.x = 400; self.animal1.y = 600; self.animal1.scaleX = 1.2; self.animal1.scaleY = 1.2; self.animal2 = self.attachAsset('cardFront2', { anchorX: 0.5, anchorY: 0.5 }); self.animal2.x = 1648; self.animal2.y = 600; self.animal2.scaleX = 1.2; self.animal2.scaleY = 1.2; self.animal3 = self.attachAsset('cardFront3', { anchorX: 0.5, anchorY: 0.5 }); self.animal3.x = 300; self.animal3.y = 1000; self.animal3.scaleX = 1.1; self.animal3.scaleY = 1.1; self.animal4 = self.attachAsset('cardFront4', { anchorX: 0.5, anchorY: 0.5 }); self.animal4.x = 1748; self.animal4.y = 1000; self.animal4.scaleX = 1.1; self.animal4.scaleY = 1.1; self.animal5 = self.attachAsset('cardFront5', { anchorX: 0.5, anchorY: 0.5 }); self.animal5.x = 512; self.animal5.y = 1400; self.animal5.scaleX = 0.9; self.animal5.scaleY = 0.9; self.animal6 = self.attachAsset('cardFront6', { anchorX: 0.5, anchorY: 0.5 }); self.animal6.x = 1536; self.animal6.y = 1400; self.animal6.scaleX = 0.9; self.animal6.scaleY = 0.9; self.down = function (x, y, obj) { startGame(); }; return self; }); var MatchingCard = Container.expand(function (cardType, row, col) { var self = Container.call(this); self.cardType = cardType; self.row = row; self.col = col; self.isFlipped = false; self.isMatched = false; self.canClick = true; self.cardBack = self.attachAsset('cardBack', { anchorX: 0.5, anchorY: 0.5 }); self.cardFront = self.attachAsset('cardFront' + cardType, { anchorX: 0.5, anchorY: 0.5 }); self.cardFront.visible = false; self.flip = function () { if (!self.canClick || self.isMatched) return; self.isFlipped = !self.isFlipped; self.cardBack.visible = !self.isFlipped; self.cardFront.visible = self.isFlipped; LK.getSound('cardFlip').play(); }; self.setMatched = function () { self.isMatched = true; self.canClick = false; self.removeChild(self.cardBack); self.removeChild(self.cardFront); self.matchedGraphics = self.attachAsset('cardMatched', { anchorX: 0.5, anchorY: 0.5 }); }; self.flipBack = function () { if (self.isMatched) return; self.isFlipped = false; self.cardBack.visible = true; self.cardFront.visible = false; }; self.down = function (x, y, obj) { if (!self.canClick || self.isMatched) return; handleCardClick(self); }; return self; }); var NextLevelButton = Container.expand(function () { var self = Container.call(this); self.buttonGraphics = self.attachAsset('nextLevelButton', { anchorX: 0.5, anchorY: 0.5 }); self.buttonText = new Text2('Next Level', { size: 40, fill: 0xFFFFFF }); self.buttonText.anchor.set(0.5, 0.5); self.addChild(self.buttonText); self.visible = false; self.show = function () { self.visible = true; tween(self, { alpha: 1 }, { duration: 300 }); }; self.hide = function () { self.visible = false; self.alpha = 0; }; self.down = function (x, y, obj) { nextLevel(); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2c3e50 }); /**** * Game Code ****/ var gameStarted = false; var mainMenu = null; var currentLevel = 1; storage.currentLevel = 1; var maxLevel = storage.maxLevel || 1; var cardGrid = []; var flippedCards = []; var matchedPairs = 0; var totalPairs = 0; var levelComplete = false; var gridSize = 4; var cellSpacing = 180; var waitingForFlipBack = false; var levelText = new Text2('Level 1', { size: 60, fill: 0xFFFFFF }); levelText.anchor.set(0.5, 0); LK.gui.top.addChild(levelText); levelText.y = 100; levelText.visible = false; var instructionText = new Text2('Find matching pairs of cards\nFlip two cards to match them!', { size: 40, fill: 0xECF0F1 }); instructionText.anchor.set(0.5, 0.5); game.addChild(instructionText); instructionText.x = 1024; instructionText.y = 600; instructionText.visible = false; var nextButton = game.addChild(new NextLevelButton()); nextButton.x = 1024; nextButton.y = 2200; nextButton.visible = false; function startGame() { gameStarted = true; if (mainMenu) { mainMenu.destroy(); mainMenu = null; } levelText.visible = true; instructionText.visible = true; nextButton.visible = true; createMatchingGame(); } function createMatchingGame() { cardGrid = []; flippedCards = []; matchedPairs = 0; levelComplete = false; waitingForFlipBack = false; // Determine grid size based on level if (currentLevel <= 3) { gridSize = 4; // 4x4 = 16 cards = 8 pairs } else if (currentLevel <= 6) { gridSize = 5; // 5x4 = 20 cards = 10 pairs (we'll use 5x4 grid) } else { gridSize = 6; // 6x4 = 24 cards = 12 pairs } var actualCols = gridSize === 5 ? 4 : 4; var actualRows = gridSize === 5 ? 5 : gridSize === 6 ? 6 : 4; totalPairs = actualRows * actualCols / 2; // Create pairs array var cardTypes = []; var maxCardType = Math.min(8, totalPairs); for (var i = 1; i <= maxCardType; i++) { cardTypes.push(i); cardTypes.push(i); } // Fill remaining slots if needed while (cardTypes.length < totalPairs * 2) { var randomType = Math.floor(Math.random() * maxCardType) + 1; cardTypes.push(randomType); cardTypes.push(randomType); } // Shuffle the array for (var i = cardTypes.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = cardTypes[i]; cardTypes[i] = cardTypes[j]; cardTypes[j] = temp; } var startX = 1024 - (actualCols - 1) * cellSpacing / 2; var startY = 1000; var cardIndex = 0; for (var row = 0; row < actualRows; row++) { cardGrid[row] = []; for (var col = 0; col < actualCols; col++) { var card = new MatchingCard(cardTypes[cardIndex], row, col); card.x = startX + col * cellSpacing; card.y = startY + row * cellSpacing; cardGrid[row][col] = card; game.addChild(card); cardIndex++; } } nextButton.hide(); } function handleCardClick(clickedCard) { if (waitingForFlipBack || clickedCard.isMatched || clickedCard.isFlipped) return; if (flippedCards.length >= 2) return; clickedCard.flip(); flippedCards.push(clickedCard); if (flippedCards.length === 2) { if (flippedCards[0].cardType === flippedCards[1].cardType) { // Match found! LK.getSound('matchFound').play(); // Add success animation - scale up both cards tween(flippedCards[0], { scaleX: 1.3, scaleY: 1.3 }, { duration: 200, easing: tween.easeOut }); tween(flippedCards[1], { scaleX: 1.3, scaleY: 1.3 }, { duration: 200, easing: tween.easeOut }); // Scale back and complete match LK.setTimeout(function () { tween(flippedCards[0], { scaleX: 1.0, scaleY: 1.0 }, { duration: 200, easing: tween.easeIn, onFinish: function onFinish() { flippedCards[0].setMatched(); } }); tween(flippedCards[1], { scaleX: 1.0, scaleY: 1.0 }, { duration: 200, easing: tween.easeIn, onFinish: function onFinish() { flippedCards[1].setMatched(); } }); }, 200); LK.setTimeout(function () { flippedCards = []; matchedPairs++; checkLevelComplete(); }, 600); } else { // No match, flip back after delay waitingForFlipBack = true; LK.setTimeout(function () { flippedCards[0].flipBack(); flippedCards[1].flipBack(); flippedCards = []; waitingForFlipBack = false; }, 1000); } } } function checkLevelComplete() { if (matchedPairs === totalPairs) { levelComplete = true; LK.getSound('levelComplete').play(); LK.effects.flashScreen(0x2ecc71, 500); if (currentLevel >= maxLevel) { maxLevel = currentLevel + 1; storage.maxLevel = maxLevel; } nextButton.show(); LK.setTimeout(function () { tween(instructionText, { alpha: 0 }, { duration: 300 }); completedText = new Text2('Level Complete!', { size: 50, fill: 0x2ECC71 }); completedText.anchor.set(0.5, 0.5); completedText.x = 1024; completedText.y = 900; completedText.alpha = 0; game.addChild(completedText); tween(completedText, { alpha: 1 }, { duration: 500 }); }, 500); } } var completedText = null; function nextLevel() { currentLevel++; storage.currentLevel = currentLevel; levelText.setText('Level ' + currentLevel); // Clean up existing cards for (var row = 0; row < cardGrid.length; row++) { for (var col = 0; col < cardGrid[row].length; col++) { if (cardGrid[row] && cardGrid[row][col]) { cardGrid[row][col].destroy(); } } } // Clean up completion text if (completedText) { completedText.destroy(); completedText = null; } createMatchingGame(); instructionText.alpha = 1; instructionText.setText('Find matching pairs of cards\nFlip two cards to match them!'); } function resetMatchingGame() { for (var row = 0; row < cardGrid.length; row++) { for (var col = 0; col < cardGrid[row].length; col++) { var card = cardGrid[row][col]; card.flipBack(); card.isMatched = false; card.canClick = true; } } flippedCards = []; matchedPairs = 0; levelComplete = false; waitingForFlipBack = false; nextButton.hide(); } function showMainMenu() { gameStarted = false; currentLevel = 1; storage.currentLevel = 1; levelText.setText('Level 1'); levelText.visible = false; instructionText.visible = false; nextButton.visible = false; // Clean up existing cards if any for (var row = 0; row < cardGrid.length; row++) { for (var col = 0; col < cardGrid[row].length; col++) { if (cardGrid[row] && cardGrid[row][col]) { cardGrid[row][col].destroy(); } } } cardGrid = []; // Clean up completion text if (completedText) { completedText.destroy(); completedText = null; } mainMenu = game.addChild(new MainMenu()); } showMainMenu(); game.update = function () { // Game loop updates handled by individual components };
===================================================================
--- original.js
+++ change.js
@@ -8,9 +8,9 @@
* Classes
****/
var MainMenu = Container.expand(function () {
var self = Container.call(this);
- self.titleText = new Text2('Memory Match', {
+ self.titleText = new Text2('Animal Match', {
size: 80,
fill: 0xFFFFFF
});
self.titleText.anchor.set(0.5, 0.5);
@@ -30,8 +30,57 @@
self.startButtonText.anchor.set(0.5, 0.5);
self.startButtonText.x = 1024;
self.startButtonText.y = 1200;
self.addChild(self.startButtonText);
+ // Add decorative animals around the menu
+ self.animal1 = self.attachAsset('cardFront1', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.animal1.x = 400;
+ self.animal1.y = 600;
+ self.animal1.scaleX = 1.2;
+ self.animal1.scaleY = 1.2;
+ self.animal2 = self.attachAsset('cardFront2', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.animal2.x = 1648;
+ self.animal2.y = 600;
+ self.animal2.scaleX = 1.2;
+ self.animal2.scaleY = 1.2;
+ self.animal3 = self.attachAsset('cardFront3', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.animal3.x = 300;
+ self.animal3.y = 1000;
+ self.animal3.scaleX = 1.1;
+ self.animal3.scaleY = 1.1;
+ self.animal4 = self.attachAsset('cardFront4', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.animal4.x = 1748;
+ self.animal4.y = 1000;
+ self.animal4.scaleX = 1.1;
+ self.animal4.scaleY = 1.1;
+ self.animal5 = self.attachAsset('cardFront5', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.animal5.x = 512;
+ self.animal5.y = 1400;
+ self.animal5.scaleX = 0.9;
+ self.animal5.scaleY = 0.9;
+ self.animal6 = self.attachAsset('cardFront6', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.animal6.x = 1536;
+ self.animal6.y = 1400;
+ self.animal6.scaleX = 0.9;
+ self.animal6.scaleY = 0.9;
self.down = function (x, y, obj) {
startGame();
};
return self;
cat. In-Game asset. 2d. High contrast. No shadows
sheep with black background. In-Game asset. 2d. High contrast. No shadows
dog with black background. In-Game asset. 2d. High contrast. No shadows
horse with black background. In-Game asset. 2d. High contrast. No shadows
cow with black background. In-Game asset. 2d. High contrast. No shadows
siyah arkaplanlı bir horoz. In-Game asset. 2d. High contrast. No shadows
white chicken with black background. In-Game asset. 2d. High contrast. No shadows
pink pig with black background. In-Game asset. 2d. High contrast. No shadows
correct sign. In-Game asset. 2d. High contrast. No shadows
Patlamış havai fişek. In-Game asset. 2d. High contrast. No shadows