Sample Video Frame

Created by Zed A. Shaw Updated 2024-06-20 22:54:43
 

24: OOP Game

You are now going to complete a reworking of your game into an OOP version. What I've done is created the structure for you using classes and objects, but I've left blank what goes in each room. Your job is to take this and fill in your code from your first game but keep the structure and make it all work with what I have.

You will need to study this code very carefully as it is convoluted on purpose. I am making it more convoluted that it needs to be so that you can have some practice studying code like this. You can then do this exercise and "refactor" it, which is where you take code that is not very good and attempt to improve it by redesigning it or reworking it to be better.

I recommend that you take this code very slowly and work it in chunks. Do not type all of this in in one giant go expecting it to work the first time. Nobody who is a working professional programmer writes mountains of code in one shot and expects it to work. The majority of programmers I know write their code in tiny chunks and confirm that each little chunk works as they code, by running it.

Previous Lesson Next Lesson

Register for Learn JavaScript the Hard Way

Register today for the course and get the all currently available videos and lessons, plus all future modules for no extra charge.