/Virtual-Pet

Take this pet with you anywhere. You can treat, play, and exercise with this pup anywhere! Code from Thinkful workshop.

Primary LanguageJavaScript

Overview

  • See working demo here
  • Click Show Live above to see your code changes
  • You will write your code in public/client.js
  • You can ignore all the other files :)

Challenges

Step 1: Create pet_info object Create an object with keys "name", "weight", "happiness" and set initial values. Set this equal to variable "pet_info"

Step 2: Add behavior to buttons When your pet receives treat, add to its happiness and weight. When your pet exercises, reduce it's happiness and weight. When your pet plays, add to its happiness and reduce its weight

Step 3: Fix key bug Make sure weight can't go below zero (use conditional)

More challenges

  • Add a new action (button, key in object, in HTML)
  • Add alerts after each button press with a comment from your pet

Helpful Links


Made with <3 at Thinkful