20: First Game

In this exercise you will begin to write your very first game. This game will teach you how to use functions and if statements together. I am going to write half of the game, and then you must finish the game using my same style. You can finish the game in any way you want, so long as you have the same number of rooms and those rooms are in functions. It would be a good idea to make sure that you completely understand the game as I have written it before you begin to write your additions.

The Code

Remember that this code is not complete. I start you off with the basic code you need to make the game work, the first room, and how to select random hit points. After that you create your rooms similar to mine.

Learn JavaScript Today

Register today for the Beginner Basics course and get the new releases by just paying the difference. There's also special discounts for existing customers when new courses are released.


Still Not Sure? Check out more curriculum!