User prompt
aşağıya kaydır biraz
User prompt
Replay Yaz baştan bağla yerine
User prompt
sağ yukaruya koy bastan başlayı ve ufak
User prompt
baştan başla butuno kuy yukarı
User prompt
tam biraz aşağı
User prompt
dilim sayısı biraz aşağı
User prompt
yukarı kaydır dilim sayısı ve tam yazılarını ve aralarını biraz aç
User prompt
Tam yarım ve çeyrek dilim sayısı yazısından büyük olsun ve mor olsun
User prompt
Dilim sayısının Üstüne başta Tam yaz sonra Yarım sonra Çeyrek
User prompt
biraz daha büyük ve aşağıya
User prompt
Pastanın altına Pastayı Böl yaz ama ufak
User prompt
Başlıkla aynı renk olsun
User prompt
Dilim Sayısı Diye güncelle
User prompt
Dilim Sayısı: İlk başta 1 her tıklamada 2 katına çıksın 4 de sabit kalsın
User prompt
aşağıya dilim sayısı yaz
User prompt
yukarıya pasta Bölmece yaz
User prompt
çok azalt
User prompt
mesafeyi baya azalt
User prompt
4 parça olduğunda büyüklükleri aynı olsun
User prompt
4 parça olduğunda ekranda kareler arasına boşluk koy biraz
User prompt
2 bölmede kareler arasına 10px margin koy
User prompt
2 bölmedeki şekillerin arasını 10 px aç
User prompt
ilk bölmedeki kareler bir birinin simetrisi olsun
User prompt
ilk bölmede kareleri yan yana değil üstlü altlı yap
User prompt
ilk bölmede kareleri üst üste getir
/**** * Classes ****/ // SplitSquare: A square that can be split into two, then each half can be split again var SplitSquare = Container.expand(function () { var self = Container.call(this); // State: 0 = whole, 1 = split in 2, 2 = split in 4 self.splitState = 0; // Store child pieces for later reference self.pieces = []; // Add the initial whole square var whole = self.attachAsset('splitSquare1', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0 }); self.pieces.push(whole); // Helper to clear all pieces self.clearPieces = function () { for (var i = 0; i < self.pieces.length; i++) { if (self.pieces[i] && self.pieces[i].parent) { self.pieces[i].parent.removeChild(self.pieces[i]); } } self.pieces = []; }; // Split into 2 pieces (horizontal split, üstlü altlı) self.splitInTwo = function () { self.clearPieces(); // Use the actual height of the splitSquare2 asset for perfect alignment var pieceH = LK.getAsset('splitSquare2', { anchorX: 0.5, anchorY: 0.5 }).height; var top = self.attachAsset('splitSquare2', { anchorX: 0.5, // center horizontally anchorY: 1, // bottom edge x: 0, y: 0 }); var bottom = self.attachAsset('splitSquare2', { anchorX: 0.5, // center horizontally anchorY: 0, // top edge x: 0, y: 0 }); self.pieces.push(top, bottom); self.splitState = 1; }; // Split into 4 pieces (each half split horizontally) self.splitInFour = function () { self.clearPieces(); // Use the actual width/height of the splitSquare3/4 assets for perfect alignment var pieceW = LK.getAsset('splitSquare3', { anchorX: 0.5, anchorY: 0.5 }).width; var pieceH = LK.getAsset('splitSquare3', { anchorX: 0.5, anchorY: 0.5 }).height; // Add a small margin between pieces var margin = 24; // Top-left var tl = self.attachAsset('splitSquare3', { anchorX: 1, anchorY: 1, x: -margin / 2, y: -margin / 2 }); // Bottom-left var bl = self.attachAsset('splitSquare4', { anchorX: 1, anchorY: 0, x: -margin / 2, y: margin / 2 }); // Top-right var tr = self.attachAsset('splitSquare3', { anchorX: 0, anchorY: 1, x: margin / 2, y: -margin / 2 }); // Bottom-right var br = self.attachAsset('splitSquare4', { anchorX: 0, anchorY: 0, x: margin / 2, y: margin / 2 }); self.pieces.push(tl, bl, tr, br); self.splitState = 2; }; // Handle click/tap to split self.down = function (x, y, obj) { if (self.splitState === 0) { self.splitInTwo(); } else if (self.splitState === 1) { self.splitInFour(); } }; return self; }); /**** * Initialize Game ****/ // Add a SplitSquare to the center of the game var game = new LK.Game({ backgroundColor: 0xffffff }); /**** * Game Code ****/ // Dilim sayısı state var sliceCount = 1; // Add 'Replay' button to the top right, small size var restartButton = new Text2('Replay', { size: 60, fill: 0x8e24aa, font: "'GillSans-Bold',Impact,'Arial Black',Tahoma" }); restartButton.anchor.set(1, 0); // right edge, top edge restartButton.x = 0; // will be positioned by gui.topRight restartButton.y = 0; LK.gui.topRight.addChild(restartButton); restartButton.down = function () { // Reset game state splitSquare.splitState = 0; splitSquare.clearPieces(); var whole = splitSquare.attachAsset('splitSquare1', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0 }); splitSquare.pieces.push(whole); sliceCount = 1; updateSliceCountText(); }; // Add label above slice count to show Tam/Yarım/Çeyrek var sliceLabelText = new Text2('Tam', { size: 140, fill: 0x8e24aa, // mor renk font: "'GillSans-Bold',Impact,'Arial Black',Tahoma" }); sliceLabelText.anchor.set(0.5, 1); // center horizontally, bottom edge sliceLabelText.y = -180; // move label further down LK.gui.bottom.addChild(sliceLabelText); // Add 'Dilim Sayısı' text at the bottom center var sliceCountText = new Text2('Dilim Sayısı: 1', { size: 100, fill: 0xD83318, font: "'GillSans-Bold',Impact,'Arial Black',Tahoma" }); sliceCountText.anchor.set(0.5, 1); // center horizontally, bottom edge sliceCountText.y = -40; // move slice count further down LK.gui.bottom.addChild(sliceCountText); // Helper to update slice count text function updateSliceCountText() { sliceCountText.setText('Dilim Sayısı: ' + sliceCount); if (sliceCount === 1) { sliceLabelText.setText('Tam'); } else if (sliceCount === 2) { sliceLabelText.setText('Yarım'); } else if (sliceCount === 4) { sliceLabelText.setText('Çeyrek'); } } // Title var titleText = new Text2('Pasta Bölmece', { size: 120, fill: 0xD83318, font: "'GillSans-Bold',Impact,'Arial Black',Tahoma" }); titleText.anchor.set(0.5, 0); // center horizontally, top edge // Place title below the top bar, leaving 40px margin from the top (and not in the top left 100x100) titleText.y = 40; LK.gui.top.addChild(titleText); // Add a SplitSquare to the center of the game var splitSquare = new SplitSquare(); splitSquare.x = 2048 / 2; splitSquare.y = 2732 / 2; game.addChild(splitSquare); // Add 'Pastayı Böl' text below the cake, bigger and further down var splitLabel = new Text2('Pastayı Böl', { size: 90, fill: 0xD83318, font: "'GillSans-Bold',Impact,'Arial Black',Tahoma" }); splitLabel.anchor.set(0.5, 0); // Position further below the splitSquare (using its height) var cakeAsset = LK.getAsset('splitSquare1', { anchorX: 0.5, anchorY: 0.5 }); splitLabel.x = splitSquare.x; splitLabel.y = splitSquare.y + cakeAsset.height / 2 + 80; game.addChild(splitLabel); // Patch SplitSquare to update sliceCount and text on split var origDown = splitSquare.down; splitSquare.down = function (x, y, obj) { if (splitSquare.splitState === 0) { sliceCount = 2; updateSliceCountText(); } else if (splitSquare.splitState === 1) { sliceCount = 4; updateSliceCountText(); } origDown.call(splitSquare, x, y, obj); }; updateSliceCountText(); ;
===================================================================
--- original.js
+++ change.js
@@ -152,18 +152,18 @@
// mor renk
font: "'GillSans-Bold',Impact,'Arial Black',Tahoma"
});
sliceLabelText.anchor.set(0.5, 1); // center horizontally, bottom edge
-sliceLabelText.y = -260; // move label a bit lower
+sliceLabelText.y = -180; // move label further down
LK.gui.bottom.addChild(sliceLabelText);
// Add 'Dilim Sayısı' text at the bottom center
var sliceCountText = new Text2('Dilim Sayısı: 1', {
size: 100,
fill: 0xD83318,
font: "'GillSans-Bold',Impact,'Arial Black',Tahoma"
});
sliceCountText.anchor.set(0.5, 1); // center horizontally, bottom edge
-sliceCountText.y = -120; // move slice count a bit lower
+sliceCountText.y = -40; // move slice count further down
LK.gui.bottom.addChild(sliceCountText);
// Helper to update slice count text
function updateSliceCountText() {
sliceCountText.setText('Dilim Sayısı: ' + sliceCount);