Animation triggers in Sonic 1

Discussion in 'Discussion & Q&A' started by Scrap Sorra, Sep 21, 2020.

  1. Scrap Sorra

    Scrap Sorra Well-Known Member Member

    Joined:
    Sep 18, 2020
    Messages:
    112
    Location:
    Development Hell
    I wanted to have Sonic use different animations when walking underwater and being hit by electrical hazards, (I added the sprites to the files and have the animation data set up), but I can't seem to figure out how to get them to be used in game. For example, I want to make it so whenever Sonic walks underwater he switches to the underwater walking animations. The second example is that if Sonic is hit by a electrical hazard, he uses a alternate animation (the unused one from Sonic CD). I tried writing some code for the latter and it didn't work. How could I add these features? (new to forum posting so idk if this should be its own thread or not, let me know if these kinds of questions should be in the basic Q&A thread)
     
  2. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    416
    Location:
    Town Creek, AL
    I work on a Hivebrain, so here's what i know.
    the animation file should be in _anim/Sonic.asm, it's offset downward goes...
    0,1,2,3,4,5,6,7,8,9, $0A,$0B, and so on.
    Since LZ is the only water level in Sonic 1, find the "In Water" flag, somewhere below it add
    Code:
    Cmpi.b (in water flag) ;Is Sonic Underwater?
    bne (rts routine); if not underwater, don't change
    move.b (Whatever offset),$1C(a1)
    
    i think it'd be best to put the animation change near an rts, or else use
    Code:
    Cmpi.b (in water flag) ;Is Sonic Underwater?
    bne (Continue code  routine); if not underwater, don't change
    move.b (Whatever offset),$1C(a1)
    bra (Continue routine)
    
    hope this helps
     
    DeltaWooloo likes this.
  3. DeltaWooloo

    DeltaWooloo The noob next door Member

    Joined:
    Aug 7, 2019
    Messages:
    373
    There are also similar tutorials on how to use different animations for different circumstances.

    I would also recommend asking this in the "Basic Questions and Answers Thread" as this isn't thread-worthy enough unless stated otherwise.
     
    Scrap Sorra, RandomName and warr1or2 like this.