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,8 +64,9 @@
var crane = game.addChild(new Crane());
var baseBlock = game.addChild(new BaseBlock());
baseBlock.x = 2048 / 2;
baseBlock.y = 2732 - baseBlock.height / 2;
+var initialBaseBlockY = baseBlock.y; // Store the initial Y position of the base block
crane.x = 2048 / 2;
crane.y = 50; // Move the crane up
var blocks = [];
var currentBlock = null;
@@ -84,8 +85,9 @@
var horizontalSpeed = Math.sin(crane.rotation) * crane.speed * 10; // Reduced scaling factor
currentBlock.momentum = horizontalSpeed;
blocks.push(currentBlock);
currentBlock = null;
+ LK.getSound('place').play(); // Play the place sound
}
}
// Function to check for collisions and update score
function checkCollisions() {
@@ -94,9 +96,9 @@
continue;
}
if (blocks[i].intersects(baseBlock)) {
blocks[i].falling = false;
- blocks[i].y = baseBlock.y - baseBlock.height / 2 - blocks[i].height / 2 - towerHeight * 100;
+ blocks[i].y = baseBlock.y - baseBlock.height / 2 - blocks[i].height / 2;
towerHeight++;
LK.setScore(towerHeight);
scoreTxt.setText(LK.getScore());
} else {
@@ -150,32 +152,29 @@
if (currentBlock) {
currentBlock.update();
}
checkCollisions();
- // Check if the number of blocks exceeds 5 and slide out the bottom block
+ // Check if the number of blocks exceeds a threshold and slide the base block down
if (blocks.length > 5) {
var fallingBlocks = blocks.filter(function (block) {
return block.falling;
});
if (fallingBlocks.length === 0) {
+ // Move the base block down
+ baseBlock.y += 5; // Adjust the speed of downward movement as needed
+ // Also slide out the bottom block as before
var bottomBlock = blocks.shift();
- // Slide out the bottom block
bottomBlock.x += 10;
- // Apply gravity to the remaining blocks
+ // Apply gravity to the remaining blocks, but only if they are above the original base position
for (var i = 0; i < blocks.length; i++) {
- if (!blocks[i].falling) {
+ if (!blocks[i].falling && blocks[i].y < initialBaseBlockY - baseBlock.height / 2 - blocks[i].height / 2) {
blocks[i].falling = true;
}
}
// Destroy the bottom block when it is out of the scene
if (bottomBlock.x > 2048 + bottomBlock.width) {
bottomBlock.destroy();
}
- // Slide out the base block
- baseBlock.y += 10;
- if (baseBlock.y > 2732 + baseBlock.height) {
- baseBlock.destroy();
- }
}
}
};
// Event listener for dropping blocks