[Sonic 1] Basic Guide on making Custom Animations

Discussion in 'Tutorials Archive' started by M.N.K., Dec 28, 2010.

Thread Status:
Not open for further replies.
  1. M.N.K.

    M.N.K. In the River of Darkness... Member

    Joined:
    Feb 22, 2009
    Messages:
    506
    Location:
    Earth...
    Well as many of you have seen in various hacks such as Harder Levels, Megamix and more. Many of the animations for Sonic have been changed such as the spring jump animation or the ducking animation for example. Well in this guide of mine I will show to those who don't know how to do that how to make there own type on animations for Sonic. In this case we will make a simple custom ducking animation. I Should also mention that this can also be applied to Sonic 2 as well for those who are using Xenowhirl's Disassembly as it's type of animation loading routines are very much similar to the sonic 1 Hivebrian Disassembly animation loading routine. 

    Things required:

    - Sample sprite [​IMG] (right-click & save picture to desktop)
    - _anim/sonic.asm
    - SonMapED
    - Some free tile space for Sonic's art

    Now lets get started!
    To start things off, assuming that you know how to use SonMapED, open that up and load up all of Sonic's art, mappings, and dynamic pattern load cues. Before I actually tell you how to do this, I will show you the basics of how to know which sprite will be loaded for the animations. Ok, from what I have learned when I first found out how to do this, basically every animation for sonic uses a certain amount of sprites for each of them in the game by loading the a set of ID's for the sprite to make it work. to be specific, this picture will show what I am talking about.
    [​IMG]

    As you can see, the two red circles show the sprite and its ID number which loads the sprite itself. as for the other three sprites after that, Their ID numbers would be Offset's 2, 3 and 4. And for actually seeing how they work, taken from the the animation file for sonic of the disassembly, here is the original line for his waiting animation:


    Code:
    SonAni_Wait: dc.b $17, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, 2, 2, 3, 4, $FE, 2, 0
    
    So the numbers between Offset's "$17" and "$FE, 2, 0" are the ID numbers for the sprites used for making the animation work. By simply changing one of the ID numbers for a different one for a custom sprite made by yourself or simply just porting one from other games such as Sonic 3. The animation would then be changed with the sprite or sprites that you added. And as for Offset "$17", this is to control how fast the animation will be. the lower it is, the Faster it gets and vice versa. as for Offsets "$FE, 2, 0", this one in specific control's how the animation will look. in this case, it would just read as him in his standing pose and then goes on to him taping his foot on the ground in a looping order. Of course there will be different ones but once you play around with those Offsets in the beginning and end of every animation line, it starts to become a bit more easier. With that said, hopefully if you have an idea of how this works now, let us now begin!

    Go ahead and scroll all the way to the end of the last sprite for Sonic and insert a new slot for the sample sprite as stated at the top of this tutorial.
    If you don't have the spindash added to your hack, then the ID number should be $58. If you do have it, then it should be $5E. After that save his art, mappings, and dynamic pattern load cues and open his animation file (_anim/sonic.asm) and scroll down to SonAni_Duck. Again, assuming that you do not have the spindash in your hack yet, change the line from this...


    Code:
    SonAni_Duck: dc.b $3F, $39, $FF, 0
    
    To this:

    Code:
    SonAni_Duck: dc.b 7,$58,$39, $FE,1, 0
    
    And if you do have the spindash, change it to this:

    Code:
    SonAni_Duck: dc.b 7,$5E,$39, $FE,1, 0
    
    Then save it and build your rom, if done correctly, you should now have a custom ducking animation in you hack. Now if you want to make more custom animations, all you really have to do is just study the animation file for Sonic like I did and you should be fine.

    I hope this guide will be helpful for someone!
     
    Last edited by a moderator: Oct 15, 2013
  2. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    Neat guide! Just want to add, that 0 at the end of some lines (including the ones you showed off here) are totally unnecesary and can be removed. Their only purpose is to make the elements per line an even number.

    and i fixed your horrible writing style again, this could become a hobby
     
  3. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Joined:
    Aug 8, 2008
    Messages:
    1,067
    Location:
    Jardim Capelinha, São Paulo
    Hm... this guide is... interesting. I've ever had animations as one of the the easier thing to figure in ASM hacking, meanwhile this can be useful for beginners.
     
  4. MicroChirp

    MicroChirp Wow, I was so stupid a few years ago... Member

    Joined:
    Oct 4, 2010
    Messages:
    366
    Location:
    In the middle of nowhere
    Thanks for posting this, Xero!
     
  5. Hitaxas

    Hitaxas Retro 80's themed Paladins Twich streamer Member

    Joined:
    Aug 13, 2007
    Messages:
    167
    Oh, this is here too.


    Copypasta time I guess.


    From Sonic Retro's topic:

     
    Last edited by a moderator: Dec 28, 2010
  6. SpirituInsanum

    SpirituInsanum Well-Known Member Member

    Joined:
    Feb 11, 2010
    Messages:
    642
    May I add some informations about animations? Selbi's comment made me think about one of the other ends of lines.


    Basic stuff, but beginners may want to know.


    If you want to change or add running/peelout/flying animations, you'll notice the lines are like this:



    SonAni_Run: dc.b $FF, $1E, $1F, $20, $21, $FF, $FF, $FF



    See how they end with $FF, $FF, $FF.


    The reason is the running animations are using a common frame counter. So if you have several walking/running animations where the feet are clearly visible, you can change from one animation to the other without changing the position of the feet (for example left foot on the ground, right foot rising), which makes it flow better.


    Also when Sonic is running or walking, the animation number is always set to 0 (at offset $1C from Sonic's object main address for S1 & S2, $20 for S3) which makes it easier to treat all the running animations the same way.


    But when you have less frames in one of your animations, the frame number may point to wrong data (data from the next animation), unless you set that data to something that makes sense, like an $FF which forces the animation to restart.


    example:




    SonAni_Walk: dc.b $FF, 8, 9, $A, $B, 6, >>7<<, $FF ; of course, don't add >> << in your code


    SonAni_Run: dc.b $FF, $1E, $1F, $20, $21, $FF, >>$FF<<, $FF



    If the current frame is the 6th one while walking and the animation has to change to the running animation, the new frame will be $FF (restart animation according to the Sonic_Animate routine).


    So all you need is to add $FF to those running animations until they're as long as the longest running animation.
     
    Last edited by a moderator: Dec 28, 2010
Thread Status:
Not open for further replies.