• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Storing multiple values in one variable - vec equivalent?

Slyddar

Member
So shaders have the ability to store multiple variables in one variable, vec2 holds 2 variables, vec4 holds 4, etc. Does GML itself have a way to do this, beyond coding it yourself?

I want to store the last 20 positions of an object, x, y and z, and having multiple lists seems inefficient. Using GLSL's vec's, or an equivalent, would be very useful.
 

FrostyCat

Redemption Seeker
Arrays in GML have been playing that role for quite some time now.

Assuming that you are on GMS 2, here are two examples:
Code:
coords = [15, 23, 96];
Code:
ds_list_add(list, [x, y, z]);
 

Slyddar

Member
Well I know vecs are just arrays, and of course it's possible in GML, but I was wondering if there was an actual function, or another method people were using. Adding an array to a list like you've shown I guess is the easiest method I could use.

Thanks for replying.
 
Top