All Questions
6 questions
7
votes
3
answers
187
views
JS function to initialize properties
I have some JavaScript code to manage a 2D map in a game. I have a function to create a new room in the map which is at map[x][y]. I need to create that property ...
3
votes
1
answer
322
views
Traversing a tile-based 2D-array map using keyboard controls
I've produced the beginnings of an RPG-style game using HTML5 and canvas. So far you can use the keyboard controls WASD to move an avatar around a simple tile-based map. The map is constructed of ...
7
votes
1
answer
1k
views
Improved manipulation of a 2D array for a game map
I have a 2D array (or rather, an array of arrays) representing tile maps in game. The 'world' map array holds smaller arrays representing individual map parts which I am calling 'rooms':
...
3
votes
2
answers
3k
views
Cleaner structure for Battleships code
The code provided is working fine, but I would like to see if there is room for improvement for the code provided:
...
8
votes
2
answers
1k
views
4
votes
1
answer
734
views
2-dimensional "wrapping" array
I'm writing a simple JavaScript game, which uses a 2-dimensional array as the main data structure. I wrote this function-class-thing that allows me to give any two integers, positive or negative. ...