Page 1 of 1

Array Tutorial

PostPosted: Mon Oct 19, 2009 5:41 am
by MysticTrunks
Side Note: I've never used arrays with Game Editor, I'm very familiar with them from C++ and C# and how they're used even familiarizes me more with Game Makers GML.
(I don't know the max "d" with Game Editor I'm just going to assume it's 3D)

Like any game you're going to need a global script that controls the variables that are attended in every level if not then use local scripts.
Let's begin!

Before I begin I'm going to assume you know what int, float, and var are. If not I'd suggest looking them up.

Code: Select all
int party;

party[0,0] = name; // Name of your character
party[0,1] = 100; // HP
party[0,2] = party[0,1]; // Max HP 
party[0,3] = 15; // SP
party[0,4] = party[0,3]; // Max SP



There's so many things you can do with arrays like for example a RPG Management system, I'll be posting my GML code in hoping someone can transfer it over but C isn't far off from GML and I'm already getting used to programming with Game Editor.

I use arrays for Menus, Data management, inventory, etc.

Basically to draw the values of the array just create a actor with a draw event and just use this.
int name;
name = party[0,0];

But for menu's you would be using the for command.

Hope you all enjoyed this beginner tutorial to arrays.

Re: Array Tutorial

PostPosted: Mon Oct 19, 2009 11:54 am
by makslane
Thankyou for this post.
Only two notes:

Use party[x][y] instead party[x, y] to access an array member.
Game Editor is a 2D game creation tool, but if you are talking about the array dimensions, it can have many dimentions.