Core HTML5 2D Game Programming (häftad)
Fler böcker inom
Häftad (Paperback)
Antal sidor
Prentice Hall
228 x 177 x 25 mm
839 g
Antal komponenter

Core HTML5 2D Game Programming

Häftad, Engelska, 2014-07-28
356 kr
Skickas inom 3-6 vardagar.
Fri frakt inom Sverige för privatpersoner.
Finns även som
Visa alla 1 format & utgåvor
Game programming offers a wealth of creative and business opportunities, and its never been more accessible. In Core HTML5 2D Game Programming, best-selling author David Geary shows you how to use freely available browser tools and open source resources to create video games that run in desktop browsers and on mobile devices.


Geary walks you step by step through every aspect of implementing a sophisticated arcade-style game entirely from scratch, without using proprietary game frameworks. Packed with code, this full-color tutorial gives you the in-depth understanding you need to design and build any kind of HTML5 2D game on your own, whether you use a framework or not.


A clearly written, accessible, and exhaustive guide to implementing games, this book leaves no stone unturned, showing you how to

  • Create smooth, flicker-free animations
  • Implement motion thats unaffected by your games underlying animation frame rate
  • Animate sprites (graphical objects) to make them sparkle, explode, etc.
  • Layer multi-channel sound effects on top of a soundtrack
  • Warp time to create nonlinear effects, such as jumping or bouncing
  • Control the flow of time through your game with a time system
  • Implement particle systems that simulate natural phenomena
  • Efficiently detect collisions between sprites
  • Create a developer backdoor containing special features
  • Use Node.js and to transfer real-time metrics to a server
  • Employ a heads-up display to show high scores stored on a server
  • Understand the nuances of implementing HTML5 games for mobile devices
Through expertly written code thats easy to understand, and prose that cuts to the chase, Geary illuminates every corner of game development. Everyone from novice game programmers to professional game developers will find this book invaluable as both a tutorial and a reference.


All of the books source code, including chapter-specific versions of the game discussed in the book, are available at
Visa hela texten

Passar bra ihop

  1. Core HTML5 2D Game Programming
  2. +
  3. Core JavaServer Faces

De som köpt den här boken har ofta också köpt Core JavaServer Faces av David Geary, Cay S Horstmann (häftad).

Köp båda 2 för 879 kr


Har du läst boken? Sätt ditt betyg »

Bloggat om Core HTML5 2D Game Programming

Övrig information

David Geary, a prominent author, speaker, and consultant, is a leading expert on advanced web application development. He's the author of eight Java books, including the industry's best-selling guides to Swing and JavaServer Faces, and he co-founded the HTML5 Denver User's Group. A three-time JavaOne Rock Star, he speaks frequently at conferences. Follow him on Twitter at @davidgeary.


Preface xv

Acknowledgments xxi

About the Author xxiii


Chapter 1: Introduction 1

1.1 Snail Bait 3

1.2 HTML5 Game Development Best Practices 10

1.3 Special Features 16

1.4 Snail Baits HTML and CSS 18

1.5 Snail Baits Humble Beginning 25

1.6 The Use of JavaScript in This Book 28

1.7 Conclusion 31

1.8 Exercises 31


Chapter 2: Raw Materials and Development Environment 33

2.1 Use Developer Tools 35

2.2 Obtain Assets 50

2.3 Use CSS Backgrounds 54

2.4 Generate Favicons 56

2.5 Shorten the Coding Cycle 58

2.6 Conclusion 59

2.7 Exercises 60


Chapter 3: Graphics and Animation 61

3.1 Draw Graphics and Images with the HTML5 canvas Element 64

3.2 Implement Smooth HTML5 Animations 70

3.3 Implement a Game Loop 75

3.4 Calculate Frame Rates 77

3.5 Scroll the Background 78

3.6 Create Time-Based Motion 85

3.7 Reverse Scroll Direction 86

3.8 Draw Animation Frames 86

3.9 Use Parallax to Create the Illusion of Depth 87

3.10 Conclusion 90

3.11 Exercises 90


Chapter 4: Infrastructure 93

4.1 Encapsulate Game Functions in a JavaScript Object 95

4.2 Understand JavaScripts Persnickety this Reference 100

4.3 Handle Keyboard Input 103

4.4 Pause or Resume the Game When the Player Presses the p Key 105

4.5 Freeze the Game to Ensure It Resumes Exactly Where It Left Off 107

4.6 Pause the Game When the Window Loses Focus 108

4.7 Resume a Paused Game with an Animated Countdown 110

4.8 Conclusion 115

4.9 Exercises 116


Chapter 5: Loading Screens 117

5.1 Define Snail Baits Chrome 120

5.2 Fade Elements In and Out with CSS Transitions 123

5.3 Fade Any Element In or Out That Has a CSS Transition Associated with Its Opacity 132

5.4 Implement the Loading Screen 135

5.5 Reveal the Game 140

5.6 Conclusion 144

5.7 Exercises 144


Chapter 6: Sprites 147

6.1 Sprite Objects 149

6.2 Incorporate Sprites into a Game Loop 156

6.3 Implement Sprite Artists 160

6.4 Create and Initialize a Games Sprites 167

6.5 Define Sprites with Metadata 171

6.6 Scroll Sprites 174

6.7 Conclusion 176

6.8 Exercises 177


Chapter 7: Sprite Behaviors 179

7.1 Behavior Fundamentals 182

7.2 Runner Behaviors 184

7.3 The Runners Run Behavior 187

7.4 Flyweight Behaviors 190

7.5 Game-Independent Behaviors 193

7.6 Combine Behaviors 199

7.7 Conclusion 205

7.8 Exercises 206


Chapter 8: Time, Part I: Finite Behaviors and Linear Motion 207

8.1 Implement an Initial Jump Algorithm 209...