Game Project – 2D / 2.5D

20151102-20151108: Rotation

This week I started to think about how to display buildings with height in the 2D-view. When the x-axis was horizontal and z-axis vertical on the screen, I didn´t want to have the y-axis vertical or combined. So I decided to rotate x and z 45 degrees and then have only the y-axis vertical (as in games like StarCraft, SimCity etc.).

First I did some tests at the place in my code where coordinates are converted to canvas dimensions to get a working rotation. I also tried to rotate the drawing object (ctx context) prior to drawing, but this made things more complicated later in code so I kept working with conversion of coordinates.

Then I added drawing of walls for buildings, vertical offset when Y is higher than ground and some tests with drawing of cells in general.

Leave a comment

Design a site like this with WordPress.com
Get started