![]() |
I don't understand how to define sprites! |
Previous | Graphics and Display | Next |
Q: | I can't understand how sprites are defined; I looked in many program sources, and every sprite definition looks for me as an array of random hex numbers!? |
A: |
Well, suppose that you want to make a sprite which is a
filled circle. Make a grid on the paper, and make a sprite shape by filling
grid squares. Then, replace each filled square with 1 and each blank square
with 0. In above example, it may look like:
00111000 01111100 11111110 11111110 01111100 00111000 Then, produce rows as a set of binary numbers, and convert them to hex. For example: 00111000 binary = 38 hex 01111100 binary = 7B hex etc. These hex numbers describe the sprite, i.e. the sprite definition should be unsigned char sprite [] = {0x38, 0x7B, ...};assuming that Sprite8 will be used. That's all... Note: TIGCC also supports binary numbers ( 0b... ).
|