HTML 5 Shoot 'em Up in an Afternoon
By Bryan Bibat
()
About this ebook
(This book is available for a pay-as-you-want price at Leanpub. This ebook-only version does not include the videos so it is priced slightly lower than the suggested Leanpub price.)
Learn the basics of HTML5 game programming with Phaser
Learn how to make a simple top-down shoot 'em up from scratch with the Phaser HTML5 framework in a few hours: from adding sprites, handling player input, processing collisions, up to setting up a boss fight.
This book also covers topics not directly related to game development, like how to install a development environment, refactoring your code, and putting out your game into the public.
Related to HTML 5 Shoot 'em Up in an Afternoon
Related ebooks
Practical Shader Development: Vertex and Fragment Shaders for Game Developers Rating: 0 out of 5 stars0 ratingsPHP & MySQL: Novice to Ninja Rating: 0 out of 5 stars0 ratingsLet’s Build a Multiplayer Phaser Game: With TypeScript, Socket.IO, and Phaser Rating: 0 out of 5 stars0 ratingsPhaser.js Game Design Workbook: Game development guide using Phaser JavaScript Game Framework Rating: 0 out of 5 stars0 ratingsVideo Game Careers - Ultimate Edition: Video Game Careers, #4 Rating: 0 out of 5 stars0 ratingsJavaScript from Zero to Proficiency (Beginner): JavaScript from Zero to Proficiency, #1 Rating: 0 out of 5 stars0 ratingsLazy Designer Rating: 0 out of 5 stars0 ratingsBuild Your Own Car Dashboard with a Raspberry Pi: Practical Projects to Build Your Own Smart Car Rating: 0 out of 5 stars0 ratingsHow To Make The Next Game Rating: 0 out of 5 stars0 ratingsVideo Game Careers - Beginners Guide: Video Game Careers, #1 Rating: 0 out of 5 stars0 ratingsUnity from Proficiency to Mastery (C# Programming): Unity 5 from Proficiency to Mastery, #2 Rating: 0 out of 5 stars0 ratingsA Beginner's Guide to 2D Platform Games with Unity: Beginners' Guides, #1 Rating: 0 out of 5 stars0 ratingsUnity from Zero to Proficiency (Beginner): Unity from Zero to Proficiency, #2 Rating: 5 out of 5 stars5/5Jump Start PHP Environment: Master the World's Most Popular Language Rating: 0 out of 5 stars0 ratingsC# Programming from Zero to Proficiency (Introduction): C# from Zero to Proficiency, #0 Rating: 0 out of 5 stars0 ratingsHTML5 and JavaScript Projects: Build on your Basic Knowledge of HTML5 and JavaScript to Create Substantial HTML5 Applications Rating: 0 out of 5 stars0 ratingsCoding for Kids Ages 10 and Up: Coding for Kids and Beginners using html, css and JavaScript Rating: 5 out of 5 stars5/5Learn to Code With JavaScript Rating: 0 out of 5 stars0 ratingsGetting Started in: Webinars for Profits Rating: 0 out of 5 stars0 ratingsA Quick Guide to c# with Unity: Quick Guides, #1 Rating: 5 out of 5 stars5/5Practical Machine Learning in JavaScript: TensorFlow.js for Web Developers Rating: 0 out of 5 stars0 ratingsPhaser III Game Design Workbook Rating: 0 out of 5 stars0 ratingsMastering TensorFlow 2.x: Implement Powerful Neural Nets across Structured, Unstructured datasets and Time Series Data Rating: 0 out of 5 stars0 ratingsHLSL Development Cookbook Rating: 0 out of 5 stars0 ratingsLearn to Code with Scratch: Let Your Kids' Creative Ideas Come to Life by Coding Them into Programs Rating: 0 out of 5 stars0 ratingsC# Programming from Zero to Proficiency (Beginner): C# from Zero to Proficiency, #2 Rating: 0 out of 5 stars0 ratingsA Beginner's Guide to 2D Shooter Games: Beginners' Guides, #2 Rating: 0 out of 5 stars0 ratingsGetting Started with Advanced C#: Upgrade Your Programming Skills Rating: 0 out of 5 stars0 ratings3D Game Design with Unreal Engine 4 and Blender Rating: 0 out of 5 stars0 ratingsInstant HTML5 2D Platformer Rating: 0 out of 5 stars0 ratings
Programming For You
HTML & CSS: Learn the Fundaments in 7 Days Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 0 out of 5 stars0 ratingsSQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Python: For Beginners A Crash Course Guide To Learn Python in 1 Week Rating: 4 out of 5 stars4/5Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5Python Projects for Beginners: A Ten-Week Bootcamp Approach to Python Programming Rating: 0 out of 5 stars0 ratingsSQL: For Beginners: Your Guide To Easily Learn SQL Programming in 7 Days Rating: 5 out of 5 stars5/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5Python QuickStart Guide: The Simplified Beginner's Guide to Python Programming Using Hands-On Projects and Real-World Applications Rating: 0 out of 5 stars0 ratingsGrokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Game Development with Unreal Engine 5: Learn the Basics of Game Development in Unreal Engine 5 (English Edition) Rating: 0 out of 5 stars0 ratingsExcel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Programming Arduino: Getting Started with Sketches Rating: 4 out of 5 stars4/5Modern C++ for Absolute Beginners: A Friendly Introduction to C++ Programming Language and C++11 to C++20 Standards Rating: 0 out of 5 stars0 ratingsSQL All-in-One For Dummies Rating: 3 out of 5 stars3/5Hacking: Ultimate Beginner's Guide for Computer Hacking in 2018 and Beyond: Hacking in 2018, #1 Rating: 4 out of 5 stars4/5Python: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5
Reviews for HTML 5 Shoot 'em Up in an Afternoon
0 ratings0 reviews
Book preview
HTML 5 Shoot 'em Up in an Afternoon - Bryan Bibat
HTML 5 Shoot 'em Up in an Afternoon
Learn (or teach) the basics of Game Programming with this free Phaser tutorial
Bryan Bibat
This book is for sale at http://leanpub.com/html5shootemupinanafternoon
This version was published on 2015-07-11
publisher's logo* * * * *
This is a Leanpub book. Leanpub empowers authors and publishers with the Lean Publishing process. Lean Publishing is the act of publishing an in-progress ebook using lightweight tools and many iterations to get reader feedback, pivot until you have the right book and build traction once you do.
* * * * *
© 2014 - 2015 Bryan Bibat
ISBN for EPUB version: 9781513008752
Table of Contents
Preface
License
Introduction
Who is this book for?
Morning: Preparing for the Afternoon
Introduce them to Shoot ‘em Ups
Technical Requirements: JavaScript and Math
Development Environment Setup
Other Suggested Prior Reading
Video Walkthrough
Afternoon 0: Overview of the Starting Code
Afternoon 1: Sprites, the Game Loop, and Basic Physics
Sprite Basics
The Game Loop
Apply Physics
Afternoon 2: Player Actions
Keyboard Movement
Mouse/Touch Movement
Firing Bullets
Afternoon 3: Object Groups
Convert Bullets to Sprite Group
Enemy Sprite Group
Player Death
Convert Explosions to Sprite Group
Intermission: Refactoring
Refactoring Functions
Reducing Hard-coded Values
Afternoon 4: Health, Score, and Win/Lose Conditions
Enemy Health
Player Score
Player Lives
Win/Lose Conditions, Go back to Menu
Afternoon 5: Expanding the Game
Harder Enemy
Power-up
Boss Battle
Sound Effects
Afternoon 6: Wrapping Up
Restore original game flow
Sharing your game
Evening: What Next?
Challenges
What we didn’t cover
Appendix A: Environment Setup Tutorials
Basic Setup
Advanced Setup
Cloud IDE Setup
Appendix B: Expected Code Per Chapter
Preface
I’ll be honest and get this out as early as possible: I’m not a professional
game developer. Looking at my other Leanpub books will tell you that I’m more into web development. Heck, if you told me a few months ago that I would be putting out a game development book, I would’ve thought you’re crazy.
This book was a result of three things that happened to occur around the same time:
First was the problem that came up with our HTML5 workshop. The original lecturer bailed at the last minute and we had problems with finding a replacement. We even considered the worst case, cutting out the hands-on portion leaving us with a morning workshop
consisting only of talks from people in the local gaming industry.
Coincidentally, I was playing around with Phaser a few weeks before the event. While I am not a game developer, I had just enough knowledge to make a simple workshop to introduce basic game concepts via the said HTML5 game framework. In the end I volunteered to take over the workshop less than four days before the actual event.
Normally I would have prepared a hundred or so slides and go through them during the workshop. But earlier that week I had the rare opportunity to talk to the first person who gave me advice when I started out teaching, and one of the things we talked about the not-so-recent trend of lazy college professors making only slides leaving a big gap between them and textbooks. This convinced me to switch things up with the workshop – instead of giving the participants a link to SpeakerDeck, I would point them to Leanpub.
It took a few sleepless nights to write the original 36-page workbook, but it was worth it: I had a much easier time conducting the workshop than I would have if I went with slides.
The positive response from the participants also convinced me to spend some more time to improve this book and get it out there for anyone interested in learning the basics of game development.
License
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
You can find the complete source of this book at https://github.com/bryanbibat/html5shootemupinanafternoon.
Phaser © 2014 Photon Storm Ltd.
Art assets derived from SpriteLib, © 2002 Ari Feldman.
Sound assets © 2012 - 2013 dklon (Devin Watson).
Introduction
This is usually the part where books give a lengthy intro about HTML5 to increase their word count. This is not one of those books.
All you need to know about HTML5 is that it allows you to do stuff in your browser, regardless if it’s on a desktop PC or a mobile phone, without the need for extra plugins. And that includes making games. If you want a better intro to HTML5, head over to Dive Into HTML5.
As the title and cover of the book implies, we will introduce you to both HTML5 and game development by guiding you in making a shoot-em-up game similar to the classic video game 1942.
There are a number of HTML5 libraries and frameworks out there right now. For this afternoon workshop, we’ll be using Phaser, an open-source framework built on top of Pixi.js. It’s a higher-level framework: it’s bigger and may feel like you have much less control (i.e. magical) compared to other frameworks, but at the same time, you need far less code to get things done and this makes it suitable for a short workshop such as this one.
Who is this book for?
This book is for people who want to learn the basic concepts behind creating games.