0%

Book Description

Learning should be fun, especially when it comes to getting to grips with HTML5. Each chapter of this book teaches a new concept of HTML5 by helping you develop a relevant game. It’s education without the effort.

  • Learn the basics of this emerging technology and have fun doing it
  • Unleash the new and exciting features and APIs of HTML5
  • Create responsive games that can be played on a browser and on a mobile device

In Detail

HTML is fast, secure, responsive, interactive, and stunningly beautiful. It lets you target the largest number of devices and browsers with the least amount of effort. Working with the latest technologies is always fun and with a rapidly growing mobile market, it is a new and exciting place to be.

"Learn HTML5 by Creating Fun Games" takes you through the journey of learning HTML5 right from setting up the environment to creating fully-functional games. It will help you explore the basics while you work through the whole book with the completion of each game.

"Learn HTML5 by Creating Fun Games" takes a very friendly approach to teaching fun, silly games for the purpose of giving you a thorough grounding in HTML5. The book has only as much theory as it has to, often in tip boxes, with most of the information explaining how to create HTML5 canvas games. You will be assisted with lots of simple steps with screenshots building towards silly but addictive games.

The book introduces you to HTML5 by helping you understand the setup and the underlying environment. As you start building your first game that is a typography game, you understand the significance of elements used in game development such as input types, web forms, and so on.We will see how to write a modern browser-compatible code while creating a basic Jelly Wobbling Game. Each game introduces you to an advanced topic such as vector graphics, native audio manipulation, and dragging-and-dropping. In the later section of the book, you will see yourself developing the famous snake game using requestAnimationFrame along with the canvas API, and enhancing it further with web messaging, web storage, and local storage. The last game of this book, a 2D Space shooter game, will then help you understand mobile design considerations.

Table of Contents

  1. Learn HTML5 by Creating Fun Games
    1. Table of Contents
    2. Learn HTML5 by Creating Fun Games
    3. Credits
    4. About the Author
    5. About the Reviewer
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. An Overview of HTML5
      1. What is HTML?
        1. A brief history of HTML
        2. The evolution of the World Wide Web
      2. What is HTML5?
        1. HTML5 – the next step in the evolution
      3. HTML5 is not a single feature
      4. More semantic document structure
      5. A warning about performance
      6. Native features of the browser
        1. Automatic form validation
        2. New input types
        3. Telephone-friendly hyperlinks
        4. CSS-based DOM selectors
        5. Text-to-speech
      7. CSS3
        1. Separation of concerns
        2. Reusability of visual design
        3. Ease of maintenance
        4. Scalability
        5. The evolution of CSS
        6. Experimental features and vendor prefixes
        7. CSS preprocessors
        8. CSS3 modules
        9. Style attributes
        10. Selectors
        11. Colors
        12. Media queries
      8. JavaScript APIs
        1. New JavaScript APIs
      9. The Web as a platform
      10. The Open Web
      11. HTML5 – a game changer
      12. Learning HTML5 through game development
      13. Summary
    9. 2. HTML5 Typography
      1. The game
      2. Game elements
        1. The options widget
        2. The game title
        3. Boat
        4. Sky
        5. Waves
        6. Tracks
        7. Players
        8. The main container
        9. Words to write
        10. Words written
        11. The message container
        12. The message title
        13. The new champion form
        14. Leaderboard
        15. Game controls
        16. HTML
          1. The web form
            1. Range input
            2. Email input
          2. Data attributes
        17. CSS
          1. Web fonts
          2. Transitions
          3. Animations
          4. The text shadows
          5. The box shadows
          6. The border radius
        18. JavaScript
          1. Query selectors
      3. API usage
        1. Web forms
          1. New input types
            1. Date
            2. Month
            3. Week
            4. Time
            5. Datetime
            6. Datetime-local
            7. Color
            8. Email
            9. Number
            10. Range
            11. Search
            12. Tel
            13. Url
          2. Form validation
            1. Validity state object
            2. Custom validation
          3. Used in the game
        2. Data attributes
          1. Used in the game
        3. Query selectors
          1. Used in the game
        4. Web fonts
        5. Transitions
        6. Animations
        7. The text shadow
        8. The box shadow
        9. The border radius
      4. The code
        1. The HTML structure
        2. JavaScript and logic
      5. Summary
    10. 3. Understanding the Gravity of HTML5
      1. Browser compatibility
        1. Supporting different browsers
        2. HTML5 libraries and frameworks
          1. jQuery
          2. Google Web Toolkit
        3. Supporting browsers with limited HTML5 features
          1. Gracefully degrade
          2. Polyfills
          3. Modernizr
      2. The game
        1. Code structure
        2. API usage
          1. Web audio
          2. Scalable Vector Graphics (SVG)
          3. Drag-and-drop
      3. Web audio
        1. How to use it
      4. SVG
        1. How to use it
      5. Drag-and-drop
        1. How to use it
      6. Summary
    11. 4. Using HTML5 to Catch a Snake
      1. The game
        1. API usage
        2. How to use it
      2. Typed arrays
        1. How to use it
          1. ArrayBuffer and ArrayBufferView
        2. Typed array view types
      3. Canvas
        1. How to use it
          1. clearRect
          2. Fill and stroke
          3. Lines
          4. Shapes
          5. Text
          6. Transformations
          7. Drawing images
          8. Manipulating pixels
      4. Web workers
        1. How to use it
      5. Offline application cache
        1. How to use it
      6. The code
      7. Summary
    12. 5. Improving the Snake Game
      1. The game
      2. API usage
        1. Web messaging
          1. How to use it
        2. Web storage
        3. Local storage
        4. Session storage
      3. IndexedDB
        1. IDBFactory
        2. IDBOpenDBRequest
        3. IDBTransaction
          1. readwrite
          2. readonly
          3. versionchange
        4. Getting elements
        5. Deleting elements
      4. The code
        1. Saving the high score
        2. Taking screenshots of the game
      5. Summary
    13. 6. Adding Features to Your Game
      1. Advanced HTML5 APIs
      2. WebGL
        1. Hello, World!
      3. Web sockets
        1. The connection
        2. The server-side code
        3. The client-side code
      4. Video
        1. Attributes
        2. Events
      5. Geolocation
        1. A Google Maps example
      6. Upcoming CSS features
        1. Programming in the bleeding edge
        2. CSS shaders
          1. Using custom filters
        3. CSS columns
          1. The column rule
          2. Column breaks
          3. CSS regions and exclusions
            1. Regions
          4. Exclusions
          5. Defining shapes
      7. Summary
    14. 7. HTML5 and Mobile Game Development
      1. Desktop versus mobile
        1. Major implementation considerations
          1. Screen size and orientation
          2. Computing power
          3. Battery life
          4. Browser differences
          5. Best practices
          6. Degrade gracefully and enhance progressively
          7. Finger-friendly design
          8. Save battery life
          9. Plan for offline
          10. Offering a desktop version
      2. Understanding media queries
        1. width
        2. height
        3. device-width
        4. device-height
        5. orientation
        6. aspect-ratio
        7. device-aspect-ratio
        8. color
        9. color-index
        10. monochrome
        11. resolution
        12. scan
        13. grid
      3. Understanding touch events
        1. touchstart
          1. touches
          2. changedTouches
          3. targetTouches
        2. touchend
        3. touchmove
        4. The touch object
          1. identifier
          2. screenX
          3. screenY
          4. clientX
          5. clientY
          6. pageX
          7. pageY
          8. radiusX
          9. radiusY
          10. rotationAngle
          11. force
          12. target
      4. The game
        1. Code structure
          1. /css
          2. /img
          3. /js
          4. /components
          5. /entities
          6. /widgets
          7. Canvas.js
          8. EnemyManager.js
          9. GameLoop.js
          10. PhysicsManager.js
          11. Vec2.js
          12. main.js
          13. index.html
        2. Mobile optimizations
          1. Combine resources
          2. Track touches by IDs
          3. Use CSS animations with caution
          4. Use separate canvases for each game layer
          5. Use image atlases
      5. Summary
    15. Index
3.14.245.167