You are previewing Foundation Game Design with HTML5 and JavaScript.
O'Reilly logo
Foundation Game Design with HTML5 and JavaScript

Book Description

Foundation Game Design with HTML5 and JavaScript teaches you everything you need to know about how to make video games. If you've never done any programming before and don't know where to start, this book will show you how to make games from start to finish. You'll learn all the latest programming technologies (HTML5, CSS, and JavaScript) to create your games. All written in a fun and friendly style with open-ended projects that encourage you to build your own original games.

Foundation Game Design with HTML5 and JavaScript starts by showing you how you can use basic programing to create logic games, adventure games, and create interactive game graphics. Design a game character, learn to control it with the keyboard, mouse, or touch screen interface, and then learn how to use collision detection to build an interactive game world. You'll learn to make maze games, platform jumping games, and fast paced action games that cover all the popular genres of 2D gaming. Create intelligent enemies, use realistic physics, sound effects and music, and learn how to animate game characters. Whether you're creating games for the web or mobile devices, everything you need to get started on a career as a game designer is right here.

  • Focused and friendly introduction to making games with HTML5.

  • Essential programming and graphic design techniques for building games, with each chapter gently building on the skills of preceding chapters.

  • Detailed case studies demonstrating techniques that can be used for making games in a wide variety of genres.

What you'll learn

  • Get a thorough grounding in HTML5 and good programming practices, with minimal prior programming experience required.

  • Discover how to build logic, adventure, and 2D action games in a wide range of genres.

  • Master collision detection, Enemy AI systems, player control, basic physics and easy trigonometry.

  • Make use of modern JavaScript programming techniques to build robust games that are quick to make, easy to maintain, and simple to extend.

  • Understand the strategies for making games fun to play and easy to build.

Who this book is for

Foundation Game Design with HTML5 and JavaScript is for a non-technical creative person who wants to learn the art of video game design, but has no idea where to start or where to look for help. It is a lucid, friendly and step-by-step guide though all the technical and creative issues involved in game design. This book treats programming as a creative artistic tool, and will help anyone who may be afraid of programming to love the subject as much as the author does. The techniques in the book are comprehensive enough to form the basis of a career as a game designer, and form a solid foundation for continued study of programming and graphic design for games. This book is the missing link that will guide and inspire any curious and creative person to turn a good game idea into a reality

Table of Contents

  1. Title
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Author
  6. About the Technical Reviewer
  7. About the Cover Image Artist
  8. Acknowledgments
  9. Introduction
  10. Chapter 1: Learning HTML and CSS
    1. What you need
    2. Learning HTML
    3. Make it prettier with CSS
    4. Loading background images into HTML elements
    5. Organizing your files
    6. Learning more about HTML and CSS
    7. Summary
  11. Chapter 2: Learning JavaScript
    1. Setting up
    2. Variables
    3. Controlling HTML and CSS
    4. Organizing your JavaScript code
    5. A quick guide to debugging code
    6. Summary
  12. Chapter 3: Your First Games
    1. A basic number-guessing game
    2. Polishing up
    3. Making really nice buttons
    4. Seeing the game
    5. Alien Attack!
    6. Summary
  13. Chapter 4: Creating a Game World
    1. Loops
    2. Using arrays for storing lots of information
    3. Making an adventure game
    4. The complete code listing
    5. Making your own game
    6. Summary
  14. Chapter 5: Making Maps
    1. Arrays inside arrays
    2. Case study: Island Adventure
    3. Summary
  15. Chapter 6: Game Objects and Animation
    1. Displaying images with canvas
    2. How to make objects
    3. Making copies of objects
    4. Object states
    5. Timed state changes
    6. Animation
    7. Monster Smash!
    8. Summary
  16. Chapter 7: Game Sprites
    1. Sprites
    2. requestAnimationFrame
    3. Making many sprites
    4. An interactive sprite
    5. An interactive sprite with rotation
    6. Moving a sprite with the keyboard
    7. Setting screen boundaries
    8. Scrolling
    9. Moving a sprite with the mouse and touch
    10. Summary
  17. Chapter 8: Bumping into Things
    1. Point collisions
    2. Circle collisions
    3. Rectangle collisions
    4. Using collision functions in your games
    5. Summary
  18. Chapter 9: Making Video Games
    1. The file and folder structure
    2. Starting the project
    3. Firing missiles
    4. Making aliens
    5. Shooting down aliens
    6. Displaying game messages
    7. Adding sound
    8. The final game code
    9. Summary
  19. Chapter 10: Maze Games
    1. Planning maze games
    2. Building the maze
    3. Making bigger sprites and game messages
    4. Playing Time Bomb Panic
    5. The complete code for Time Bomb Panic
    6. Scrolling Time Bomb Panic
    7. Wandering maze monsters
    8. Switching game levels
    9. Using a tile map editor
    10. Summary
  20. Chapter 11: Platform Games and Physics
    1. Natural motion using physics
    2. Hedgehog Apocalypse!
    3. Summary
  21. Chapter 12: Touch and the Mouse
    1. Finding the mouse and touch X and Y positions
    2. Moving a sprite with easing
    3. A mouse-based and touch-based platform game
    4. Rotation
    5. Killer Bee Pandemonium
    6. Using drag and drop for canvas
    7. Combining a touch interface and the mouse in one program
    8. Where do you go next?
    9. Summary
  22. Index