Tuesday, November 29, 2011


Midnight inspiration came into my mind after eating (-almost-forgotten) steamed-choco-berry-bread about how to design tile-based-parallax-background for 2D-game. First, I wanna explain the concept what I meant through picture below:
I assume the circle is an island ('ISLAND MAP'-labeled) and the main character will walk around in the edge. I have a view ('CAMERA'-labeled) of gamers with direction from near-plane to far-plane, so it seems (-usual) scrolling map with parallax background. I also assume that I'll use input (left-and-right-arrow) to control the direction (to-the-east-or-the-west) of auto-move characters. The problem is when we use tile-based and define that the map is cyclic (-problem-defined).

Let's start, we have an array of tile represented in Integer and the value represent the tile asset.

int[] arrTile = { 6, 6, 1, 1, 1, 5, 5, 5, 5, 5, 1, 1, 1, 1, 2, 2, 2, 6, 6, 1, 1, 1, 5, 5, 5, 5, 5 };

The tile engine will process the array in order start-point is the next to the end-point.