So if you use 2d arrays, then how do you handle the collision?I mean the boolean array is good enough to know if the tiles are solid are not, but what for the positioning?If you use move the player 1 pixel at a time until the collision is over, doesn't this looks a bit weird(considering in terms of visual, like if the player is in half of the tile)
It's not moving 1 pixel per frame, it's moving by 1 pixel until there is no collision anymore, so
//move by 1 pixel
xspeed = 0;
so what will happen is, say the player has a xspeed of 10, and there is a tile 4 pixels to the right of the player. The player will move by 10 pixels, and register a collision, now it starts moving 1 pixel to the left in a loop, until there is no more collision; this will happen after 6 loops. At the end of the game tick, the player has effectively moved 4 pixels to the right, and touches the tile.
regarding the boolean array, I made my own hitbox-ish system, and I check for important points within the hitbox. Each of these points I translate to a point in the boolean array (which is simply dividing the coordinate by the Tile width and/or height, and then flooring it). It's just a different way of checking for collision.