Games Programming in JavaScript
Posted on Aug 3rd, 2020
This is the last week of Phase 1, so we will have a week-long project that you will work on in study groups and end the week with technical presentations on Thursday.
Today’s topics
- Building games in JS
- The Canvas API
Project
Build a game
This project is due on Thursday, August 6th.
Study groups for this project are to encourage you to put your heads together to solve the problems this project poses. You will need to wrestle with this material; read other people’s code; take that code apart and run it, change it, and break it to understand what it’s doing; read documentation and just try stuff until things start to click for you. Doing this with other people will help a lot!
Object Oriented Programming in JavaScript
Among the resources below are some slides and links about JavaScript’s object system and other topics in Object Oriented Programming. I’ve opted not to go over these to leave more time for working on the game (we’ll go over much of it when we start working with Python), but I’m including them below for those that are interested (it can also help you to understand what’s going on in some of the example code you might see out there).
Pair/group assignments:
- Kim & Jon
- Sloan & Harrison
- Tori & Shane
- Robert & Kyle
TODO for tonight
- Watch Mary Rose Cook’s video; read her annotated code. Get the updated space invaders code from our examples repo and run it locally. Read that code, change it, and see what happens. See if you can start to understand what is happening. (Links to all of these things below)
- Play with the Canvas API.
-
Play the games that are provided as options in the homework assignment.
- Get started writing the code: a good first step is to draw a player on the screen in your own browser. Then, see if you can make that player move.
End of Phase Presentations are on Thursday
Instructions for technical presentations
Links and resources
- MDN OO in JS for Beginners
- MDN
this
this
in JS explained simply- Mary Rose Cook live codes space invaders
- Mary Rose Cook’s annotated space invaders code
- animation with requestAnimationFrame
- How to use requestAnimationFrame
- MDN Canvas API
- 2D Collision Detection in JS