Today I want to explain how the orientation of markers work.

The markers on the sprites define where the slots of the object are. With orientation.x and orientation.y the orientation of the object in that slot can be defined. This comes handy when a slot will be occupied by an entity which should face the right direction.

My research found, that the orientation can be set with the values -1, 0 and 1 in both orientation.x and orientation.y.

Basically there are 4 possible orientations: facing north, south, west and east, but there are 9 (3×3) possible combinations of orientation.x and orientation.y with values -1, 0 and 1. My question was how those properties have to be used to get the right result. So I tried each combination and the results are shown in the image below. As the image shows, the orientation.y property is dominant and changing orientation.x when orientation.y is not 0 doesn’t have any effect. Also, as orientation.x 0 and orientation.y 0 force the entity to face south, orientation.y 1 is not necessary. With that in mind we get 4 usable combinations (bordered red) to get the four directions an entity can face.

Conclusion
The original spritebank file uses floating point numbers between 0 and 1 to define the orientation. It’s not clear why there are floats for the orientation. But most markers just face south. Floating point numbers are not necessary to define the direction. Also only four of nine combinations are actually needed to get entities properly aligned.

Orientation of prisoner entity based on the orientation.x and orientation.y properties of the marker.

Orientation of prisoner entity based on the orientation.x and orientation.y properties of the marker.

Acknowledgement
I want to thank Mr. Peter Green and his family for participating in this experiment.

Leave a Comment

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax