Hammerwatch Forum
Custom mapping and Mods => Editor Discussion => Topic started by: Dai Tou Zai on October 11, 2014, 09:48:16 PM
-
So im trying to add a couple of custom sprites to my map and im editing the script and i cant figure out some of these things
<texture>doodads/Tree12.gif</texture> (Can gif's be used?)
<origin>48 72</origin> (What is origin used for?)
-
The editor is not made for gifs to be used. The editor will just crash if you point on a gif file through the xml's. (I tested it out)
----------------------
Press F1 in the editor to see collisions and origins.
The origin is the pivot point of any sprite. It determines where the collision starts and what is above or below if the objects are in the same layer.
(http://i.imgur.com/GLuCBQF.png)
As you see in the picture, objects that are above a origin will rendered as behind it.
I have marked with blue where the origin point is on a few creatures. As you can see we recommend placing the origin in the middle of characters while environments is varies a lot more mostly to make sure the players or objects does not appear infront weird on any object.
Hope that answers your questions! :)
-
Thank you, now i just need to figure out how to do collision :) do you know if there's a tutorial for this stuff, i cant seem to find one and id like to figure out how to do dimensions as well kinda confused about the 0 0 0 0
-
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).
(http://i1005.photobucket.com/albums/af175/Cody_Jordan/fence_tut_zpsd29c322b.png)
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
-
Oh i get it now, thanks alot guys :)
-
Hammersprite can also help generate some of it for you and you can modify any other things you need from that point.
-
Hammersprite can also help generate some of it for you and you can modify any other things you need from that point.
I actually tried that phantom, cant say it worked for me keep getting this error.
(http://i.gyazo.com/71d48ccb87bbe5dfd0a191479d465507.png)
<doodad ao="false"> defaultlayer="20"
<sprite scale="16">
<texture>trees/T1.png</texture>
<origin>32 63</origin>
<frame>0 0 63 66</frame>
</sprite>
<collision static="true" shoot-through="false">
<polygon>
<point>-5 2</point>
<point>2 0</point>
<point>5 1</point>
<point>6 0</point>
<point>4 -3</point>
<point>7 -6</point>
<point>3 -11</point>
<point>-5 -12</point>
<point>-4 -7</point>
<point>-7 -6</point>
<point>-5 -3</point>
<point>-7 1</point>
</polygon>
</collision>
</doodad>
not really sure what i'm doing wrong.
EDIT - I fixed it but now i have a new problem texture size should be the power of twos? what the hell does that even mean
-
power 2s are
2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, etc
Your png file width and height pixel size should be of those dimensions.
-
All hail the mighty power of 2, the avatar of binary made manifest.
-
power 2s are
2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, etc
Your png file width and height pixel size should be of those dimensions.
Oh okay so i just have to resize them
Not a big deal tbh i mean the editor still runs good and now i have these beautiful trees!
(http://i.gyazo.com/0e689a61c26891e10d2c17c9b081db05.png)
Golden sun graphics work perfectly with hammerwatch because they use the exact same sizes for the doodad tiles (Except for trees obv) and they're of the same quality, probably wont use the ghost trees.
eh ill do shading later
-
Oh man, lovely trees, keep them coming.
-
Oh man, lovely trees, keep them coming.
not going to do all the golden sun graphics but ill def send you them when i finish editing everything
-
I needa stop working on my world 3 and just complete my world 2 ;-;
(http://i.gyazo.com/680c004e1736fbf75922aa08e2d1ccc6.png)
-
Is this world 3?
-
Is this world 3?
yeah, planning on having a city with like a couple of sidequests or you can just say f it and go to the castle to continue the main storyline.
-
Hammersprite can also help generate some of it for you and you can modify any other things you need from that point.
I actually tried that phantom, cant say it worked for me keep getting this error.
(http://i.gyazo.com/71d48ccb87bbe5dfd0a191479d465507.png)
<doodad ao="false"> defaultlayer="20"
<sprite scale="16">
<texture>trees/T1.png</texture>
<origin>32 63</origin>
<frame>0 0 63 66</frame>
</sprite>
<collision static="true" shoot-through="false">
<polygon>
<point>-5 2</point>
<point>2 0</point>
<point>5 1</point>
<point>6 0</point>
<point>4 -3</point>
<point>7 -6</point>
<point>3 -11</point>
<point>-5 -12</point>
<point>-4 -7</point>
<point>-7 -6</point>
<point>-5 -3</point>
<point>-7 1</point>
</polygon>
</collision>
</doodad>
not really sure what i'm doing wrong.
EDIT - I fixed it but now i have a new problem texture size should be the power of twos? what the hell does that even mean
WIth hammersprite, it may be that if you have more than one folder, its the wrong folder when generated so you have to go manually do a few yourself, which isn't too bad.