User prompt
4 sırada dolmadan slot aktif olmasın.
User prompt
Sıralar arasındaki bekleme zamanıni yariya düsur ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Slotu çekince tüm sıralar ardışık olarak sırayla dolsun ve puan kuralları her sıra için geçerli olsun ve animasyonlar da sırayla ardışık olarak oynasın. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Slotu çekince 4 sıra da dolsun ve tüm puan kuralları ve animasyonları 4 sıra için de geçerli olsun. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
4 row da bitince hücreleri temizle.
User prompt
Middle celli kaldır
User prompt
Ana gridi 4x4 e düşür. Orta hücreyi en alta al. Adını da sonuc hücre diye degistir.
User prompt
Seçileni ekranı daha guzel boşluklu ayarla.
User prompt
Seçilen hucre arasını ac.
User prompt
Seçilene tıklayınca geri koy.
User prompt
Sell hucresinin mesafesi hücreler arasıyla ayni olsun. Seçilen mala tiklayınca inventorye geri koy
User prompt
Mallar gridini 4x3 yerine 4x2 yap. Boyutunu slot gridi ile aynı yap. Satış hücresini de aynı boyut yap ve butonu da hemdn altına büyüt. Ekran yerlesimleri uyumlu olsun. Ayrıca başlangıçta 1 malımız olsun. Sat yerine Sell yaz
User prompt
Mal hücreleri 4 tanesi yukardaki 3 hücre boyutu kadar büyüsün.
User prompt
Mal hücreleri ve mallar biraz daha büyük olsun.
User prompt
Satılan malın yerine yeni mal otomatik gelmesin
User prompt
Aşağıya 4x3 hucreden oluşan mallar gridi ekle. Her bir hücre içinde çeşitli renkte ve şekilde assetler olsun. Bunlardan birini tıklayınca sağda bulunan bir hucreye taşı. Sagdaki hücrenin altinda bir buton olsun. Butonda sat yazsın. Butona basınca money değerimiz 100₺ artsin. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Hücreler transparan olmasın.
User prompt
Arkaplanı yeşil yap.
User prompt
Tüm ekranı bir grid boyu yukarı kaydır.
User prompt
Kaydirma sadece handle a yakin bir yerde olsun.
User prompt
Please fix the bug: 'RangeError: Maximum call stack size exceeded' in or related to this line: 'var shapeGraphics = self.attachAsset(assetId, {' Line Number: 41
User prompt
Tedt için 4x puan alacagim sekil gönder
User prompt
Test için4 aynı renk ve aynı şekil gönder
User prompt
Test için 4ü gönder
User prompt
2 şekil puanı icin scorMatch yerine 2xMatch asseti kullan. scoreMatch assetini sil.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var DropShape = Container.expand(function (shapeType, color, shapeForm) { var self = Container.call(this); self.shapeType = shapeType; self.color = color; self.shapeForm = shapeForm; self.speed = 0; self.targetY = 0; self.isMoving = false; self.lane = 0; self.row = -1; var assetId = color + shapeForm; var shapeGraphics = self.attachAsset(assetId, { anchorX: 0.5, anchorY: 0.5 }); self.startDrop = function (lane, startY, endY) { self.lane = lane; self.y = startY; self.targetY = endY; self.speed = 120; // Double the speed for much faster movement self.isMoving = true; // Add slot machine spinning effect - faster rotation tween(self, { rotation: Math.PI * 4 }, { duration: 800, // Much faster rotation animation easing: tween.easeOut }); }; self.update = function () { if (self.isMoving) { self.y += self.speed; // Much faster settling with aggressive deceleration var distanceToTarget = Math.abs(self.targetY - self.y); if (distanceToTarget < 150) { self.speed = Math.max(8, self.speed * 0.85); // Higher minimum speed and faster deceleration } // Stop at target with bounce effect if (self.y >= self.targetY) { self.y = self.targetY; self.isMoving = false; self.speed = 0; // No bounce animation to keep consistent size // Calculate which row this shape is in self.row = Math.floor((self.y - gridStartY) / (cellSize + cellMargin)); } } }; return self; }); var Lever = Container.expand(function () { var self = Container.call(this); self.isPulled = false; self.canPull = true; var leverBase = self.attachAsset('lever', { anchorX: 0.5, anchorY: 1.0 }); self.leverHandle = self.attachAsset('leverHandle', { anchorX: 0.5, anchorY: 0.5 }); self.leverHandle.y = -700; self.pull = function () { if (!self.canPull || isShifting) return; self.canPull = false; self.isPulled = true; LK.getSound('leverPull').play(); // Animate lever handle moving down - much faster tween(self.leverHandle, { y: -100 }, { duration: 15, easing: tween.easeOut }); // Keep lever pulled state - will be reset on touch release // Allow immediate next pull self.canPull = true; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2a1810 }); /**** * Game Code ****/ var lanes = []; var dropShapes = []; var cellSize = 300; // Square cell size var cellMargin = 15; // 15 pixel margin between cells var totalGridWidth = 4 * cellSize + 3 * cellMargin; // Total width of 4 columns with margins var totalGridHeight = 5 * cellSize + 4 * cellMargin; // Total height of 5 rows with margins var gridStartX = (2048 - totalGridWidth) / 2 - 200; // Shift the 4x5 grid to the left var gridStartY = 600; var laneWidth = cellSize + cellMargin; // Width per column including margin var laneBackgroundWidth = cellSize; // Square cell background var cellHeight = cellSize + cellMargin; // Height per row including margin var shapeTypes = ['red', 'blue', 'green', 'yellow']; var shapeForms = ['Shape', 'Circle']; var lever; var scoreTxt; // Create lane backgrounds for 4x5 grid for (var col = 0; col < 4; col++) { for (var row = 0; row < 5; row++) { var assetType = row === 2 ? 'middleCell' : 'cell'; var cellBack = LK.getAsset(assetType, { width: cellSize, height: cellSize, anchorX: 0.5, anchorY: 0.5, alpha: 0.3 }); cellBack.x = gridStartX + col * (cellSize + cellMargin) + cellSize / 2; cellBack.y = gridStartY + row * (cellSize + cellMargin) + cellSize / 2; game.addChild(cellBack); } } // Create lever lever = game.addChild(new Lever()); lever.x = 1700; // Move to the left lever.y = 1400; // Create score display scoreTxt = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); function updateScore() { scoreTxt.setText('Score: ' + LK.getScore()); } function getRandomShape() { var color = shapeTypes[Math.floor(Math.random() * shapeTypes.length)]; var form = shapeForms[Math.floor(Math.random() * shapeForms.length)]; return { color: color, form: form }; } function spawnShapes() { spawnNewShapes(); } function spawnNewShapes() { // Send exactly 4 shapes for testing - one in each lane for (var i = 0; i < 4; i++) { (function (laneIndex) { var shapeData = getRandomShape(); var shape = new DropShape(shapeData.color + shapeData.form, shapeData.color, shapeData.form); shape.x = gridStartX + laneIndex * (cellSize + cellMargin) + cellSize / 2; // Find the lowest available position in this lane var targetRow = 4; // Start from bottom row for (var row = 4; row >= 0; row--) { var occupied = false; for (var j = 0; j < dropShapes.length; j++) { if (dropShapes[j].lane === laneIndex && dropShapes[j].row === row && !dropShapes[j].isMoving) { occupied = true; break; } } if (!occupied) { targetRow = row; break; } } // If bottom row is occupied, find next available row going up if (targetRow === 4) { for (var row = 4; row >= 0; row--) { var occupied = false; for (var j = 0; j < dropShapes.length; j++) { if (dropShapes[j].lane === laneIndex && dropShapes[j].row === row && !dropShapes[j].isMoving) { occupied = true; break; } } if (!occupied) { targetRow = row; break; } } } var targetY = gridStartY + targetRow * (cellSize + cellMargin) + cellSize / 2; shape.startDrop(laneIndex, gridStartY - 100, targetY); // No scaling animation to keep consistent size game.addChild(shape); dropShapes.push(shape); })(i); } } function checkMatches() { // Check middle row (row 2) for matches var middleRowShapes = []; for (var i = 0; i < dropShapes.length; i++) { if (dropShapes[i].row === 2) { middleRowShapes.push(dropShapes[i]); } } if (middleRowShapes.length < 2) return; // Count identical shapes (same color + same form) var shapeColorCount = {}; for (var i = 0; i < middleRowShapes.length; i++) { var shape = middleRowShapes[i]; shapeColorCount[shape.color + shape.shapeForm] = (shapeColorCount[shape.color + shape.shapeForm] || 0) + 1; } var points = 0; var matched = false; // Check for identical shapes: 4 = 250 points, 3 = 100 points, 2 = 50 points for (var key in shapeColorCount) { if (shapeColorCount[key] === 4) { points = 250; matched = true; break; } else if (shapeColorCount[key] === 3) { points = 100; matched = true; break; } else if (shapeColorCount[key] === 2) { points = 50; matched = true; break; } } if (matched) { LK.setScore(LK.getScore() + points); updateScore(); // Play different sound based on match count if (points === 250) { LK.getSound('4xMatch').play(); } else if (points === 100) { LK.getSound('3xMatch').play(); } else if (points === 50) { LK.getSound('2xMatch').play(); } // Enhanced visual feedback for wins var flashColor = points >= 250 ? 0xffd700 : points >= 100 ? 0xff6600 : 0xffffff; // Find which shapes actually contributed to the score var scoringShapes = []; var targetShapeType = ''; for (var key in shapeColorCount) { if (shapeColorCount[key] === 4 && points === 250 || shapeColorCount[key] === 3 && points === 100 || shapeColorCount[key] === 2 && points === 50) { targetShapeType = key; break; } } // Collect only the shapes that actually scored for (var i = 0; i < middleRowShapes.length; i++) { var shape = middleRowShapes[i]; if (shape.color + shape.shapeForm === targetShapeType) { scoringShapes.push(shape); } } // Animate only the scoring shapes for (var i = 0; i < scoringShapes.length; i++) { var shape = scoringShapes[i]; LK.effects.flashObject(shape, flashColor, 1000); // Add temporary scaling and glow effect (function (currentShape) { tween(currentShape, { scaleX: 1.8, scaleY: 1.8, alpha: 1.2 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { // Return to original size and alpha tween(currentShape, { scaleX: 1.0, scaleY: 1.0, alpha: 1.0 }, { duration: 200, easing: tween.easeIn }); } }); })(shape); } // Animate score text on big wins if (points >= 100) { tween(scoreTxt, { scaleX: 1.2, scaleY: 1.2 }, { duration: 200, onFinish: function onFinish() { tween(scoreTxt, { scaleX: 1.0, scaleY: 1.0 }, { duration: 200 }); } }); } } } function isGridFull() { for (var laneIndex = 0; laneIndex < 4; laneIndex++) { var occupiedRows = 0; for (var j = 0; j < dropShapes.length; j++) { if (dropShapes[j].lane === laneIndex && !dropShapes[j].isMoving) { occupiedRows++; } } if (occupiedRows >= 5) { return true; } } return false; } function shiftShapesDown() { isShifting = true; // Move all shapes down by one row var shapesToShift = 0; var shapesCompleted = 0; // Count shapes that need to be shifted for (var i = 0; i < dropShapes.length; i++) { if (!dropShapes[i].isMoving) { shapesToShift++; } } for (var i = 0; i < dropShapes.length; i++) { var shape = dropShapes[i]; if (!shape.isMoving) { shape.row += 1; var newTargetY = gridStartY + shape.row * (cellSize + cellMargin) + cellSize / 2; // Animate the shift down - much faster tween(shape, { y: newTargetY }, { duration: 120, // Much faster shift animation easing: tween.easeOut, onFinish: function onFinish() { shapesCompleted++; if (shapesCompleted >= shapesToShift) { isShifting = false; } } }); } } // Fallback to reset flag if no shapes to shift if (shapesToShift === 0) { isShifting = false; } } function cleanupOffscreenShapes() { for (var i = dropShapes.length - 1; i >= 0; i--) { var shape = dropShapes[i]; // Clean up shapes that go beyond the bottom of the 4x5 grid (row 5 and beyond) if (shape.row >= 5) { // No scaling animation to keep consistent size shape.destroy(); dropShapes.splice(i, 1); } } } var lastLeverPulled = false; var isDragging = false; var dragStartY = 0; var dragThreshold = 200; // Minimum drag distance to trigger slot var isShifting = false; // Flag to prevent lever pulling during animations // Add touch/drag functionality to game game.down = function (x, y, obj) { if (!isShifting) { isDragging = true; dragStartY = y; } }; game.move = function (x, y, obj) { if (isDragging && !isShifting) { var dragDistance = y - dragStartY; // If dragged down enough, trigger lever pull if (dragDistance > dragThreshold) { lever.pull(); isDragging = false; // Prevent multiple triggers during same drag } } }; game.up = function (x, y, obj) { isDragging = false; // Only allow lever handle to return up when touch is released if (lever.isPulled) { // Animate lever handle back up when released - much faster tween(lever.leverHandle, { y: -700 }, { duration: 30, easing: tween.easeOut, onFinish: function onFinish() { // Play lever release sound when handle reaches top LK.getSound('leverRelease').play(); // Spawn shapes immediately when handle reaches top if (isGridFull()) { shiftShapesDown(); cleanupOffscreenShapes(); // Spawn immediately after shift spawnShapes(); } else { spawnShapes(); } } }); lever.isPulled = false; } }; game.update = function () { // Check for completed drops and matches var allStopped = true; for (var i = 0; i < dropShapes.length; i++) { if (dropShapes[i].isMoving) { allStopped = false; break; } } if (allStopped && dropShapes.length > 0) { var hasNewlyStoppedShapes = false; for (var i = 0; i < dropShapes.length; i++) { if (dropShapes[i].row === 2 && !dropShapes[i].checked) { dropShapes[i].checked = true; hasNewlyStoppedShapes = true; } } if (hasNewlyStoppedShapes) { checkMatches(); } } cleanupOffscreenShapes(); }; updateScore();
===================================================================
--- original.js
+++ change.js
@@ -155,17 +155,31 @@
function spawnShapes() {
spawnNewShapes();
}
function spawnNewShapes() {
- // Staggered spawning for authentic slot machine feel
+ // Send exactly 4 shapes for testing - one in each lane
for (var i = 0; i < 4; i++) {
(function (laneIndex) {
- LK.setTimeout(function () {
- var shapeData = getRandomShape();
- var shape = new DropShape(shapeData.color + shapeData.form, shapeData.color, shapeData.form);
- shape.x = gridStartX + laneIndex * (cellSize + cellMargin) + cellSize / 2;
- // Find the lowest available position in this lane
- var targetRow = 4; // Start from bottom row
+ var shapeData = getRandomShape();
+ var shape = new DropShape(shapeData.color + shapeData.form, shapeData.color, shapeData.form);
+ shape.x = gridStartX + laneIndex * (cellSize + cellMargin) + cellSize / 2;
+ // Find the lowest available position in this lane
+ var targetRow = 4; // Start from bottom row
+ for (var row = 4; row >= 0; row--) {
+ var occupied = false;
+ for (var j = 0; j < dropShapes.length; j++) {
+ if (dropShapes[j].lane === laneIndex && dropShapes[j].row === row && !dropShapes[j].isMoving) {
+ occupied = true;
+ break;
+ }
+ }
+ if (!occupied) {
+ targetRow = row;
+ break;
+ }
+ }
+ // If bottom row is occupied, find next available row going up
+ if (targetRow === 4) {
for (var row = 4; row >= 0; row--) {
var occupied = false;
for (var j = 0; j < dropShapes.length; j++) {
if (dropShapes[j].lane === laneIndex && dropShapes[j].row === row && !dropShapes[j].isMoving) {
@@ -177,30 +191,14 @@
targetRow = row;
break;
}
}
- // If bottom row is occupied, find next available row going up
- if (targetRow === 4) {
- for (var row = 4; row >= 0; row--) {
- var occupied = false;
- for (var j = 0; j < dropShapes.length; j++) {
- if (dropShapes[j].lane === laneIndex && dropShapes[j].row === row && !dropShapes[j].isMoving) {
- occupied = true;
- break;
- }
- }
- if (!occupied) {
- targetRow = row;
- break;
- }
- }
- }
- var targetY = gridStartY + targetRow * (cellSize + cellMargin) + cellSize / 2;
- shape.startDrop(laneIndex, gridStartY - 100, targetY);
- // No scaling animation to keep consistent size
- game.addChild(shape);
- dropShapes.push(shape);
- }, 0); // No delay - instant spawning
+ }
+ var targetY = gridStartY + targetRow * (cellSize + cellMargin) + cellSize / 2;
+ shape.startDrop(laneIndex, gridStartY - 100, targetY);
+ // No scaling animation to keep consistent size
+ game.addChild(shape);
+ dropShapes.push(shape);
})(i);
}
}
function checkMatches() {
Corn. In-Game asset. 2d. High contrast. No shadows
Green apple. In-Game asset. 2d. High contrast. No shadows
Grape. In-Game asset. 2d. High contrast. No shadows
Green grape. In-Game asset. 2d. High contrast. No shadows
ekmek. In-Game asset. 2d. High contrast. No shadows
peynir. In-Game asset. 2d. High contrast. No shadows
meat. In-Game asset. 2d. High contrast. No shadows
fish. In-Game asset. 2d. High contrast. No shadows
red apple. In-Game asset. 2d. High contrast. No shadows
orange. In-Game asset. 2d. High contrast. No shadows
3d gray ball shiny. In-Game asset. 2d. High contrast. No shadows
200x800 inset corners box gray shiny. In-Game asset. 2d. High contrast. No shadows