Fill-In-The-Variables Code-Along

Once you have an idea of how the game is played, it's time to make it your own! We will update the variables in the code to create a unique gameplay experience.

More on Variables

In computer science, variables are containers for data. They have names (like myCar) and values (like "Toyota Camry"). In JavaScript, they are defined like this:

let myCar = "Toyota Camry";

Variables can control how a program runs. In this game, a bunch of different things are controlled by variables, like the colors in the world and even the game physics!

Changing the Sky Color

From the left side of HyTop, open the variables.js file. This will let you see all of the different top-level variables that change how the game works. See if you can figure out how to change the color of the sky so it's pink!

Here's how to do it in the variables.js file:

let SKY_COLOR = "pink";

Always make sure to SAVE your project if you want to see your changes reflected in the preview!

Changing More Variables

There are a ton of different variables to tweak. See what happens when you mess with them! As you go, keep in mind that some parts of the code need to stay the same for the program to actually work. Here are some of the important things you should not touch:

  • let keywords
  • variable names themselves (e.g., COIN_COLOR)
  • = equals signs
  • "" quotation marks - always put text within these
  • ; semi-colons
  • [] square brackets
  • {} curly brackets
  • : colons
  • , commas
  • property names themselves (e.g., north within PLATFORM_LOCATIONS)

Conclusion

Have fun and see how your game changes with different variable updates!

results matching ""

    No results matching ""