From 8ab2d8c1fed8d00d7e5847de3bb4e4d38631a5b4 Mon Sep 17 00:00:00 2001 From: Dennis Schoepf Date: Mon, 2 Aug 2021 22:18:34 +0200 Subject: [PATCH] Help messages in overview and detail screen --- src/scenes/DetailScene.ts | 25 +++++++++++++++++++++++++ src/store.ts | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/scenes/DetailScene.ts b/src/scenes/DetailScene.ts index 47aa3c2..e904224 100644 --- a/src/scenes/DetailScene.ts +++ b/src/scenes/DetailScene.ts @@ -14,6 +14,9 @@ export class DetailScene { revealables: RevealableInterface[]; revealableCoords: Coordinates[]; revealableObjects: Revealable[]; + startTime?: number = null; + wasInteractedWith: boolean = false; + wasHovered: boolean = false; constructor() { this.player = new Player(); @@ -35,6 +38,26 @@ export class DetailScene { } draw() { + if (this.startTime === null) { + this.startTime = mp5.millis(); + } + + if (mp5.millis() > this.startTime + 3000 && !this.wasInteractedWith) { + console.log('3 seconds without interaction'); + this.wasInteractedWith = true; + store.getState().addUserMessage({ + inputWanted: false, + text: 'Trouble knowing what to do? You should try clicking somewhere in order to spawn reveal bubbles. Try this in different parts of the canvas to see what you can find', + }); + } else if (mp5.millis() > this.startTime + 6000 && !this.wasHovered && this.wasInteractedWith) { + console.log('3 seconds without hovering'); + this.wasHovered = true; + store.getState().addUserMessage({ + inputWanted: false, + text: "Good job with your reveal bubbles, in order to truly find out what is important in this part of the project, try to catch the revealed objects with your character's head to be able to interact with them.", + }); + } + mp5.background(mp5.color(colors.greyLighter)); this.player.drawOnReveal(); @@ -66,9 +89,11 @@ export class DetailScene { onSceneClick() { this.revealableObjects.forEach((revObj) => { if (revObj.isHovered) { + this.wasHovered = true; revObj.onClick(); } else { this.player.reveal(); + this.wasInteractedWith = true; } }); } diff --git a/src/store.ts b/src/store.ts index 2d1eb18..bc5edf5 100644 --- a/src/store.ts +++ b/src/store.ts @@ -26,7 +26,7 @@ export interface State { const store = create( devtools((set) => ({ - currentIntroStep: 1, + currentIntroStep: 0, currentScene: Scenes.OVERVIEW, currentSubproject: null, participantAnonymous: false,