Site hosted by Angelfire.com: Build your free website today!

Using Tables to create multiple enemies

This really is a simple task, once you understand it. All you have to do is create a table that will store variables for your enemies(or, I guess, whatever else you want. I'm using them for one of my games, Cyborg Wars, where it isn't used at all for enemies.). First you have to DIMension the array like this:

dim table(1 to 20, 1 to 2)

That creates a table that is 20 columns by 2 rows(I think, test it out. It's either that or 2, 20). This is what it would look like:

00
00
00
00
00
00
etc...0

It would have taken forever to make a 20 by 2 table, so I shortened it to 6 or 7. You get the picture. You have to dimension these arrays like this, or they're initialized to 10 by 2, which is too small for a lot of purposes(such as Cyborg Wars). To use them, you do this:

if table(1, 1) = 0 then
blah blah
endif

That references the very upper left corner of the table, because I dimmed it as a 1 to 20, not just 20(ditto for 1 to 2). You can also use strings in tables, but just dimming it as a string(easy, right?). If you don't know how to do that, learn. That pretty much covers the basics of tables. There is a lot you can do with them though(maps for rpg's, enemies, etc), so use some creativity.

Back to the Tutorials...

E-Mail:cybertron001@geocities.com