fix darg v3 game scoring issue
parent
70d65c429f
commit
1075b9a85a
|
@ -550,7 +550,7 @@ import Layout from '../../layouts/Layout.astro';
|
|||
if (match !== undefined) {
|
||||
scoreTotal++;
|
||||
counter++;
|
||||
// console.log(`Score Total: ${scoreTotal}`);
|
||||
console.log(`Score Total: ${scoreTotal}`);
|
||||
return 'borderCorrect';
|
||||
} else {
|
||||
// console.log(`Score Total: ${scoreTotal}`);
|
||||
|
@ -578,6 +578,7 @@ import Layout from '../../layouts/Layout.astro';
|
|||
newBlock.on("dragend", () => {
|
||||
newBlock.setScale(1.0);
|
||||
let droppedOnTargetZone = false;
|
||||
|
||||
targetZones.forEach((targetZone, targetIndex) => {
|
||||
if (
|
||||
Phaser.Geom.Intersects.RectangleToRectangle(
|
||||
|
@ -590,8 +591,8 @@ import Layout from '../../layouts/Layout.astro';
|
|||
newBlock.disableInteractive();
|
||||
targetZone.block = newBlock;
|
||||
droppedBlocks.push(newBlock);
|
||||
if (isMatch(newBlock.texture.key, targetZone.name)) {
|
||||
}
|
||||
|
||||
// Call isMatch only once
|
||||
const borderCondition = isMatch(newBlock.texture.key, targetZone.name);
|
||||
targetZoneBorders[targetIndex].setTexture(borderCondition);
|
||||
} else {
|
||||
|
@ -607,11 +608,12 @@ import Layout from '../../layouts/Layout.astro';
|
|||
if (!droppedOnTargetZone) {
|
||||
newBlock.setPosition(block.x, block.y);
|
||||
}
|
||||
if (droppedBlocks.length === targetZones.length)
|
||||
{
|
||||
|
||||
if (droppedBlocks.length === targetZones.length) {
|
||||
displayResult(droppedBlocks);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
// retryButton = this.add.image(retryButtonWidth, retryButtonHeight, 'retryIcon')
|
||||
retryButton.setInteractive().on('pointerdown', () => {
|
||||
|
|
Loading…
Reference in New Issue