how do i get the value of a place on a grid from the X and the Y
i am trying to make a 2d copy of Minecraft and i am using arrays to save the data, (i will move to a more elegant solution in the future but this should work for now) and i have the array layer out in a grid seen from lines 6 to 15 in scripts.js what i need to do is find what array number it is from the line number and which iteration of the loop in line 18
Have you tried out 2d arrays?
You can access them like this:
each 'row' is the y and each 'column' is the x.
Please do add
let to variable declarations, and don't forget to add semicolons!
404 not found error.... wheres your repl?
Generally: for a 9x9 grid and i have its value arranged like this:
Then u can create a formula.
Example i have value 9,
I could :
X = (9%3), y = (9//3)
X = 0, y = 3
X = 2%3, y=2//3
X = 2, y = 0