User prompt
Kolu biraz uzun yap ve sola al
User prompt
Hucreleri 300x300 yap. Biraz sola kaydir
User prompt
hucre aralarını biraz daha ac
User prompt
Gridlines kaldır
User prompt
Simdi herbir cell assetini 4x5 seklinde ve aralarinda boşluk bırakarak yerlestir
User prompt
Lane background yarine cell de ismine assetin
User prompt
Lane asseti kare yap
User prompt
laneleri 4x5 ve kare formunda ayrica aralarinda yatay ve dikeyde bosluk birak
User prompt
Asagiya kadar uzamasın.
User prompt
Her kare arasında 5 piksel margin olsun
User prompt
Kolu uzat ve biraz sağa al. Grid 4x5 kareden oluşsun.
User prompt
Gridlerin hucreleri arasinda belirgin bosluklar olsun
User prompt
Buna göre eksikleri tamamla ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Roulette Drop - Color Match Casino
Initial prompt
Kollu bir rulet oyunu yapmak istiyorum. Yukardan aşağıya 4 şerit yol gibi ve 6 esit yatay çuzgili grid cız her serit farklı renkli dikdörtgönler olsun 6 esit cizgi yerine 5 adet soldan saga dikdortgenleri alt alta koyup ayni bir grid mantigi arkaplan olustur. Yukaridan her 4 seritten farkli renkli sekiller spawn olsun ve grid deki her bir hücreye gelecek sekilde aşagiya kayıp ekran dısina cıkinca bellekten silinsinler. Tüm bu hareketler spawn olma akma ve kaybolma sagdaki kolu çekince başlasin ve hizlıdan yavasa akış dursun ortadaki grid hücrekerindeki sekiller 4 aynı sekil ise 100 puan , 4 ayni sekil ve renkler de ayniysa 1000 puan , 3 sekilse 50 puan, 3 ssekil ayni ve aybi renk ise 300 puan alsin.
/**** * 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 = 8; self.isMoving = true; // Add slot machine spinning effect tween(self, { rotation: Math.PI * 4 }, { duration: 2000, easing: tween.easeOut }); }; self.update = function () { if (self.isMoving) { self.y += self.speed; // Realistic slot machine deceleration var distanceToTarget = Math.abs(self.targetY - self.y); if (distanceToTarget < 150) { self.speed = Math.max(0.5, self.speed * 0.85); } // Stop at target with bounce effect if (self.y >= self.targetY) { self.y = self.targetY; self.isMoving = false; self.speed = 0; // Add settling bounce animation tween(self, { scaleY: 0.9 }, { duration: 100, onFinish: function onFinish() { tween(self, { scaleY: 1.0 }, { duration: 150, easing: tween.bounceOut }); } }); // Calculate which row this shape is in self.row = Math.floor((self.y - gridStartY) / cellHeight); } } }; 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 }); var leverHandle = self.attachAsset('leverHandle', { anchorX: 0.5, anchorY: 0.5 }); leverHandle.y = -250; self.pull = function () { if (!self.canPull) return; self.canPull = false; self.isPulled = true; LK.getSound('leverPull').play(); // Add lever base animation for more realistic feel tween(leverBase, { rotation: 0.1 }, { duration: 100 }); // Animate lever pull with bounce effect tween(leverHandle, { y: -150, scaleX: 1.1, scaleY: 0.9 }, { duration: 200, easing: tween.easeIn, onFinish: function onFinish() { tween(leverHandle, { y: -250, scaleX: 1.0, scaleY: 1.0 }, { duration: 300, easing: tween.bounceOut, onFinish: function onFinish() { tween(leverBase, { rotation: 0 }, { duration: 200 }); self.isPulled = false; self.canPull = true; } }); } }); }; self.down = function (x, y, obj) { self.pull(); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2a1810 }); /**** * Game Code ****/ var lanes = []; var dropShapes = []; var gridStartX = 300; var gridStartY = 600; var laneWidth = 400; var cellHeight = 200; var shapeTypes = ['red', 'blue', 'green', 'yellow']; var shapeForms = ['Shape', 'Circle']; var lever; var scoreTxt; // Create lane backgrounds for (var i = 0; i < 4; i++) { var laneBack = LK.getAsset('laneBackground', { anchorX: 0.5, anchorY: 0, alpha: 0.3 }); laneBack.x = gridStartX + i * laneWidth; laneBack.y = gridStartY; game.addChild(laneBack); lanes.push(laneBack); } // Add horizontal grid lines for slot machine appearance for (var row = 0; row <= 5; row++) { var gridLine = LK.getAsset('laneBackground', { width: 1600, height: 4, anchorX: 0.5, anchorY: 0.5, alpha: 0.5 }); gridLine.x = gridStartX + 1.5 * laneWidth; gridLine.y = gridStartY + row * cellHeight; game.addChild(gridLine); } // Highlight middle row (winning line) var winLine = LK.getAsset('laneBackground', { width: 1600, height: 8, color: 0xffd700, anchorX: 0.5, anchorY: 0.5, alpha: 0.7 }); winLine.x = gridStartX + 1.5 * laneWidth; winLine.y = gridStartY + 2 * cellHeight; game.addChild(winLine); // Create lever lever = game.addChild(new Lever()); lever.x = 1800; 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() { // Staggered spawning for authentic slot machine feel 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 * laneWidth; // Find the lowest available position in this lane var targetRow = 0; 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) { occupied = true; break; } } if (!occupied) { targetRow = row; break; } } var targetY = gridStartY + targetRow * cellHeight + cellHeight / 2; shape.startDrop(laneIndex, gridStartY - 100, targetY); // Add initial scale animation shape.scaleX = 0.5; shape.scaleY = 0.5; tween(shape, { scaleX: 1.0, scaleY: 1.0 }, { duration: 300, easing: tween.bounceOut }); game.addChild(shape); dropShapes.push(shape); }, i * 150); // Stagger by 150ms per lane })(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 < 3) return; // Count shapes by type and color var shapeCount = {}; var colorCount = {}; var shapeColorCount = {}; for (var i = 0; i < middleRowShapes.length; i++) { var shape = middleRowShapes[i]; shapeCount[shape.shapeForm] = (shapeCount[shape.shapeForm] || 0) + 1; colorCount[shape.color] = (colorCount[shape.color] || 0) + 1; shapeColorCount[shape.color + shape.shapeForm] = (shapeColorCount[shape.color + shape.shapeForm] || 0) + 1; } var points = 0; var matched = false; // Check for 4 same shapes + colors = 1000 points for (var key in shapeColorCount) { if (shapeColorCount[key] === 4) { points = 1000; matched = true; break; } } // Check for 4 same shapes = 100 points if (!matched) { for (var key in shapeCount) { if (shapeCount[key] === 4) { points = 100; matched = true; break; } } } // Check for 3 same shapes + colors = 300 points if (!matched) { for (var key in shapeColorCount) { if (shapeColorCount[key] === 3) { points = 300; matched = true; break; } } } // Check for 3 same shapes = 50 points if (!matched) { for (var key in shapeCount) { if (shapeCount[key] === 3) { points = 50; matched = true; break; } } } if (matched) { LK.setScore(LK.getScore() + points); updateScore(); LK.getSound('scoreMatch').play(); // Enhanced visual feedback for wins var flashColor = points >= 1000 ? 0xffd700 : points >= 300 ? 0xff6600 : 0xffffff; for (var i = 0; i < middleRowShapes.length; i++) { var shape = middleRowShapes[i]; LK.effects.flashObject(shape, flashColor, 1000); // Add pulsing animation for winning shapes tween(shape, { scaleX: 1.3, scaleY: 1.3 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { tween(shape, { scaleX: 1.0, scaleY: 1.0 }, { duration: 200 }); } }); } // Animate score text on big wins if (points >= 300) { tween(scoreTxt, { scaleX: 1.2, scaleY: 1.2 }, { duration: 200, onFinish: function onFinish() { tween(scoreTxt, { scaleX: 1.0, scaleY: 1.0 }, { duration: 200 }); } }); } } } function cleanupOffscreenShapes() { for (var i = dropShapes.length - 1; i >= 0; i--) { var shape = dropShapes[i]; if (shape.y > gridStartY + 5 * cellHeight + 100) { shape.destroy(); dropShapes.splice(i, 1); } } } var lastLeverPulled = false; game.update = function () { // Check if lever was pulled var currentLeverPulled = lever.isPulled; if (!lastLeverPulled && currentLeverPulled) { spawnShapes(); } lastLeverPulled = currentLeverPulled; // 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
@@ -26,22 +26,43 @@
self.y = startY;
self.targetY = endY;
self.speed = 8;
self.isMoving = true;
+ // Add slot machine spinning effect
+ tween(self, {
+ rotation: Math.PI * 4
+ }, {
+ duration: 2000,
+ easing: tween.easeOut
+ });
};
self.update = function () {
if (self.isMoving) {
self.y += self.speed;
- // Slow down as approaching target
+ // Realistic slot machine deceleration
var distanceToTarget = Math.abs(self.targetY - self.y);
- if (distanceToTarget < 100) {
- self.speed = Math.max(1, self.speed * 0.9);
+ if (distanceToTarget < 150) {
+ self.speed = Math.max(0.5, self.speed * 0.85);
}
- // Stop at target
+ // Stop at target with bounce effect
if (self.y >= self.targetY) {
self.y = self.targetY;
self.isMoving = false;
self.speed = 0;
+ // Add settling bounce animation
+ tween(self, {
+ scaleY: 0.9
+ }, {
+ duration: 100,
+ onFinish: function onFinish() {
+ tween(self, {
+ scaleY: 1.0
+ }, {
+ duration: 150,
+ easing: tween.bounceOut
+ });
+ }
+ });
// Calculate which row this shape is in
self.row = Math.floor((self.y - gridStartY) / cellHeight);
}
}
@@ -65,19 +86,36 @@
if (!self.canPull) return;
self.canPull = false;
self.isPulled = true;
LK.getSound('leverPull').play();
- // Animate lever pull
+ // Add lever base animation for more realistic feel
+ tween(leverBase, {
+ rotation: 0.1
+ }, {
+ duration: 100
+ });
+ // Animate lever pull with bounce effect
tween(leverHandle, {
- y: -150
+ y: -150,
+ scaleX: 1.1,
+ scaleY: 0.9
}, {
duration: 200,
+ easing: tween.easeIn,
onFinish: function onFinish() {
tween(leverHandle, {
- y: -250
+ y: -250,
+ scaleX: 1.0,
+ scaleY: 1.0
}, {
duration: 300,
+ easing: tween.bounceOut,
onFinish: function onFinish() {
+ tween(leverBase, {
+ rotation: 0
+ }, {
+ duration: 200
+ });
self.isPulled = false;
self.canPull = true;
}
});
@@ -121,8 +159,33 @@
laneBack.y = gridStartY;
game.addChild(laneBack);
lanes.push(laneBack);
}
+// Add horizontal grid lines for slot machine appearance
+for (var row = 0; row <= 5; row++) {
+ var gridLine = LK.getAsset('laneBackground', {
+ width: 1600,
+ height: 4,
+ anchorX: 0.5,
+ anchorY: 0.5,
+ alpha: 0.5
+ });
+ gridLine.x = gridStartX + 1.5 * laneWidth;
+ gridLine.y = gridStartY + row * cellHeight;
+ game.addChild(gridLine);
+}
+// Highlight middle row (winning line)
+var winLine = LK.getAsset('laneBackground', {
+ width: 1600,
+ height: 8,
+ color: 0xffd700,
+ anchorX: 0.5,
+ anchorY: 0.5,
+ alpha: 0.7
+});
+winLine.x = gridStartX + 1.5 * laneWidth;
+winLine.y = gridStartY + 2 * cellHeight;
+game.addChild(winLine);
// Create lever
lever = game.addChild(new Lever());
lever.x = 1800;
lever.y = 1400;
@@ -144,31 +207,46 @@
form: form
};
}
function spawnShapes() {
+ // Staggered spawning for authentic slot machine feel
for (var i = 0; i < 4; i++) {
- var shapeData = getRandomShape();
- var shape = new DropShape(shapeData.color + shapeData.form, shapeData.color, shapeData.form);
- shape.x = gridStartX + i * laneWidth;
- // Find the lowest available position in this lane
- var targetRow = 0;
- for (var row = 4; row >= 0; row--) {
- var occupied = false;
- for (var j = 0; j < dropShapes.length; j++) {
- if (dropShapes[j].lane === i && dropShapes[j].row === row) {
- occupied = true;
- break;
+ (function (laneIndex) {
+ LK.setTimeout(function () {
+ var shapeData = getRandomShape();
+ var shape = new DropShape(shapeData.color + shapeData.form, shapeData.color, shapeData.form);
+ shape.x = gridStartX + laneIndex * laneWidth;
+ // Find the lowest available position in this lane
+ var targetRow = 0;
+ 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) {
+ occupied = true;
+ break;
+ }
+ }
+ if (!occupied) {
+ targetRow = row;
+ break;
+ }
}
- }
- if (!occupied) {
- targetRow = row;
- break;
- }
- }
- var targetY = gridStartY + targetRow * cellHeight + cellHeight / 2;
- shape.startDrop(i, gridStartY - 100, targetY);
- game.addChild(shape);
- dropShapes.push(shape);
+ var targetY = gridStartY + targetRow * cellHeight + cellHeight / 2;
+ shape.startDrop(laneIndex, gridStartY - 100, targetY);
+ // Add initial scale animation
+ shape.scaleX = 0.5;
+ shape.scaleY = 0.5;
+ tween(shape, {
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 300,
+ easing: tween.bounceOut
+ });
+ game.addChild(shape);
+ dropShapes.push(shape);
+ }, i * 150); // Stagger by 150ms per lane
+ })(i);
}
}
function checkMatches() {
// Check middle row (row 2) for matches
@@ -232,12 +310,47 @@
if (matched) {
LK.setScore(LK.getScore() + points);
updateScore();
LK.getSound('scoreMatch').play();
- // Flash the middle row shapes
+ // Enhanced visual feedback for wins
+ var flashColor = points >= 1000 ? 0xffd700 : points >= 300 ? 0xff6600 : 0xffffff;
for (var i = 0; i < middleRowShapes.length; i++) {
- LK.effects.flashObject(middleRowShapes[i], 0xffffff, 500);
+ var shape = middleRowShapes[i];
+ LK.effects.flashObject(shape, flashColor, 1000);
+ // Add pulsing animation for winning shapes
+ tween(shape, {
+ scaleX: 1.3,
+ scaleY: 1.3
+ }, {
+ duration: 300,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ tween(shape, {
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 200
+ });
+ }
+ });
}
+ // Animate score text on big wins
+ if (points >= 300) {
+ tween(scoreTxt, {
+ scaleX: 1.2,
+ scaleY: 1.2
+ }, {
+ duration: 200,
+ onFinish: function onFinish() {
+ tween(scoreTxt, {
+ scaleX: 1.0,
+ scaleY: 1.0
+ }, {
+ duration: 200
+ });
+ }
+ });
+ }
}
}
function cleanupOffscreenShapes() {
for (var i = dropShapes.length - 1; i >= 0; i--) {
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