I have been reading alot on tile-based game programming but i could not find a satisfying answer to this question.
I want to know how i can divide the screen into tiles of a size like 32?
I am doing it in JAVA.
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.
Sign up to join this communityI have been reading alot on tile-based game programming but i could not find a satisfying answer to this question.
I want to know how i can divide the screen into tiles of a size like 32?
I am doing it in JAVA.
You do not divide a screen into tiles, you create a field that renders tiles in a grid sequence. Those are usually some sort of bitmaps that are stored in memory and are placed one after another to form a bigger picture - the tile grid. For a 2 dimensional grid, you'd use two for..loops (one inside another) to render rows and columns.
for(int i=0; i<rows; i++){
for(int u=0; u<columns; u++){
// render tile with the coordinates [i,u] at position [32*i,32*u]
// that is assuming your tile size is 32x32
}
}