607
Member
Hi, it's me again!
I am trying to store coordinates into a list. However, there is no supported tuple data type in GML. It also doesn't seem possible to declare my own class. I tried using an array, but it gets changed by later actions, even after adding it to the list.
For example:
Will result in the list example only containing arrays consisting of a 4 and a 3; that is, if the coords array isn't reused later on in the code.
How can I store separate coordinates in each entry on the list?
With objects, it is no problem to reuse the same names, but apparently within an instance (or within an event, maybe), it is. How do I fix this, or get around it?
I am trying to store coordinates into a list. However, there is no supported tuple data type in GML. It also doesn't seem possible to declare my own class. I tried using an array, but it gets changed by later actions, even after adding it to the list.
For example:
Code:
example = ds_list_create();
for (xcor = 0; xcor < 5; xcor++)
for (ycor = 0; ycor < 4; ycor++)
{
var coords;
coords[1] = ycor; coords[0] = xcor;
ds_list_add(example,coords);
}
How can I store separate coordinates in each entry on the list?
With objects, it is no problem to reuse the same names, but apparently within an instance (or within an event, maybe), it is. How do I fix this, or get around it?