change drawing v2, drag v2, drag v3
This commit is contained in:
@@ -480,7 +480,6 @@ import Layout from '../../layouts/Layout.astro';
|
||||
|
||||
newBlock.on("dragend", () => {
|
||||
newBlock.setScale(1.0).setDepth(-2);
|
||||
|
||||
let droppedOnTargetZone = false;
|
||||
|
||||
targetZones.forEach((targetZone, targetIndex) => {
|
||||
@@ -490,21 +489,24 @@ import Layout from '../../layouts/Layout.astro';
|
||||
new Phaser.Geom.Rectangle(targetZone.x, targetZone.y, 200, 100)
|
||||
)
|
||||
) {
|
||||
newBlock.setPosition(targetZone.x - 50, targetZone.y - 50); //backgroundColor:`#FF0000`
|
||||
newBlock.disableInteractive();
|
||||
targetZone.block = newBlock;
|
||||
droppedBlocks.push(newBlock);
|
||||
// newBlock.setPosition(targetZone.x - 50, targetZone.y - 50); //backgroundColor:`#FF0000`
|
||||
const col = counter % 2;
|
||||
const row = Math.floor(counter / 2);
|
||||
newBlock.setPosition(targetZone.x - col * (newBlock.width + 10), targetZone.y - row * (newBlock.height + 10));
|
||||
newBlock.disableInteractive();
|
||||
targetZone.block = newBlock;
|
||||
droppedBlocks.push(newBlock);
|
||||
|
||||
// Adjust isMatch function based on your requirements
|
||||
if (isMatch(newBlock.texture.key, targetZone.name)) {
|
||||
// Handle match logic if needed
|
||||
// Adjust isMatch function based on your requirements
|
||||
if (isMatch(newBlock.texture.key, targetZone.name)) {
|
||||
// Handle match logic if needed
|
||||
}
|
||||
|
||||
droppedOnTargetZone = true;
|
||||
targetZoneBorders[targetIndex].setVisible(true);
|
||||
targetZoneBorders[targetIndex].setAlpha(1);
|
||||
return;
|
||||
}
|
||||
|
||||
droppedOnTargetZone = true;
|
||||
targetZoneBorders[targetIndex].setVisible(true);
|
||||
targetZoneBorders[targetIndex].setAlpha(1);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
if (!droppedOnTargetZone) {
|
||||
|
||||
Reference in New Issue
Block a user