Tyler F Gamsby wrote:
> ...I
> have a grid, 20x20, that I want to have a sprite navigate around --
> in fact, the sprite is a boat.  Can I use a list to keep track of
> what grid squares are land and what are water, and use that
> information to create a path for the boat to follow (so that the boat
> does not drive across land)?

You could use a list of lists (a 2D array)
a 3x3 might look like: thelist = [[1,1,0],[1,0,0],[0,1,1]]

110
100
011

and you can easily look at any 'square' with: thelist[y][x]

You could replace each of the 'squares' with a property list and be able
to keep track of all manner of terrain information. And you could have
lists in those lists that keep track of how many of each kind of fish
there are...



-- 
Carl West    [EMAIL PROTECTED]
617.262.8830 x246    

I have no superfluous leisure; my stay must be
stolen out of other affairs; but I will attend you awhile.

           - Isabella, Measure for Measure, Act 3 Scene 1

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to