You will have to sort (in the code which frame is which) to use the animation correctly. X, y, width, height, x2, y2, width2, height2. It saves the results into a text file organize by a list of four values for each frame. I can upload the source for the tool I use myself to a github for you to download. Otherwise if there are many spritesheets and they are not in an even grid, you may want to cook up a tool or look for one online(I am not aware of any). It would save you time if you have several sprites. I personally prefer the grid method, have your artist or friend cut and paste the frames into an even grid made of sufficiently large blocks. If you do go with making a tool, you may want to both save the first click (for frame's top-left corner, and another click in the bottom-right to get the width and height). I can elaborate on how to create a tool like this or you could use Ivan's advice. pageX clientX + width of the scrolled-out horizontal part of the document. The two coordinate systems are connected by the formula: pageY clientY + height of the scrolled-out vertical part of the document. I then use that file to split the spritesheet. There’s no standard method to get the document coordinates of an element. If that is not the case cause the artist is not aware of programming needs, I cook up a tool that displays the sprite sheet on screen and saves my click's (mouseX, mouseY) positions into a file. Then every sprite depending on the frame size is in (j * FRAME_WIDTH, i * FRAME_HEIGHT). What normally happens when I work with sprites is that the frames are put into an even grid for ease of use. I can share something automated on github if people are interested, the main catch is that if the frames are not even in size which is common, you may need to adjust them manually anyway. There is a tool you can use to do it manually that is relatively painless:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |