.1. An array can be stored in a variable. Therefore the
items variable holds an array of items.
items would be the first item in that array.
hero.findItems() only returns an array if there are currently items in the game. So it can return
null if it didn’t find any items. Meaning that there is no array stored in the variable
items in the particular case where there are no items available in the game.
item = hero.findNearestItem() and
item = hero.findNearest(hero.findItems()) do similar things. They return a single
item object that is the closest to the hero.
items = hero.findItems() returns an array of all of the items in the game available.
Notice the difference between singular and plural. The ability for you to see an item is normally limited by the range of your glasses equipped. And blocked by walls/etc depending on how the game level was setup.
The hero is wearing Fine Wooden Glasses with a range of +10m. There are two gems in the level, one is 14m away and the other 5m away. By using
hero.findItems() I get an array returned with
items holding the gem that was 4m away. And if I used
hero.findNearestItem() I would get the single item object of the 4m away gem.
The first is still an array structure
items with only one element in it, and the second would be a single object
.3. The code for the making the other characters move around in the game is placed in the level or game code itself. So there is additional logic that is programmed for you "behind the scenes" to allow the game to work the way it does.
Also, in the game you will notice differences between levels. Not everything will stay constant like a video game. So make sure you read the instructions before assuming that a game element will act exactly the same in that case.
Just like your cell phone, you might not understand how it works, but that doesn’t stop you from using it daily to do things.
If you really want to learn more, the code base is open source and you can begin to read it when you are ready. You can create levels for the game as well by using the level editor and reading about design on the wiki.