Skip to Content
Full-Stack React Projects - Second Edition
book

Full-Stack React Projects - Second Edition

by Shama Hoque
April 2020
Intermediate to advanced
716 pages
18h 55m
English
Packt Publishing
Content preview from Full-Stack React Projects - Second Edition

Game completed state

Every time an answerObject is collected, we will check whether the total number of collected items is equal to the total number of objects in the answerObjects array to determine whether the game is complete. We will achieve this by calling the checkGameCompleteStatus method, which will perform this check, as shown in the following code:

/MERNVR/index.js

checkGameCompleteStatus = (collectedTotal) => {    if (collectedTotal == this.state.game.answerObjects.length) {      AudioModule.playEnvironmental({        source: asset('happy-bot.mp3'),        loop: true      })      this.setState({hide: 'flex', hmMatrix: VrHeadModel.getHeadMatrix()})    }}

In this method, we first confirm that the game is indeed complete, and then we perform the following actions: ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Full-Stack React Projects

Full-Stack React Projects

Shama Hoque
React Native - The Practical Guide

React Native - The Practical Guide

Academind by Maximilian Schwarzmüller GmbH

Publisher Resources

ISBN: 9781839215414Supplemental Content