(HTML5 Logo in the course image is by W3C, licensed under Creative Commons Attribution 3.0 Unported. Background pattern for transition cards CC BY-SA 3.0 Subtle Patterns © Atle Mo. drawn by Paul Phönixweiß.)
Here's what you'll be learning how to create in this course, and a bit about who you'll be learning it from. Pleasure to meet you!
This lecture is just a bit of set up and context for what you'll be learning in this review section, including one last reminder about the previous free Udemy course that this one builds upon.
Making an HTML file is a simple matter of creating a plain text file and saving it with the right extension. As a reminder, since you're programming you should make sure that your OS is set to show all file extensions, rather than hiding known types, since otherwise it will be tough to tell txt from html files, png images from jpg images, and so on.
Whereas other browsers may let you get away with a very basic (if technically incorrect) HTML wrapper for your game files, Firefox is picky and will complain with a warning in the console unless you provide it with a proper header. Since many people use Firefox and this doesn't take very long to do let's take a moment to form it properly.
You'll see how to open your console, print code to it from your program code, and also see an example of spotting an error message in it due to an issue in the programming.
During this lecture you'll write code to display colored rectangles and circles.
For action to happen over time, rather than being computed all when the program stats, an interval time has to be set up. That's what you'll accomplish here. To show that it's working you'll also use a variable to position the ball, changing it on each update call to produce a steady horizontal motion.
Now you'll get the ball bouncing off the left and right sides, as well as moving vertically and bouncing off the top and bottom of the canvas.
There's a semi-mysterious giant rectangle being drawn every time the game updates. It deserves some explanation (maybe even a bit of demonstration?) for why it's there.
Time to separate the movement and rendering lines of code. Although this isn't technically necessary it can help reduce strange complications that would later arise due to positions being updated and drawn in varying order.
- Any plain text editor like Notepad will do, however one which supports features for programmers such as multiple file tabs, code highlighting, line numbers, and smart/auto-indentation can be handy for later phases as the code grows in length (Notepad++ is free for Windows, TextWrangler for Mac, or Sublime Text 2 which I use has a fully functional free trial for either)
- Any common web browser should work fine, although I use Google Chrome (free) so you may prefer that one just to see on your side exactly how it shows up in the videos
- To follow along the few steps for drawing art you'll need a program that lets you draw and save images with transparency. I use a slightly older version of Photoshop, although free alternatives exist and the steps are similar. I also attach all art files that I create, so if you prefer to only focus on the coding steps you can download the images that I create in the videos.
- Create, display, and play with a 2D tile world that supports optimized collision (a central concept for generations of games in a variety of genres!)
- Create, load, display, and rotate image graphics in games
- Break game code into multiple files to better manage large projects
- Define a class and use it to create multiple instances of gameplay objects in unique positions (note: only using the very basic first concept of object-oriented programming, it doesn't dive deep into that rabbit hole)
- Handle mouse input for a one-player game, or keyboard controls for both one and two-player games
- Implement basic item pick-ups (keys) and trigger their usage upon collision (open doors)
- Develop and adapt gameplay for basic platformer movement, digital board/strategy games, simple matrix formations for retro arcade-style enemies, and worlds larger than the screen viewed by scrolling camera
- Apply simple trigonometry calls to move game objects at arbitrary angles
- Implement basic loading screen functionality in HTML5
Chris has been making games for 23 years. He's worked with startups and AAA games, taught game creation at Georgia Tech, and spoken at more than 10 conferences (including GDC, IndieCade, and SIEGE). Over 200,000 students have done his online courses, and he's made hundreds of videos and 140 podcast industry interviews to help people discover game development. Today he runs HomeTeam GameDev, where people around the world learn game development together in a practical way building long-term remote team projects, with included access to 1-on-1 support and ongoing mentorship.