I can’t believe January is already over. This month went pretty fast. I’m doing well in my planner. Even wrote daily on the daily pages. Ok, I didn’t write a lot but I wrote something. I haven’t been using stickers though since I don’t have the time to do that. Next year I think I will get the smaller Hobonichi weeks planner.
We got a car! After some thinking, I decided to chip in with my settlement money. And Tommy drives me everywhere anyway. I’m just not into driving. I have Kel’s car during the day while everyone is gone if I need it. The car is a 2015 Subaru Outback. It’s a nice car. The ride is so smooth and it has heated seats. There are a lot of safety features as well.
I have books in my Kindle library where I have no clue where they came from. I just realized that as I looked through my library. Interesting. My Kindle lags sometimes when I want to go through the library or read.
Tommy, I and Karissa went to Santa Fe yesterday so Tommy can take some pictures. It was a fun trip.
Oh, there is also another puppy in the family. Chris got a puppy. He keeps her at his dorm. Yes, dorms allow animals. Alexis’s roommate has a cat. Well, she doesn’t have a roommate right now cause her roommate took a semester off. But yes, Chris has a puppy. Her name is Everest cause she climbs on everything. Very friendly. Not at all shy like Merlin is.
Pictures from this weekend: Karissa in the new car, the Cathedral Basilica of St. Francis of Assisi in Santa Fe, new car, making teryaki sauce (I need to make it thicker next time), and Everest.
It wasn’t easy getting Krissy’s picture
Such a beautiful church. Founded in 1714 (parish)
2015 Subaru Outback
I like making this sauce, but I haven’t perfected it yet
I think Everest is about 4 months old
JavaScript notes…
——————————————–
Step 128
Inside the dodge function, set text.innerText equal to the string You dodge the attack from the
function dodge() { text.innerText = "You dodge the attack from the " + monsters[fighting].name }
Step 129
In your defeatMonster function, set gold equal to gold plus the monster’s level times 6.7. You can get the monster’s level with the level property.
Here is an example of setting num to num plus 5 * 8: num += 5 * 8. Use Math.floor() to round the result down.
function defeatMonster() { gold += Math.floor(monsters[fighting].level * 6.7); }
Step 130
Set xp to xp plus the monster’s level.
function defeatMonster() { gold += Math.floor(monsters[fighting].level * 6.7); xp += monsters[fighting].level; }
Step 131
Now update goldText and xpText to display the updated values.
function defeatMonster() { gold += Math.floor(monsters[fighting].level * 6.7); xp += monsters[fighting].level; goldText.innerText = gold; xpText.innerText = xp; }
Step 132
Finish the defeatMonster function by calling the update function with locations[4] as the argument.
function defeatMonster() { gold += Math.floor(monsters[fighting].level * 6.7); xp += monsters[fighting].level; goldText.innerText = gold; xpText.innerText = xp; update(locations[4]); }
Step 133
Your locations array doesn’t have a fifth element, so locations[4] doesn’t work.
Add a new object at the end of the locations array, following the same structure as the other objects. Set name to kill monster, set button text to an array with three Go to town square strings, set button functions to an array with three goTown variables, and set text to The monster screams Arg! as it dies. You gain experience points and find gold..
const locations = [ { name: "town square", "button text": ["Go to store", "Go to cave", "Fight dragon"], "button functions": [goStore, goCave, fightDragon], text: "You are in the town square. You see a sign that says \"Store\"." }, { name: "store", "button text": ["Buy 10 health (10 gold)", "Buy weapon (30 gold)", "Go to town square"], "button functions": [buyHealth, buyWeapon, goTown], text: "You enter the store." }, { name: "cave", "button text": ["Fight slime", "Fight fanged beast", "Go to town square"], "button functions": [fightSlime, fightBeast, goTown], text: "You enter the cave. You see some monsters." }, { name: "fight", "button text": ["Attack", "Dodge", "Run"], "button functions": [attack, dodge, goTown], text: "You are fighting a monster." }, { name: "kill monster", "button text": ["Go to town square", "Go to town square", "Go to town square"], "button functions": [goTown, goTown, goTown], text: "The monster screams Arg! as it dies. You gain experience points and find gold." } ];
Step 134
The word Arg! should have quotes around it. Besides escaping quotes, there is another way you can include quotation marks inside a string.
Change the double quotes around the string The monster screams Arg! as it dies. You gain experience points and find gold. to single quotes ‘, then add double quotes around Arg!.
{ name: "kill monster", "button text": ["Go to town square", "Go to town square", "Go to town square"], "button functions": [goTown, goTown, goTown], text: 'The monster screams "Arg!" as it dies. You gain experience points and find gold.' }
Step 135
After a monster is defeated, the monster’s stat box should no longer display.
On the first line of the update function, use monsterStats.style.display to change the display value to none.
function update(location) { monsterStats.style.display = "none"; button1.innerText = location["button text"][0]; button2.innerText = location["button text"][1]; button3.innerText = location["button text"][2]; button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; text.innerText = location.text; }
Step 136
In the lose function, call the update function and pass in the sixth object of your locations array. Note that you haven’t created this object just yet.
function lose() { update(locations[5]); }
Step 137
At the end of your code, create a restart function. Inside this function, set xp to 0, health to 100, gold to 50, currentWeapon to 0, and set inventory to an array with the string stick.
Also update the innerText properties of goldText, healthText, and xpText to their current values.
Finally, call the goTown() function.
function restart() { xp = 0; health = 100; gold = 50; currentWeapon = 0; inventory = ["stick"]; goldText.innerText = gold; xpText.innerText = xp; healthText.innerText = health; goTown(); }
Step 138
In the locations array, add another object at the end. Set the name property to lose, set button text to an array with three REPLAY? strings, set button functions to an array with three restart variables, and set text to You die. ☠️. You can copy that text to use the emote.
{ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], text: "You die. ☠️" }