String versus (method?) - Backwoods Forest


#1

Hey Ambassadors,

There’s a level in the Backwoods Forest world where you attack a Chest unless there are enemies present. Why is “Chest” a string, but enemy is just enemy? Why is enemy not a string (i.e. not in quotes)? (and if my verbiage is off, feel free to correct me)

Thank you!!

Cat


#2

The attack method is formatted as attack(string), where string is an input argument. This string represents a thang with name string. When you attack("Chest"), you are attacking the thing with name "Chest", in this case, the chest. However, when you use attack(enemy), You are attacking the string you previously stored in enemy with findNearestEnemy(). Does that clear things up?


#3

That makes sense. The game programmers named and defined “Chest” already, yes? Or is that spot on the map just “Chest” because we called it “Chest”?

Thank you!


#4

They have indeed named the chest “Chest”. It’s like in Kithgard Dungeon, where you used string like "Treg" to attack munchkins.