In QBasic, you can define a user defined type such as:
TYPE tile
x as integer
y as integer
END TYPE
then an array of tile can be created:
DIM newarray(10) AS tile
How can I make something like this happen in JavaScript?
In QBasic, you can define a user defined type such as:
TYPE tile
x as integer
y as integer
END TYPE
then an array of tile can be created:
DIM newarray(10) AS tile
How can I make something like this happen in JavaScript?
class Tile {
var x : int;
var y : int;
}
var newArray = new Tile[10];
Individual elements are null until initialized. You can also make a constructor for the Tile class.
–Eric
Lots of helpful Unity programming docs out there like.
C# isn’t identical but you have option of
public class Tile
{
public int x;
public int y;
}
or
public struct Tile
{
public int x;
public int y;
}
and array of them is
public Tile[ ] newarray = new Tile[10];