Multiplayer Game Development With HTML5 by Rodrigo Silveira

Multiplayer Game Development With HTML5 by Rodrigo Silveira

Author:Rodrigo Silveira [Silveira, Rodrigo]
Language: eng
Format: epub
Tags: Web, Computers, Programming Languages, JavaScript, Html, Design
ISBN: 9781785288203
Google: zJ-9CQAAQBAJ
Publisher: Packt Publishing Ltd
Published: 2015-05-29T21:06:08+00:00


Since the initial game screen is the lobby, and the markup for the lobby is already visible, we don't do anything else to set it up. We simply register a socket callback to be invoked when we receive a list of available rooms and create individual HTML nodes with event listeners for each, attaching them to the DOM when we're ready.

Inside a different socket callback function, this time the one associated with the roomJoined custom event, we first make the lobby screen invisible, and then we make the main screen visible. We do this by adding and removing a CSS class named hidden, whose definition is shown in the following code snippet:

// ch3/snake-ch3/public/css/style.css .hidden { display: none; }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.