demo reset

This commit is contained in:
dev sp
2023-12-19 12:59:24 +00:00
parent 23237ac9b0
commit 9edeb97f67
63 changed files with 399 additions and 176 deletions

View File

@@ -36,8 +36,9 @@ import Layout from "../../layouts/Layout.astro";
const game = new Phaser.Game(config);
const customWidth = window.innerWidth;
const customHeight = window.innerHeight;
let firstLayer, secondLayer;
let firstLayer, secondLayer, thirdLayer;
let graphics;
let animatedLetter;
let isDrawing = false;
let formattedDateTime;
let gameStartTime = "start time here";
@@ -236,6 +237,7 @@ import Layout from "../../layouts/Layout.astro";
}
});
hideButton.setInteractive().on('pointerdown', () => {
animatedLetter.stop();
isDemoButtonClicked = false;
firstScreen.setVisible(false);
hideButton.setVisible(false); // Hide the "Hide" button
@@ -260,6 +262,8 @@ import Layout from "../../layouts/Layout.astro";
});
demoButton.setInteractive().on('pointerdown', () => {
animatedLetter.setCurrentTime(0);
animatedLetter.play(true);
graphics.setVisible(false);
firstScreen.setVisible(true);
demoButton.setVisible(false); // Hide the "Demo" button
@@ -272,10 +276,10 @@ import Layout from "../../layouts/Layout.astro";
const baseFontSize = 20;
const responsiveFontSize = (window.innerWidth / 480) * baseFontSize;
const descrptText = this.add.text(screenCenterX, 90, 'Let`s learn how to write letter : t', { font: `${responsiveFontSize}px quicksand`, fill: '#7c4c23', fontWeight : 'bold'}).setOrigin(0.5);
const animatedLetter = this.add.video(customWidth / 2 , customHeight / 2 + animatedTHeight, 'animatedT').setDepth(2).setScale(animatedVideoScale);
animatedLetter = this.add.video(customWidth / 2 , customHeight / 2 + animatedTHeight, 'animatedT').setDepth(2).setScale(animatedVideoScale);
// Play the video
animatedLetter.play();
// animatedLetter.play();
animatedLetter.setVisible(false);
// You can set additional properties for the video, such as loop and mute:
@@ -312,7 +316,6 @@ import Layout from "../../layouts/Layout.astro";
let firstDragStartPoint = { x: 0, y: 0 };
let secondDragStartPoint = { x: 0, y: 0 };
// ...
// Add this code for firstLayer
firstLayer.on('dragstart', (pointer) => {