Lets take a look at the h_16_fence.xml
<collision shoot-through="true">
<polygon>
<point>0 8</point>
<point>0 -4</point>
<point>32 -4</point>
<point>32 8</point>
</polygon>
</collision>
If you go into the editor and turn on "Show Physics" those little green boxes are the solid parts of an object, just like in the picture up above. The easiest way to make them is to copy-paste an existing similar item and then just mess with the numbers a bit. Lets look at what they mean.
shoot-through="true" should have fairly apparent implications, letting you make some objects permeable to projectiles or not, remember we pulled this one off the fence xml. The next bit takes a bit more explaining.
A polygon is just a shape made up of straight lines and corners, and the points between the two <polygon> tags is the list of points which makes up that bounding shape (in this case a rectangle, since we have 4 points arranged such).
Feel free to change around the numbers to get a better idea of what these points do, but I'll try to explain. The first point, <point>0 8</point>, is the bottom left corner. The first number there is how far that corner is to the right of the origin (remember the origin is that little red bit), so in this case it directly lines up with it. The next number, 8, is how far below (down!) it is from the origin. So the first point is just 8 units directly under the origin.
The next point, <point>0 -4</point>, is the top-left one, since its just 4 units above the origin (since the 4 is negative). The next two points form the top-right and bottom-right respectively, and then it always connects the shape back to the first point. Thats how the shape is defined and thats what makes it in to a solid object in Hammerwatch. So in order to make your own doodad you have to set up those numbers so that the shapes lines up with your graphic.
Don't forget to Reload Assets (Ctrl-R) after you make changes to an xml, and always remember that you have to save those changes for them to matter. Good luck.
---
Oh and here's an example of a circle collider.
<collision static="true">
<circle offset="0 0" radius="8" />
</collision>
Good luck figuring it out. Remember your two best tools are:
- Guessing and seeing what happens
- Copying and pasting
I believe some sources refer to this as "an exercise left to the reader" lol