Align Sprite

Discussion in 'Approved' started by MarkeyJester, Jul 29, 2011.

Thread Status:
Not open for further replies.
  1. MarkeyJester

    MarkeyJester ! % # @ Member

    Joined:
    Jun 27, 2009
    Messages:
    2,676
    Recently I asked Aquaslash to import some sprites for me (or rather he offered to do it), and the method he uses for importing sprites is by seperating all the sprites into their own bitmap files and arranging them ready to be imported to SonMapEd, making something kinda like this:


    Image


    However, it took him quite a long while to seperate an entrie set individually like that (about 214 sprites took approximately a days worth), which gave me an idea, so I spent a few hours last night writing up a little program to help speed things up:


    Download


    This program will automatically align the bitmap of a sprite up and blank out the emtpy tiles ready for importing to SonMapEd, let's take this bitmap for example:


    Image


    It's a single sprite randomly place in the middle of the bitmap file with no effort. After draggin and dropping it onto that program, my program will re-arrange it to:


    Image


    Automatically aligning it up the smallest it can go and blanking out the unused tiles all ready to be imported!


    Have fun.


    Usage:

    1. Place a sprite of your choice randomly in a bitmap file like this for example.
    2. Save the file and then drag and drop that file onto "AlignSprite.exe"
    3. The file is now convert and prepared

    You can also use a batch file to convert multiple sprite files at once using something like:



    Code:
    @echo off
    
    AlignSprite.exe WalkFrame01.bmp =
    
    AlignSprite.exe WalkFrame02.bmp =
    
    AlignSprite.exe WalkFrame03.bmp =
    
    AlignSprite.exe WalkFrame04.bmp =
    
    AlignSprite.exe WalkFrame05.bmp =
    
    AlignSprite.exe WalkFrame06.bmp =
    
    AlignSprite.exe RunFrame01.bmp =
    
    AlignSprite.exe RunFrame02.bmp =
    
    pause

    Sidenotes:

    • The bitmap image must be 24-bit format.
    • The bitmap image cannot be too big, the biggest I could go was this (though more newer machines than mine should be able to do bitmaps bigger than that, either way you can import the ending sprites with no problem).
    • My program will "assume" the very top left pixel of the bitmap is the transparant colour.
    • My program will blank the empty tiles with the standard pale purple colour FF 00 FF (255 000 255).


    If you have any questions, feel free to ask.
     
    Last edited by a moderator: Jul 29, 2011
  2. OrdosAlpha

    OrdosAlpha RIGHT! Naebody move! Administrator

    Joined:
    Aug 5, 2007
    Messages:
    1,780
    Location:
    Glasgow, Scotland
    Interesting. I manually insert individual frames myself into SonMapEd, which can be very tedious and time consuming. Hopefully your app will expedite the process the next time I need to insert a shit load of sprite frames.
     
  3. Animemaster

    Animemaster Lets get to work! Member

    Joined:
    Mar 20, 2009
    Messages:
    1,226
    Location:
    UK
    This looks to be a handy tool, I'll definately give this a whirl I'm always importing sprites.
     
  4. EMK-20218

    EMK-20218 Eduardo Knuckles Member

    Joined:
    Aug 8, 2008
    Messages:
    973
    Location:
    Outworld
    Yeah, this really makes our lives much easier when port multiple sprite art into hacks. This was greatly made, very useful stuff. Thanks! ;)
     
    Last edited by a moderator: Jul 29, 2011
  5. Crash

    Crash Well-Known Member Member

    Joined:
    Jul 15, 2010
    Messages:
    300
    Location:
    Australia
    Kinda surprising there isn't already a program that does this - it's not just useful for Sonic hacks, you could use it for working with sprites in any game on any of the 8/16 bit consoles.
     
  6. MarkeyJester

    MarkeyJester ! % # @ Member

    Joined:
    Jun 27, 2009
    Messages:
    2,676
    It's funny you should mention multiple compatability, another reason why I wrote this was to create a header library file for bitmap manipulation (I was getting sick and tired of rewriting functions to load/edit/save bitmap files), now that I have a personalised header with a few useful functions I can strictly speaking adjust the size from 8x8 to another size for another machine in next to no time, so if you have another machine you're working on that reads art in a different size from 8x8 I can quite easily make one for that format for you.
     
  7. redhotsonic

    redhotsonic Also known as RHS Retired Staff

    Joined:
    Aug 10, 2007
    Messages:
    2,967
    Location:
    England
    Awesome, this really helps. Although, to anyone using it, you would want to import the palette first from the picture without the pink blocks, so you can get an extra colour. Then, import the picture itself using the "direct to nearest match" for best colours. The pink will now be grey or something, but you won't be using it anyway. At least this way, you won't have a pink in your palette line.


    Thanks, Markey, greatly appreciated.
     
  8. Spanner

    Spanner The Tool Administrator

    Joined:
    Aug 9, 2007
    Messages:
    2,330
    This is a very useful tool and might encourage more people to import mappings in this way without SonMapEd causing a bunch of issues with it. Good work!
     
  9. GalliumGrant

    GalliumGrant Void. Member

    Joined:
    May 11, 2010
    Messages:
    384
    Nice job Markey. I have SonMapEd, but I always hated importing sprites because of all the complications.


    Now I think I'll finally be able to try it out properly.
     
Thread Status:
Not open for further replies.