Hello
Guest
, please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length.
ZFGC
>
Resources
>
Coding
>
Problems with 2-Dimensional Arrays
« previous
next »
Pages: [
1
]
Go Down
Print
Author
Topic: Problems with 2-Dimensional Arrays (Read 979 times)
0 Members and 1 Guest are viewing this topic.
Soulja
Problems with 2-Dimensional Arrays
«
on:
September 19, 2006, 10:51:30 pm »
Reputation: +0/-0
Offline
Gender:
Posts: 221
Okay, I got the simplest piece of code ever, but for some reason it won't work. All I want to do is initialize a 2-dimensional array.
The code is:
Code:
[Select]
var grid[10,20];
It gives an error at the 1. What the hell am I doing wrong?
Logged
Atrius
Re: Problems with 2-Dimensional Arrays
«
Reply #1 on:
September 19, 2006, 11:08:56 pm »
Fear my Blades
Reputation: +3/-0
Offline
Gender:
Posts: 562
You don't have to initialize variables in GameMaker, the only thing that's good for is keeping variables localized to certain scripts, and if thats your goal drop the brackets and numbers in them.
so just use
var grid;
You can't really initialize an array with a size to start out with.
Logged
I've done it (sorta)!
Bloom Lighting in GameMaker
, and 3D mode too! Check out the awesome Screen Saver.
Soulja
Re: Problems with 2-Dimensional Arrays
«
Reply #2 on:
September 19, 2006, 11:12:26 pm »
Reputation: +0/-0
Offline
Gender:
Posts: 221
I don't understand... how do you make an array then?
EDIT: Oh, nevermind, I get it now. Thanks for the help!
«
Last Edit: September 19, 2006, 11:14:48 pm by Soulja
»
Logged
Atrius
Re: Problems with 2-Dimensional Arrays
«
Reply #3 on:
September 19, 2006, 11:14:37 pm »
Fear my Blades
Reputation: +3/-0
Offline
Gender:
Posts: 562
Just start assigning values to it. GM is weird with variables, you don't have to make them all, just start using them, of course you have to assign them a value first because it'll give you an error if you try to get something that isn't there.
Logged
I've done it (sorta)!
Bloom Lighting in GameMaker
, and 3D mode too! Check out the awesome Screen Saver.
Soulja
Re: Problems with 2-Dimensional Arrays
«
Reply #4 on:
September 19, 2006, 11:15:47 pm »
Reputation: +0/-0
Offline
Gender:
Posts: 221
lol, I edited my post right after you posted. :O
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
ZFGC
>
Resources
>
Coding
>
Problems with 2-Dimensional Arrays
Contact Us
|
Legal
|
Advertise Here
2013 © ZFGC, All Rights Reserved