User prompt
Çarpışma animasyonu ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Çarpışma animasyonu ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Çarpışma animasyonu ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Carpışma animasyonu ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Blok düşerken havada dönme animasyonu ekle fakat çarpışma alanına düz iner ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Taş dönme animasyonu carpma alanınanyaklaştıgında düzelir ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Çarpışma gerçekleştiginde dönme animasyonu durur ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Düşme sırasında blok dönme animasyonu ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Sallanma animasyonu için rüzgar efecti ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Carpışma animasyonu ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Sallanma yumuşak hareketlerle saglansın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Oyun görüntülerini bi tık küçült ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Sallantı Hızı her blokta degil 5 blokta bir hızlandır ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Oyıncu blok düşme süresi boyunca ekran dokunmayı iptal et
User prompt
Oyun nesneleri büyült ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Alt blok ve üst blok boyutunu büyülttügüm için çarpışma alanları bozuldu
User prompt
Keailme animasyonu yüzde 95 kadar parça kesiyorsa oyın biter ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
İp saga sola daha fazla sallanabilir ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Üst ip sallantısını giderek hızlandır ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Blok kayma animasyonunu yumuşat ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Kesme animasyonu resim varlıgı ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Blok kesme animasyonunu kaldır yeni bir tane ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Blok kırpma animasyonunu degiştir ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
6. Bloktan sonra alt blok kayma işlemini 3. Bloktan olarak degiştir
User prompt
Kırpma animasyon parçacık ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var CutPiece = Container.expand(function () { var self = Container.call(this); var piece = self.attachAsset('cutPiece', { anchorX: 0.5, anchorY: 0.5 }); self.animate = function (direction, blockWidth) { // Set initial appearance piece.alpha = 1; piece.width = blockWidth; // Animate piece falling and rotating var fallDirection = direction === 'left' ? -1 : 1; tween(self, { x: self.x + fallDirection * 400, y: self.y + 600, rotation: fallDirection * Math.PI * 2 }, { duration: 1200, easing: tween.easeIn }); tween(piece, { alpha: 0 }, { duration: 1200, easing: tween.linear, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); var StackedBlock = Container.expand(function () { var self = Container.call(this); var block = self.attachAsset('block', { anchorX: 0.5, anchorY: 0.5 }); return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87ceeb }); /**** * Game Code ****/ // Game state var stackedBlocks = []; var gameHeight = 2732; var gameWidth = 2048; var groundLevel = gameHeight - 120; var stackHeight = 0; var gameActive = true; // Create foundation block var foundation = new StackedBlock(); foundation.x = gameWidth / 2; foundation.y = gameHeight - 120; // Move to bottom of screen game.addChild(foundation); stackedBlocks.push(foundation); stackHeight = foundation.y; // Create rope hanging from top center var rope = LK.getAsset('rope', { anchorX: 0.5, anchorY: 0 }); rope.x = gameWidth / 2; rope.y = 0; // Rope starts at top of screen game.addChild(rope); // Create swinging block at the end of rope var swingingBlock = LK.getAsset('swingingBlock', { anchorX: 0.5, anchorY: 0.5 }); swingingBlock.x = 0; swingingBlock.y = rope.height + 100; // Extend the rope length by moving block further down rope.addChild(swingingBlock); // Natural pendulum swing variables var swingTime = 0; var swingSpeed = 0.03; // Controls swing speed var swingAmplitude = 0.6; // Controls swing range (max rotation) // Score display var scoreTxt = new Text2('Blocks: 0', { size: 80, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Touch handler to drop the block game.down = function (x, y, obj) { if (!gameActive || !swingingBlock.parent) return; // Get the current world position of the swinging block var worldPos = rope.toGlobal(swingingBlock.position); var gamePos = game.toLocal(worldPos); // Detach from rope and add to game rope.removeChild(swingingBlock); game.addChild(swingingBlock); // Set position in game coordinates swingingBlock.x = gamePos.x; swingingBlock.y = gamePos.y; // Add falling velocity swingingBlock.velocityY = 25; // Start with constant speed swingingBlock.falling = true; }; // Update function for falling blocks game.update = function () { // Update rope swing with natural pendulum motion if (rope && !swingingBlock.falling) { swingTime += swingSpeed; rope.rotation = Math.sin(swingTime) * swingAmplitude; // Add vertical swinging motion to the swinging block var verticalOffset = Math.cos(swingTime * 2) * 30; // Vertical swing with smaller amplitude swingingBlock.y = rope.height + 100 + verticalOffset; } if (swingingBlock.falling) { // Use constant falling speed instead of accelerating gravity swingingBlock.velocityY = 25; // Fixed falling speed swingingBlock.y += swingingBlock.velocityY; // Check collision with any stacked block using built-in intersects method var hasCollision = false; for (var i = 0; i < stackedBlocks.length; i++) { var block = stackedBlocks[i]; if (swingingBlock.intersects(block)) { hasCollision = true; break; } } if (hasCollision) { // Find the topmost block that the swinging block collided with var targetBlock = null; var highestY = gameHeight; for (var k = 0; k < stackedBlocks.length; k++) { if (swingingBlock.intersects(stackedBlocks[k]) && stackedBlocks[k].y < highestY) { targetBlock = stackedBlocks[k]; highestY = stackedBlocks[k].y; } } if (targetBlock) { // Check if block is close enough to the top of the target block to land var blockBottom = swingingBlock.y + swingingBlock.height / 2; var targetTop = targetBlock.y - targetBlock.height / 2; var landingDistance = Math.abs(blockBottom - targetTop); // Only land if we're within reasonable landing distance (less than falling speed) if (landingDistance <= 30) { // Award 1 point LK.setScore(LK.getScore() + 1); scoreTxt.setText('Blocks: ' + LK.getScore()); // Calculate collision overlap and trim the block var targetLeft = targetBlock.x - targetBlock.width / 2; var targetRight = targetBlock.x + targetBlock.width / 2; var swingingLeft = swingingBlock.x - swingingBlock.width / 2; var swingingRight = swingingBlock.x + swingingBlock.width / 2; // Find the overlapping area var overlapLeft = Math.max(targetLeft, swingingLeft); var overlapRight = Math.min(targetRight, swingingRight); var overlapWidth = overlapRight - overlapLeft; // Only proceed if there's actual overlap if (overlapWidth > 0) { // Place block exactly on top of target block swingingBlock.falling = false; swingingBlock.velocityY = 0; swingingBlock.y = targetBlock.y - 240; // Place exactly one block height above // Create cut pieces for trimmed parts var leftTrimmed = swingingLeft < overlapLeft; var rightTrimmed = swingingRight > overlapRight; if (leftTrimmed) { // Create cut piece for left trimmed part var leftCutPiece = new CutPiece(); game.addChild(leftCutPiece); var leftTrimWidth = overlapLeft - swingingLeft; leftCutPiece.x = swingingLeft + leftTrimWidth / 2; leftCutPiece.y = swingingBlock.y; leftCutPiece.animate('left', leftTrimWidth); } if (rightTrimmed) { // Create cut piece for right trimmed part var rightCutPiece = new CutPiece(); game.addChild(rightCutPiece); var rightTrimWidth = swingingRight - overlapRight; rightCutPiece.x = overlapRight + rightTrimWidth / 2; rightCutPiece.y = swingingBlock.y; rightCutPiece.animate('right', rightTrimWidth); } // Trim the block to only show the overlapping area var newCenterX = overlapLeft + overlapWidth / 2; swingingBlock.x = newCenterX; swingingBlock.width = overlapWidth; stackedBlocks.push(swingingBlock); } else { // No overlap, block falls off swingingBlock.falling = true; } // Update stack height to the new top stackHeight = swingingBlock.y; // After 2 blocks are placed (3rd block landing), start sliding all blocks down if (LK.getScore() > 2) { // Animate all blocks sliding down by one block height (240px) for (var b = 0; b < stackedBlocks.length; b++) { var block = stackedBlocks[b]; tween(block, { y: block.y + 240 }, { duration: 500 }); } // Get the bottom block for destruction after animation var bottomBlock = stackedBlocks[0]; // Set a timeout to destroy the bottom block after animation completes LK.setTimeout(function () { bottomBlock.destroy(); stackedBlocks.splice(0, 1); }, 500); } // Create new swinging block swingingBlock = LK.getAsset('swingingBlock', { anchorX: 0.5, anchorY: 0.5 }); swingingBlock.x = 0; swingingBlock.y = rope.height + 100; rope.addChild(swingingBlock); } else { // Not close enough to land - continue falling swingingBlock.falling = true; } } } // Check if block has fallen below the screen else if (swingingBlock.y > gameHeight + 200) { // Game over - player missed the target gameActive = false; LK.showGameOver(); } } }; ;
===================================================================
--- original.js
+++ change.js
@@ -7,9 +7,9 @@
* Classes
****/
var CutPiece = Container.expand(function () {
var self = Container.call(this);
- var piece = self.attachAsset('block', {
+ var piece = self.attachAsset('cutPiece', {
anchorX: 0.5,
anchorY: 0.5
});
self.animate = function (direction, blockWidth) {