Monday, February 9, 2009

"I Am Invincible!"

Epic, that's how I feel right now. Yes, that is a GoldenEye reference and yes, Boris is my favorite character from the movie and in olde skool FPS combat (a ha! take that Oddjob you short little cheating piece of crap). Anyway, as per the previous post, I've gotten my bloody array to work.

-Oh, got my cord too. CID is back on-line and Star Frog Games is back into full scale production mode. Life is good.

Right, so back to the array. I would like to point out that Blitz Basic has some pretty terrible documentation on the subject, so I'll scribble this down so other people may or may not experience my personal hell. So there are 2 different kinds of data arrangements in Blitz. The first is called a Type. I beat on this for a while before realizing it wasn't correct. Basically, it allows one to create an assortment of objects that can be referenced as a group with individual properties. This sounds great, but you cannot reference individual aspects of that group by itself. So while you could have each bit fed through an AI routine and check for collision and whatnot, you cannot say, "Get me that one, with the funny head." So that's clearly not going to work, but in the future if I end up building the engine again, that's how enemies in Knight are going to roll.
The other kind is referenced by the obscure "Dim" command. I think it's programmer short hand for "Dimensional Array." After one summons this command through arcane means, you can opt to create fields in this array thusly:

Dim Map(20,20)

This creates an array with 20 rows and 20 columns and calls the array "Map". Once I had this all set, I built a quick loop to fill it in with some numbers and then told it to give me the numbers back and arrange them all pretty like. Which it did.
The real catch was this : I told the system to find Map(19,19) and change the value like this:

Map(19,19) = 1337

Then I ran it again, and it worked, it bloody worked and the space at 19,19 was "1337." So that makes my whole day. I'll get the thing installed tomorrow into ThiefEd and really get something cooking, but I'm really glad the prototype worked.

-Yes, I know, "1337" is so 1997. But I would have had to change the style of the array to actually have it say "I Am Invincible" or "Yatta!"

No comments: