Now that we have a system for specifying where platforms should be in each level, we can create multiple levels! Each level is going to inherit from our customized Level class and then inject information about the level inside the constructor. By doing this we’re able to separate each of our Levels from one-another!



Below the definition for Level, create a new Level1 class that inherits from Level.


Give Level1 a .constructor() method that calls super('Level1') and then defines this.heights as an array.


Lastly, change the property for scene in our config object to point to Level1 instead of Level.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?