I'm looking to create a grid of objects using JavaScript. Unfortunately, I can't remember the formula and I haven't been able to find it online:
var width = 113;
var height = 113;
var col = 10;
var row = 10;
for (var j = 0; j < col; j++) {
var object = new object();
object.position.x = 0 + width * j
// Do I need another loop here?
// Add object to....
}
Currently, this code will give me a row of 10 objects spaced according to their width. However, I also want to create columns to form a 10x10 grid. Any ideas on how to achieve this using JavaScript?