|
1 #summary Explanation of hats, how Hedgewars draws them and how one can create them |
|
2 |
|
3 = Introduction = |
|
4 |
|
5 In Hedgewars, every hedgehog can optionally wear its own hat as decoration. They can be selected on a per-hog basis in the team editor. |
|
6 |
|
7 = Types of hats = |
|
8 There are two types of hats: non-team hats and team hats. |
|
9 Non-team hats have a fixed coloring which does not depend on the team color. |
|
10 Team hats are hats which will be colored accordingly to the team color. |
|
11 I.e. if a hedgehog plays in a red team, its hat will we red. |
|
12 |
|
13 In the default Hedgewars installation, most hats are non-team hats. |
|
14 Examples for team hats in the default Hedgewars installation are cap_team |
|
15 and hair_team. Please note that those hats currently have no proper |
|
16 preview images. |
|
17 |
|
18 = Data structure = |
|
19 Hats are specified as PNG files with alpha channel. |
|
20 They consist of a set sub-images of a size 32px×32px each. |
|
21 Hedgewars counts the sub-images, or animation frames, from top-left to |
|
22 bottom-left, then it goes on with the next column, etc. |
|
23 |
|
24 _All_ hats are animated. Even those hats which appear to be “static” (for example: `constructor`) |
|
25 are animated, too, they use the animation to align the hat to the idle hedgehog. |
|
26 |
|
27 == Non-team hats == |
|
28 Non-team hats use an image of a total size of 64px×512px. Only the first |
|
29 19 frames are used, the remainder of the image is currently unused. |
|
30 It is best to keep this area blank. |
|
31 |
|
32 == Team hats == |
|
33 Team hats use an image of a total size of 128px×512px. This image is similar to that of non-team hats, the same pattern is repeated 64 pixels to the right. |
|
34 |
|
35 The team hat image consists of two “halves”: The left half is the base coloring of the helmet, the right half should _only_ use grayscale colors. The left part may be completely blank. So you have basically two sets of helmet animations. Again, both animations have exactly 19 frames, the remainder is unused. |
|
36 |
|
37 Hedgewars will use the right base image and use the colored right part of the image and simply overlay it. |
|
38 |
|
39 Transparent pixels on the right part will not be overlayed. This way, you can decide which parts of the helmet become colored and which won’t. |
|
40 |
|
41 |
|
42 = Alignment = |
|
43 When creating new hats, it is important to now where the hat will be actually placed. |
|
44 |
|
45 In the game, Hedgewars will use the idling frames (see `Data/Graphics/Hedgehog/Idle.png`) |
|
46 together with the hat frames. |
|
47 If a hat is used, Hedgewars will draw the hat over the idling hedgehog for each frame, but |
|
48 first it will move the hat’s frame up by 5 pixels. |
|
49 |
|
50 The first frame of the hat animation will be drawn over the first frame of the idle animation, |
|
51 the second frame of the hat animation will be drawn over the second frame of the idle animation, |
|
52 and so on. |
|
53 |
|
54 Another tricky part in creating hats is the fact that the idle hedgehog moves slightly up and down. |
|
55 This means, a good hat must consider this, otherwise the hat does not seem to be actually on the |
|
56 hedgehog’s hat, because it does not move with the hedgehog. |
|
57 |
|
58 This table shows the relative height of the idle hedgehog compared to the frist frame of `Idle.png`: |
|
59 || *nth frame of `Idle.png`* || *Offset to first frame* || |
|
60 || 1 || 0 px || |
|
61 || 2 || 0 px || |
|
62 || 3 || +1 px || |
|
63 || 4 || 0 px || |
|
64 || 5 || 0 px || |
|
65 || 6 || 0 px || |
|
66 || 7 || 0 px || |
|
67 || 8 || +1 px || |
|
68 || 9 || 0 px || |
|
69 || 10 || 0 px || |
|
70 || 11 || 0 px || |
|
71 || 12 || 0 px || |
|
72 || l3 || +1 px || |
|
73 || 14 || 0 px || |
|
74 || 15 || 0 px || |
|
75 || 16 || 0 px || |
|
76 || 17 || −1 px || |
|
77 || 18 || 0 px || |
|
78 || 19 || 0 px || |
|
79 |
|
80 This is how to read this table: If you would like to create a simple hat with no fancy animation, like, let’s say, a fedora, you would like the hat to “follow” the hedgehog. You could, for example, draw and align the hat image on the first frame, then copy it on all other frames and apply the offsets to the four “special” frames. |
|
81 |
|
82 |
|
83 = Installation = |
|
84 To install a hat, you have to save the file into `Data/Graphics/Hats` in your Hedgewars |
|
85 user data directory. The file name _must_ end with “`.png`”. |
|
86 |
|
87 The Hedgewars frontend will display the same name as the file name you used, minus the file name |
|
88 suffix. For example, the file “`Awesome Example Hat.png`” would be displayed as “Awesome Example Hat”. |
|
89 |
|
90 Hedgewars will always use the very first frame of a hat image to create the preview in the team editor. This also applies to team hats. |