game map rendering

game map rendering

game map rendering or simply map rendering is a nice technique that is used to generate worlds.

explanations follow suit :





first we initialise our world as a 2d array, we distinguished patterns by using 0 and 1



next we initialised the width of a tile. the formula for tile placement is x*tile_width



next we separated our tile rendering in two functions, for now it’s just colored squares



we loop or the array twice, one for the row and one for the column to get the index to accesss our map by game_map[x][y]


here we render according to predefined symbols, it could have been ‘g’ and ‘p’ for grass and path

Lives in Mauritius, cruising python waters for now.

Comments are closed.