add eraser button and add start calculation logic

This commit is contained in:
Suvodip
2024-09-06 20:05:34 +05:30
parent 2fe965cd99
commit d2a1edd333
21 changed files with 291 additions and 139 deletions

View File

@@ -63,6 +63,7 @@ import Layout from '../../layouts/Layout.astro';
let formattedDateTime;
let shortUniqueID;
let scoreTotal = 0;
let maxScore = 4;
let resultView;
let topLogoWidth;
let muteIconWidth;
@@ -337,9 +338,9 @@ import Layout from '../../layouts/Layout.astro';
textSizeScale = 940
}
const screenCenterX = this.cameras.main.worldView.x + this.cameras.main.width / 2;
const baseFontSize = 24;
const baseFontSize = 20;
const responsiveFontSize = (window.innerWidth / textSizeScale) * baseFontSize;
const descrptText = this.add.text(screenCenterX, 90, data.description, { font: `${responsiveFontSize}px quicksand`, fill: '#60C6CB', align: "center", wordWrap: {width: window.innerWidth-wrapWidth}}, ).setOrigin(0.5);
const descrptText = this.add.text(screenCenterX, 110, data.description, { font: `${responsiveFontSize}px quicksand`, fill: '#60C6CB', align: "center", wordWrap: {width: window.innerWidth-wrapWidth}}, ).setOrigin(0.5);
// this.add.text(displayW / 14 - 15, 50, data.LearningArea, {font: `20px`}).setTint(0x7c4c23);
// this.add.text(displayW / 14 - 15, 70, data.LearningSubArea_copy, {font: `19px`}).setTint(0x7c4c23);
// Left Image Name
@@ -534,16 +535,16 @@ import Layout from '../../layouts/Layout.astro';
const isMatch = (blockName, targetName) => {
if(isMatch){
counter++;
// console.log(counter)
console.log(counter)
}
const match = blockMatches.find((m) => m.blockName === blockName && m.targetName === targetName);
// console.log(match)
if(match !== undefined){
scoreTotal++;
// console.log("Score Total", scoreTotal)
resultView = this.add.text(window.innerWidth / 2 - 100, window.innerHeight / 2 - 100, `Your Score: ${scoreTotal}`,{font: `24px`, fill: `#7c4c23`}).setVisible(false);
}
if(counter === 4){
resultView = this.add.text(window.innerWidth / 2 - 100, window.innerHeight / 2 - 100, `Your Score: ${scoreTotal}`,{font: `24px`, fill: `#7c4c23`}).setVisible(false);
const overlap = document.getElementById("overlap");
overlap.style.display = "block";
// console.log(counter)