Remember me
You are here: HomeForumCyberix3D ForumGeneral Discussion
Welcome, Guest
Username: Password: Remember me

TOPIC: Arrays

Arrays 8 years 5 months ago #452

Could someone explain how to use arrays? I seem to be able to create one and set an element of it but not to check it or use it in any way.

If there's already a thread or tutorial then apologies but I couldn't find it - please redirect me.

I am also assuming an array is a table of variables as in other programming languages - if it actually means something else here that would be good to know. Thanks
The administrator has disabled public write access.

Arrays 8 years 5 months ago #453

  • cyberix3d
  • cyberix3d's Avatar
  • OFFLINE
  • Administrator
  • Posts: 703
  • Thank you received: 697
First, you need to create an Array and give it a name.
Then you can use the "Set Array" command to set a cell in the array.
If you use only the x position it will be a regular array and if you use the x,y position it will be a 2D array.

You can access the array using the [] syntax.
For example, if you want the 5th cell in a regular array with the name of arr1 you can write arr1[5]
And if you want the 3rd and 5th cell in a 2D array with the name of arr2 you can write arr2[3][5]

Here is an example of a regular array:
www.gamemaker3d.com/player?pid=01615828

And here is an example of a 2D array:
www.gamemaker3d.com/player?pid=01615844

Regards,
Cyberix3D team
The administrator has disabled public write access.
The following user(s) said Thank You: Joshua-Westbury
Time to create page: 0.071 seconds