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 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; }); var PuzzleCell = Container.expand(function (row, col, isActive) { var self = Container.call(this); self.row = row; self.col = col; self.isActive = isActive || false; self.isSolved = false; self.cellGraphics = self.attachAsset('puzzleCell', { anchorX: 0.5, anchorY: 0.5 }); self.updateVisual = function () { if (self.isSolved) { self.cellGraphics.tint = 0x2ecc71; } else if (self.isActive) { self.cellGraphics.tint = 0xe74c3c; } else { self.cellGraphics.tint = 0x3498db; } }; self.toggle = function () { if (!self.isSolved) { self.isActive = !self.isActive; self.updateVisual(); } }; self.setSolved = function () { self.isSolved = true; self.updateVisual(); }; self.down = function (x, y, obj) { if (!self.isSolved) { self.toggle(); LK.getSound('cellClick').play(); checkPuzzleCompletion(); } }; self.updateVisual(); return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2c3e50 }); /**** * Game Code ****/ var currentLevel = storage.currentLevel || 1; var maxLevel = storage.maxLevel || 1; var puzzleGrid = []; var puzzleSolved = false; var gridSize = 3; var cellSpacing = 140; var levelText = new Text2('Level ' + currentLevel, { size: 60, fill: 0xFFFFFF }); levelText.anchor.set(0.5, 0); LK.gui.top.addChild(levelText); levelText.y = 100; var instructionText = new Text2('Touch cells to toggle them\nMatch the pattern to win!', { size: 40, fill: 0xECF0F1 }); instructionText.anchor.set(0.5, 0.5); game.addChild(instructionText); instructionText.x = 1024; instructionText.y = 600; var nextButton = game.addChild(new NextLevelButton()); nextButton.x = 1024; nextButton.y = 2200; function createPuzzle() { puzzleGrid = []; puzzleSolved = false; var startX = 1024 - (gridSize - 1) * cellSpacing / 2; var startY = 1000; for (var row = 0; row < gridSize; row++) { puzzleGrid[row] = []; for (var col = 0; col < gridSize; col++) { var shouldBeActive = getPuzzlePattern(currentLevel, row, col); var cell = new PuzzleCell(row, col, false); cell.x = startX + col * cellSpacing; cell.y = startY + row * cellSpacing; cell.targetState = shouldBeActive; puzzleGrid[row][col] = cell; game.addChild(cell); } } nextButton.hide(); } function getPuzzlePattern(level, row, col) { var patterns = [[[false, true, false], [true, false, true], [false, true, false]], [[true, false, true], [false, true, false], [true, false, true]], [[true, true, false], [true, false, true], [false, true, true]], [[false, true, true], [true, false, true], [true, true, false]], [[true, false, false], [false, true, false], [false, false, true]]]; var patternIndex = (level - 1) % patterns.length; return patterns[patternIndex][row][col]; } function checkPuzzleCompletion() { if (puzzleSolved) return; var allCorrect = true; for (var row = 0; row < gridSize; row++) { for (var col = 0; col < gridSize; col++) { var cell = puzzleGrid[row][col]; if (cell.isActive !== cell.targetState) { allCorrect = false; break; } } if (!allCorrect) break; } if (allCorrect) { puzzleSolved = true; for (var row = 0; row < gridSize; row++) { for (var col = 0; col < gridSize; col++) { puzzleGrid[row][col].setSolved(); } } LK.getSound('puzzleSolved').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 }); var completedText = new Text2('Puzzle Solved!', { size: 50, fill: 0x2ECC71 }); completedText.anchor.set(0.5, 0.5); completedText.x = 1024; completedText.y = 1700; completedText.alpha = 0; game.addChild(completedText); tween(completedText, { alpha: 1 }, { duration: 500 }); }, 500); } } function nextLevel() { currentLevel++; storage.currentLevel = currentLevel; levelText.setText('Level ' + currentLevel); for (var row = 0; row < gridSize; row++) { for (var col = 0; col < gridSize; col++) { if (puzzleGrid[row] && puzzleGrid[row][col]) { puzzleGrid[row][col].destroy(); } } } game.children.forEach(function (child) { if (child.constructor.name === 'Text2' && child !== levelText) { child.destroy(); } }); createPuzzle(); instructionText.alpha = 1; instructionText.setText('Touch cells to toggle them\nMatch the pattern to win!'); if (currentLevel > 5) { gridSize = 4; cellSpacing = 120; } else if (currentLevel > 10) { gridSize = 5; cellSpacing = 100; } } function resetPuzzle() { for (var row = 0; row < gridSize; row++) { for (var col = 0; col < gridSize; col++) { var cell = puzzleGrid[row][col]; cell.isActive = false; cell.isSolved = false; cell.updateVisual(); } } puzzleSolved = false; nextButton.hide(); } createPuzzle(); game.update = function () { // Game loop updates handled by individual components };
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,230 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+var storage = LK.import("@upit/storage.v1");
+
+/****
+* Classes
+****/
+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;
+});
+var PuzzleCell = Container.expand(function (row, col, isActive) {
+ var self = Container.call(this);
+ self.row = row;
+ self.col = col;
+ self.isActive = isActive || false;
+ self.isSolved = false;
+ self.cellGraphics = self.attachAsset('puzzleCell', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.updateVisual = function () {
+ if (self.isSolved) {
+ self.cellGraphics.tint = 0x2ecc71;
+ } else if (self.isActive) {
+ self.cellGraphics.tint = 0xe74c3c;
+ } else {
+ self.cellGraphics.tint = 0x3498db;
+ }
+ };
+ self.toggle = function () {
+ if (!self.isSolved) {
+ self.isActive = !self.isActive;
+ self.updateVisual();
+ }
+ };
+ self.setSolved = function () {
+ self.isSolved = true;
+ self.updateVisual();
+ };
+ self.down = function (x, y, obj) {
+ if (!self.isSolved) {
+ self.toggle();
+ LK.getSound('cellClick').play();
+ checkPuzzleCompletion();
+ }
+ };
+ self.updateVisual();
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x2c3e50
+});
+
+/****
+* Game Code
+****/
+var currentLevel = storage.currentLevel || 1;
+var maxLevel = storage.maxLevel || 1;
+var puzzleGrid = [];
+var puzzleSolved = false;
+var gridSize = 3;
+var cellSpacing = 140;
+var levelText = new Text2('Level ' + currentLevel, {
+ size: 60,
+ fill: 0xFFFFFF
+});
+levelText.anchor.set(0.5, 0);
+LK.gui.top.addChild(levelText);
+levelText.y = 100;
+var instructionText = new Text2('Touch cells to toggle them\nMatch the pattern to win!', {
+ size: 40,
+ fill: 0xECF0F1
+});
+instructionText.anchor.set(0.5, 0.5);
+game.addChild(instructionText);
+instructionText.x = 1024;
+instructionText.y = 600;
+var nextButton = game.addChild(new NextLevelButton());
+nextButton.x = 1024;
+nextButton.y = 2200;
+function createPuzzle() {
+ puzzleGrid = [];
+ puzzleSolved = false;
+ var startX = 1024 - (gridSize - 1) * cellSpacing / 2;
+ var startY = 1000;
+ for (var row = 0; row < gridSize; row++) {
+ puzzleGrid[row] = [];
+ for (var col = 0; col < gridSize; col++) {
+ var shouldBeActive = getPuzzlePattern(currentLevel, row, col);
+ var cell = new PuzzleCell(row, col, false);
+ cell.x = startX + col * cellSpacing;
+ cell.y = startY + row * cellSpacing;
+ cell.targetState = shouldBeActive;
+ puzzleGrid[row][col] = cell;
+ game.addChild(cell);
+ }
+ }
+ nextButton.hide();
+}
+function getPuzzlePattern(level, row, col) {
+ var patterns = [[[false, true, false], [true, false, true], [false, true, false]], [[true, false, true], [false, true, false], [true, false, true]], [[true, true, false], [true, false, true], [false, true, true]], [[false, true, true], [true, false, true], [true, true, false]], [[true, false, false], [false, true, false], [false, false, true]]];
+ var patternIndex = (level - 1) % patterns.length;
+ return patterns[patternIndex][row][col];
+}
+function checkPuzzleCompletion() {
+ if (puzzleSolved) return;
+ var allCorrect = true;
+ for (var row = 0; row < gridSize; row++) {
+ for (var col = 0; col < gridSize; col++) {
+ var cell = puzzleGrid[row][col];
+ if (cell.isActive !== cell.targetState) {
+ allCorrect = false;
+ break;
+ }
+ }
+ if (!allCorrect) break;
+ }
+ if (allCorrect) {
+ puzzleSolved = true;
+ for (var row = 0; row < gridSize; row++) {
+ for (var col = 0; col < gridSize; col++) {
+ puzzleGrid[row][col].setSolved();
+ }
+ }
+ LK.getSound('puzzleSolved').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
+ });
+ var completedText = new Text2('Puzzle Solved!', {
+ size: 50,
+ fill: 0x2ECC71
+ });
+ completedText.anchor.set(0.5, 0.5);
+ completedText.x = 1024;
+ completedText.y = 1700;
+ completedText.alpha = 0;
+ game.addChild(completedText);
+ tween(completedText, {
+ alpha: 1
+ }, {
+ duration: 500
+ });
+ }, 500);
+ }
+}
+function nextLevel() {
+ currentLevel++;
+ storage.currentLevel = currentLevel;
+ levelText.setText('Level ' + currentLevel);
+ for (var row = 0; row < gridSize; row++) {
+ for (var col = 0; col < gridSize; col++) {
+ if (puzzleGrid[row] && puzzleGrid[row][col]) {
+ puzzleGrid[row][col].destroy();
+ }
+ }
+ }
+ game.children.forEach(function (child) {
+ if (child.constructor.name === 'Text2' && child !== levelText) {
+ child.destroy();
+ }
+ });
+ createPuzzle();
+ instructionText.alpha = 1;
+ instructionText.setText('Touch cells to toggle them\nMatch the pattern to win!');
+ if (currentLevel > 5) {
+ gridSize = 4;
+ cellSpacing = 120;
+ } else if (currentLevel > 10) {
+ gridSize = 5;
+ cellSpacing = 100;
+ }
+}
+function resetPuzzle() {
+ for (var row = 0; row < gridSize; row++) {
+ for (var col = 0; col < gridSize; col++) {
+ var cell = puzzleGrid[row][col];
+ cell.isActive = false;
+ cell.isSolved = false;
+ cell.updateVisual();
+ }
+ }
+ puzzleSolved = false;
+ nextButton.hide();
+}
+createPuzzle();
+game.update = function () {
+ // Game loop updates handled by individual components
+};
\ No newline at end of file
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