HTML and CSS Reference
In-Depth Information
The most straightforward is to have a server handle all of the play data and run checks be-
fore storing anything. The downside is it requires users to have an account to cross-refer-
ence play data with heavy-duty servers.
A less-used option is to hide a security code in your JavaScript files that AJAX uses as a
handshake with the database to see if the current game is valid. Or you can use a design
pattern that emulates private properties/variables in JavaScript. Although these two meth-
ods will work, they'll only temporarily prevent users from hacking your game.
If you're thinking that you'll have to develop your game in Flash or Java because of secur-
ity issues, then please realize that these systems also have security flaws.
Anyway, it's about how you program for security instead of the programming language
used to achieve it.
6.4.2. Adding opening and closing screens
When a user loads up your game, they must play immediately or lose. In order to let the
user begin the game, create a Welcome screen ( figure 6.9 ) that starts on click via an event
listener.
Figure 6.9. A simple Welcome screen that initiates gameplay through a click listener. All text and coloring are
created through Canvas.
 
Search WWH ::




Custom Search