Geary, David M. 1957-

Core HTML5 2D game programming / David Geary. - xxiii, 615 pages : illustrations ; 24 cm

Includes index.

Table of Contents -- About This eBook -- Title Page -- Copyright Page -- Contents -- Preface -- A Brief History of This Book -- How to Use This Book -- The Book's Exercises -- Source Code and Chapter-specific Versions of Snail Bait -- Prerequisites -- Your Game -- Online Resources -- Acknowledgments -- About the Author -- Introduction -- 1.1 Snail Bait -- 1.2 HTML5 Game Development Best Practices -- 1.3 Special Features -- 1.4 Snail Bait's HTML and CSS -- 1.5 Snail Bait's Humble Beginning -- 1.6 The Use of JavaScript in This Book -- 1.7 Conclusion -- 1.8 Exercises -- Raw Materials and Development Environment -- 2.1 Use Developer Tools -- 2.2 Obtain Assets -- 2.3 Use CSS Backgrounds -- 2.4 Generate Favicons -- 2.5 Shorten the Coding Cycle -- 2.6 Conclusion -- 2.7 Exercises -- Graphics and Animation -- 3.1 Draw Graphics and Images with the HTML5 canvas Element -- 3.2 Implement Smooth HTML5 Animations -- 3.3 Implement a Game Loop -- 3.4 Calculate Frame Rates -- 3.5 Scroll the Background -- 3.6 Create Time-Based Motion -- 3.7 Reverse Scroll Direction -- 3.8 Draw Animation Frames -- 3.9 Use Parallax to Create the Illusion of Depth -- 3.10 Conclusion -- 3.11 Exercises -- Infrastructure -- 4.1 Encapsulate Game Functions in a JavaScript Object -- 4.2 Understand JavaScript's Persnickety this Reference -- 4.3 Handle Keyboard Input -- 4.4 Pause or Resume the Game When the Player Presses the p Key -- 4.5 Freeze the Game to Ensure It Resumes Exactly Where It Left Off -- 4.6 Pause the Game When the Window Loses Focus -- 4.7 Resume a Paused Game with an Animated Countdown -- 4.8 Conclusion -- 4.9 Exercises -- Loading Screens -- 5.1 Define Snail Bait's Chrome -- 5.2 Fade Elements In and Out with CSS Transitions -- 5.3 Fade Any Element In or Out That Has a CSS Transition Associated with Its Opacity -- 5.4 Implement the Loading Screen -- 5.5 Reveal the Game -- 5.6 Conclusion -- 5.7 Exercises -- Sprites -- 6.1 Sprite Objects -- 6.2 Incorporate Sprites into a Game Loop -- 6.3 Implement Sprite Artists -- 6.4 Create and Initialize a Game's Sprites -- 6.5 Define Sprites with Metadata -- 6.6 Scroll Sprites -- 6.7 Conclusion -- 6.8 Exercises -- Sprite Behaviors -- 7.1 Behavior Fundamentals -- 7.2 Runner Behaviors -- 7.3 The Runner's Run Behavior -- 7.4 Flyweight Behaviors -- 7.5 Game-Independent Behaviors -- 7.6 Combine Behaviors -- 7.7 Conclusion -- 7.8 Exercises -- Time, Part I: Finite Behaviors and Linear Motion -- 8.1 Implement an Initial Jump Algorithm -- 8.2 Shift Responsibility for Jumping to the Runner -- 8.3 Implement the Jump Behavior -- 8.4 Time Animations with Stopwatches -- 8.5 Refine the Jump Behavior -- 8.6 Implement Linear Motion -- 8.7 Pause Behaviors -- 8.8 Conclusion -- 8.9 Exercises -- Time, Part II: Nonlinear Motion -- 9.1 Understand Time and Its Derivatives -- 9.2 Use Animation Timers and Easing Functions to Implement Nonlinear Jumping -- 9.3 Implement Animation Timers -- 9.4 Implement Easing Functions -- 9.5 Fine-tune Easing Functions -- 9.6 Implement a Realistic Bounce Behavior -- 9.7 Randomize Behaviors -- 9.8 Implement Nonlinear Color Changes with Animation Timers and Easing Functions -- 9.9 Conclusion -- 9.10 Exercises -- Time, Part III: Time Systems -- 10.1 Snail Bait's Time System -- 10.2 Create and Start the Time System -- 10.3 Incorporate the Time System into Snail Bait -- 10.4 Redefine the Current Time for Stopwatches and Animation Timers -- 10.5 Implement the Time System -- 10.6 Conclusion -- 10.7 Exercises -- Collision Detection -- 11.1 The Collision Detection Process -- 11.2 Collision Detection Techniques -- 11.3 Snail Bait's Collision Detection -- 11.4 Select Candidates for Collision Detection -- 11.5 Detect Collisions Between the Runner and Another Sprite -- 11.6 Process Collisions -- 11.7 Optimize Collision Detection -- 11.8 Monitor Collision Detection Performance -- 11.9 Implement Collision Detection Edge Cases -- 11.10 Conclusion -- 11.11 Exercises -- Gravity -- 12.1 Equip the Runner for Falling -- 12.2 Incorporate Gravity -- 12.3 Collision Detection, Redux -- 12.4 Conclusion -- 12.5 Exercises -- Sprite Animations and Special Effects -- 13.1 Implement Sprite Animations -- 13.2 Create Special Effects -- 13.3 Choreograph Effects -- 13.4 Conclusion -- 13.5 Exercises -- Sound and Music -- 14.1 Create Sound and Music Files -- 14.2 Load Music and Sound Effects -- 14.3 Specify Sound and Music Controls -- 14.4 Play Music -- 14.5 Play Music in a Loop -- 14.6 Play Sound Effects -- 14.7 Turn Sound On and Off -- 14.8 Conclusion -- 14.9 Exercises -- Mobile Devices -- 15.1 Run Snail Bait on Mobile Devices -- 15.2 Detect Mobile Devices -- 15.3 Scale Games to Fit Mobile Devices -- 15.4 Change Instructions Underneath the Game's Canvas -- 15.5 Change the Welcome Screen -- 15.6 Incorporate Touch Events -- 15.7 Work Around Sound Idiosyncrasies on Mobile Devices -- 15.8 Add an Icon to the Home Screen and Run Without Browser Chrome -- 15.9 Conclusion -- 15.10 Exercises -- Particle Systems -- 16.1 Smoking Holes -- 16.2 Use Smoking Holes -- 16.3 Implement Smoking Holes -- 16.4 Pause Smoking Holes -- 16.5 Conclusion -- 16.6 Exercises -- User Interface -- 17.1 Keep Score -- 17.2 Add a Lives Indicator -- 17.3 Display Credits -- 17.4 Tweet Player Scores -- 17.5 Warn Players When the Game Runs Slowly -- 17.6 Implement a Winning Animation -- 17.7 Conclusion -- 17.8 Exercises -- Developer Backdoor -- 18.1 Snail Bait's Developer Backdoor -- 18.2 The Developer Backdoor's HTML and CSS -- 18.3 Reveal and Hide the Developer Backdoor -- 18.4 Update the Developer Backdoor's Elements -- 18.5 Implement the Developer Backdoor's Checkboxes -- 18.6 Incorporate the Developer Backdoor Sliders -- 18.7 Implement the Backdoor's Ruler -- 18.8 Conclusion -- 18.9 Exercises -- On the Server: In-game Metrics, High Scores, and Deployment -- 19.1 Node.js and socket.io -- 19.2 Include socket.io JavaScript in Snail Bait -- 19.3 Create a Simple Server -- 19.4 Create a Socket on the Server -- 19.5 Start the Server -- 19.6 Create a Socket on the Client and Connect to the Server -- 19.7 Record In-game Metrics -- 19.8 Manage High Scores -- 19.9 Deploy Snail Bait -- 19.10 Upload Files to a Server -- 19.11 Conclusion -- 19.12 Exercises -- Epilogue: Bodega's Revenge -- 20.1 Design the User Interface -- 20.2 Create the Sprite Sheet -- 20.3 Instantiate the Game -- 20.4 Implement Sprites -- 20.5 Implement Sprite Behaviors -- 20.6 Draw the Bullet Canvas -- 20.7 Implement Touch-Based Controls for Mobile Devices -- 20.8 Conclusion -- 20.9 Exercises -- Glossary -- Index. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20.

013356424X 9780133564242

2014014836


HTML (Document markup language)
Computer games--Programming
Computer animation

QA76.76.H94 / G43 2015

006.74