Currently, mainly just for fun, I'm working on a 2d game where I have all collide-able blocks (background) assorted into an array when its loading, along with the player put into a different part of the 3d array. The player object gets put in with the AI array. It looks like this -->
var world_objects = [
[], //All 'background' collide-able objects. Such as stones and the border ~~ Code name: bg
[], //All AI ~~ code name: ai
[] //Projectiles ~~ Code name: ps
];
The map is set up into a bitmap that I've made using another 3d array, that currently is made into a 15x15, but that is subject to change. The brown border is included in the bitmap and world_objects array. And when the blocks/ai/projectiles are inserted, they all will have a basic object properties of:
x, y(2 variations, one with just normal x,y according to the exact pixel in the canvas, and the other is according to which cell its in for the bitmap)
Width, height (Both width and height for ai and projectiles are recorded as percentages according to the size of each cell, because the size is made to change depending on screen size)
Along with other properties not related to collision. What would be the most efficient way of detecting all objects and whether they collide or not? If needed, I could add additional properties to each object if that would make it easier and more efficient.