Detailed Array Explanation

Game Editor comments and discussion.

Detailed Array Explanation

Postby Hblade » Mon Apr 05, 2010 2:53 pm

Detailed Array Explanation
    for those who don't know about arrays

Arrays can be very useful when making games, not only can they store multiple variable information into 1, but they can also be used to control cloned actors.

A simple way to create an Array is by putting
Code: Select all
int Array[24];

inside of Global Code. Another way of creating an array is by going to the Script Editor
Image
Make sure Array is set to Yes. The 1200 is the number it can initially hold. It's almost like having 1200 variables but without the lag. The array can be called / used by using this command.
Code: Select all
MyArray[0] = 800;
MyArray[1] = 900;

It can be called all the way up to the number you specified, or in our case, 1200.

To the more advanced area's of Arrays, and how to use them in a more useful way, say you have a tile editor. When ever your editor stamps a tile down, that tile must save it's cloneindex X and Y, and animpos. To do this, we need 3 arrays.
[list]TileX
TileY
TielAnim
/list]
TileX and TileY are pretty much self explanatory. TileAnim is used to capture the animpos, or the animindex, whichever you desire. I'd prefer you use animpos, and have your tiles all in 1 actor to save file size. Now we need to have it make the arrays.

On Create Actor - Tile
Code: Select all
TileX[cloneindex] = x;
TileY[cloneindex] = y;
TileAnim[cloneindex] = animpos;


Saving the array is as easy as making them! Simply put them in a saved group.
Image

Then use the standard SaveVars. There's a way to load the arrays if you have a tile editor, but I forgot how to do that :P If you need that kind of information just post it in support.





That's pretty much all I know about arrays, thanks for reading!
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron