更新时间:2021-07-16 14:10:28
封面
版权信息
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Chapter 1. Introducing HTML5 Games
Discovering new features in HTML5
Discovering new features in CSS3
The benefit of creating HTML5 games
What others are playing with HTML5
What we are going to create in this book
Preparing the development environment
Summary
Chapter 2. Getting Started with DOM-based Game Development
Preparing the HTML documents for a DOM-based game
Time for action – installing the jQuery library
Setting up the Ping Pong game elements
Time for action – placing Ping Pong game elements in the DOM
Getting mouse input
Time for action – moving DOM objects by mouse input
Time for action – Moving the ball with JavaScript Interval
Beginning collision detection
Time for action – hitting the ball with the paddles
Controlling the left paddle movement
Time for action – auto moving the left paddle
Showing text dynamically in HTML
Time for action – Showing the score of both players
Chapter 3. Building a Card-matching Game in CSS3
Moving game objects with CSS3 transition
Time for action – moving a playing card around
Creating a card-flipping effect
Time for action – flipping a card with CSS3
Creating a card-matching memory game
Time for action – preparing the card-matching game
Adding game logic to the matching game
Time for action – adding game logic to the matching game
Embedding web fonts into our game
Time for action – embedding a font from the Google Fonts directory
Chapter 4. Building the Untangle Game with Canvas and the Drawing API
Introducing the HTML5 canvas element
Drawing a circle in the Canvas
Time for action – drawing color circles in the Canvas
Time for action – putting the circle drawing code into a function
Time for action – saving the circle position
Drawing lines in the Canvas
Time for action – drawing straight lines between each circle
Using mouse events to interact with objects drawn in the Canvas
Time for action – dragging the circles in the Canvas
Detecting line intersection in the Canvas
Time for action – distinguishing the intersected lines
Adding touch support for tablets
Time for action – adding the touch input support
Chapter 5. Building a Canvas Game's Masterclass
Making the Untangle puzzle game
Time for action – making the Untangle puzzle game in Canvas
Drawing text in the Canvas
Time for action – displaying the progress level text inside the canvas element
Time for action – embedding a Google web font into the canvas element
Drawing images in the Canvas
Time for action – adding graphics to the game
Time for action – adding CSS styles and image decoration to the game
Animating a sprite sheet in Canvas
Time for action – making a game guide animation
Creating a multilayer Canvas game
Time for action – piding the game into four layers
Chapter 6. Adding Sound Effects to Your Games
Adding a sound effect to the Play button
Time for action – adding sound effects to the Play button
Building a mini piano musical game
Time for action – creating a basic background for the music game
Time for action – creating the playback visualization in the music game
Creating a keyboard-driven mini piano musical game
Time for action – creating a mini piano musical game
Adding additional features to the mini piano game
Time for action – removing missed melody notes
Time for action – adding functionalities to record the music level data
Adding touch support
Time for action – indicating a game over event in the console
Handling the audio event in playback complete events
Chapter 7. Saving the Game's Progress
Storing data using HTML5 local storage
Time for action – creating a game over dialog with the elapsed played time
Time for action – saving the game score
Saving objects in the local storage
Time for action – saving the time alongside the score
Notifying players when they break a new record with a nice ribbon effect
Time for action – creating a ribbon in CSS3
Saving the entire game progress
Time for action – saving all essential game data in the local storage
Time for action – resuming a game from the local storage
Caching the game for offline access
Time for action – adding the AppCache Manifest