January 2016
Intermediate to advanced
304 pages
6h 17m
English
Until now we've been loading a prebuilt level from a text file. This level file already knew which textures needed to be used and where they should be used, but since we're now generating them procedurally, that's not the case. We need to decide which tiles should have which sprites.
A common way of approaching this is simply to create a monstrous if/else statement. In principle, it's a simple task; define each tile through a series of if statements and set the right tile. However, in reality, you end up with a complex mess of code that is very difficult to read.
Imagine a situation where you have a tile set of fifty possible variants. The amount of code required to choose which tile goes where would ...
Read now
Unlock full access