dragonlairindustries / pixel-pet

https://dragonlairindustries.github.io/pixel-pet/
0 stars 0 forks source link

Andy - Lab — Converting Data to JSON #79

Open atamburino opened 1 month ago

atamburino commented 1 month ago

Lab 1 -- Converting Data to JSON

To practice creating, using, and referencing JSON data in JavaScript, BOTH team members will complete the following steps below using the branch naming convention firstname-json.

  1. Create an Issue ticket in GitHub to lay out the steps you'll need to take in order to convert your virtual pet options (the pets available for gameplay) into a JSON file.

  2. Create your OWN branch using the naming convention above.

  3. Convert your data into JSON format in its own file with the .json file extension.

  4. Using a require statement (or require function), assign the contents of the file to a variable. Remember best-practice for your variable declaration.

  5. Adjust any references to your previous data by refactoring to use your new variable.

  6. Push up YOUR branch.

  7. Create a PR to main and submit the link to your PR in a DM directly to me. NOTE: This is NOT the link to your repository. The PR has its own link.

  8. As partners, choose ONE refactor to merge into main and leave the other open for now.

atamburino commented 1 month ago

Steps

  1. Create branch

  2. Created a dragons.json file that contains:

    • An array of dragon objects
    • Each dragon has unique properties (id, className, baseStats, description)
  3. Import the JSON data using fetch since require was giving issues.

  4. Modified the app.js file to:

    • Created an dragon assignment function to use the JSON data
    • Hide the dragon on screen until game starts