Adding elements to a 2d array.

I’m working on a game that will use an 2d array to store data. I need the array be dynamic as it will grow as the player plays the game.

I am planning on using the built in 2d arrays (var x = new int:wink: because there faster and easier to use.

I need to add additional elements to the beginning and end of the array as the player goes through the game.

How would I go about doing this? Or if someone has a better idea to my problem that would be helpful.

This is for JavaScript btw

As mentioned you can create a List type like so:

  List<myType> myList = new List<myType>();

And to the add to this list all you need to do is:

  myList.Add(myObj); // where myObj is of type myType

To insert at the beginning do:

  myList.Insert(0, myObj);

select the one which best fullfils your need

1