Code edit (1 edits merged)
Please save this source code
User prompt
it only goes down once then even though i stack more blocks it doesnt go down anymore. i think it is because you only go down when it intersects with baseBlock. fix that
Code edit (4 edits merged)
Please save this source code
User prompt
the issue persists. it still doesnt slide down after first time. please fix that
User prompt
for the effect of going up. slide base block and the blocks stacked upon it to down everytime a block makes contact
User prompt
make the blocks drop faster
User prompt
remove the code where it removes block when exceedes 5.
User prompt
when you align it perfectly make a sound
User prompt
when base block slides down, the blockes stacked on it doesnt go down with it. it just hangs in air. fix that please
Code edit (4 edits merged)
Please save this source code
User prompt
instead of blocks going down maybe just base block should go down and the blocks stacked will follow
Code edit (1 edits merged)
Please save this source code
User prompt
add base block to the 5 condition so it pushes down too because it prevents other go down.
User prompt
they just weridly cramp together. last block is not pushed to out ot screen due to base block. so please make sure base block goes down too.
User prompt
okay they dont slide out of the scene due to base block. can you fix it
User prompt
instead of removing the last block when exceedes 5 maybe just slide them out of the scene
User prompt
removing block when exceedes 5 doesnt work right. the block diseapears but then it comes back.
User prompt
when i drop a block from a crane, new block is apearing immediately which is not good. you should add an animation where crane gets that new block delayed, maybe it can take it from somewhere ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
when i drop a block there should be an animation where crane brings another block from outside of the scene
User prompt
increase swinging range meaning wiggling block should be more at the bottom
User prompt
increase the range and increase length of the rope
User prompt
when faulty alignment is close to right it does rotate and fall to right but when it is vice versa it still rotates and falls to right.
User prompt
use base_block asset for base block also make it bigger.
User prompt
maybe it should spin or something change rotation and trajectory when the block falls due to wrong alignment before game over.
User prompt
maybe it should spin or something change rotation and trajectory.
===================================================================
--- original.js
+++ change.js
@@ -64,11 +64,8 @@
var crane = game.addChild(new Crane());
var baseBlock = game.addChild(new BaseBlock());
baseBlock.x = 2048 / 2;
baseBlock.y = 2732 - baseBlock.height / 2;
-var baseBlockInitialY = baseBlock.y; // Store the initial Y position
-var baseBlockMoveDownAmount = 50; // Adjust this value to control how much the base block moves down
-var baseBlockMinY = 2732 - baseBlock.height / 2 + 500; // Example limit, adjust as needed
crane.x = 2048 / 2;
crane.y = 50; // Move the crane up
var blocks = [];
var currentBlock = null;
@@ -102,15 +99,10 @@
blocks[i].y = baseBlock.y - baseBlock.height / 2 - blocks[i].height / 2;
towerHeight++;
LK.setScore(towerHeight);
scoreTxt.setText(LK.getScore());
- // Move the base block down every time a block makes contact
- baseBlock.y -= baseBlockMoveDownAmount;
- // Adjust the position of the already placed blocks to maintain their relative position
- for (var j = 0; j < blocks.length - 1; j++) {
- // Exclude the block that just landed
- blocks[j].y -= baseBlockMoveDownAmount;
- }
+ // Slide the base block down
+ baseBlock.y += 100; // Adjust this value as needed for block height
} else {
for (var j = 0; j < blocks.length; j++) {
if (i !== j && blocks[i].falling && blocks[j].y < 2732 && !blocks[j].falling && blocks[i].intersects(blocks[j])) {
if (Math.abs(blocks[i].x - blocks[j].x) > blocks[i].width / 4) {
@@ -131,8 +123,10 @@
}, 1000);
} else {
blocks[i].falling = false;
blocks[i].y = blocks[j].y - blocks[j].height / 2 - blocks[i].height / 2;
+ // Slide the base block down
+ baseBlock.y += 100; // Adjust this value as needed for block height
break;
}
}
}
@@ -161,16 +155,11 @@
if (currentBlock) {
currentBlock.update();
}
checkCollisions();
- // Game Over if base block goes too far down
- if (baseBlock.y > baseBlockMinY) {
- // Check if base block has gone beyond the minimum Y
- LK.getSound('gameover').play();
- LK.setTimeout(function () {
- LK.showGameOver();
- }, 1000);
- }
+ // Instead of removing blocks, we slide the base block down
+ // We only slide the base block when a new block is successfully placed.
+ // The logic for sliding is now in the checkCollisions function.
};
// Event listener for dropping blocks
game.down = function (x, y, obj) {
dropBlock();