Jquery let's us update the html on our page in real time
p5js let's us use the
(And maybe a canvas later would be cooler than just a picture of your pet)
Get a reference to your
Now make an object and populate it with the database data
db.on("value", getData) Means the function
getData() will be called whenever a database value changes.
So the getData function puts that object data into
myDragon and then uses jquery to update the spans with the ids "food" "mood" and "name".
the checkHunger function looks at how long its been since the database updated the food value and then subtracts the right amount from food...its complicated.
try to read it and understand it
I added some buttons in my html that let me feed her