PDA

View Full Version : What is a list and an array for?


BigOrangeArmy
10-25-2009, 04:25 PM
Kind of a newb question lol, but I don't care. What is an array and list for, and in what situations can I use them effectively?

For example, could I have a list of trees or something and have a method that, when used against an item from that list, has that specific item perform an action?

Thanks for the help! :D

--BigOrangeArmy

x2495iiii
10-25-2009, 07:33 PM
Lists are for making several objects do things in order quickly or together.

Arrays are useless as far as I can tell. I've tried both and only lists let you do useful things, arrays just sit there with no functions or methods. I'm probably missing some important purpose they serve, but for the time being, I use only lists.

BigOrangeArmy
10-26-2009, 08:21 AM
Okay, so say I have 50 trees in a list, and I want the world to play a sound whenever, say, a BikerKid comes in contact with a particular tree.

How can I use a list to do this without having to write out 50 different If/Else statements? Because whenever I try to insert my "index" list into the If statement, it will give me only these options:

Random Item from List
First Item from list
Last Item from list
ith Item from List

Thanks :D