- 250
- Posts
- 7
- Years
- Seen Apr 23, 2025
I've been trying to get this one affine animation to work with my Following Pokémon project. However, as you can see by the following gif, there's one frame right as the animation is starting where the follower's sprite mirrors itself, and then jumps back to it's original spot:
(slowed down for your convenience. Due to the poor quality of the gif maker that I used, sometimes you'll see the frame where the issue happens, sometimes you won't. I swear it's there, even if you get an unlucky series of loops)
Now, I have a rough idea of why this is happening. The east/right facing frames of the follower are mirrored versions of the west/left facing frames. When an affine animation starts, the data that is used for that mirroring must instead be applied to the affine animation, so the mirror is dropped. I tried to work around this by reapplying the mirror in the affine animation, like so:
While this does reset the mirror, it doesn't do so until the second frame of the animation. I've tried setting the duration of that first affine_frame command to 0, but that ends up making the sprite glitch out in other ways, and still doesn't fix the problem. The code that actually calls this animation is this:
I've tried removing the if-statement, in case that was causing some super small slowdown, but that didn't change anything. I even tried hard-coding values into
![[PokeCommunity.com] Affine Animation Mirroring [PokeCommunity.com] Affine Animation Mirroring](https://data.pokecommunity.com/attachments/17/17284-a49673cf067cf5714f891a1e10b82167.jpg)
Now, I have a rough idea of why this is happening. The east/right facing frames of the follower are mirrored versions of the west/left facing frames. When an affine animation starts, the data that is used for that mirroring must instead be applied to the affine animation, so the mirror is dropped. I tried to work around this by reapplying the mirror in the affine animation, like so:
Code:
static const union AffineAnimCmd Following_Pokemon_Shrink_Right[] =
{
AFFINEANIMCMD_FRAME(-512, 0, 0, 1),
AFFINEANIMCMD_FRAME(28, -28, 0, 9),
AFFINEANIMCMD_END,
};
Code:
followerSprite->oam.affineMode = ST_OAM_AFFINE_NORMAL;
InitSpriteAffineAnim(followerSprite);
if (gObjectEvents[gSaveBlock2Ptr->follower.objId].facingDirection == DIR_EAST)
StartSpriteAffineAnim(followerSprite, 2);
else
StartSpriteAffineAnim(followerSprite, 0);
AffineAnimStateStartAnim
and AffineAnimStateReset
in gflib/sprite.c
to force the xScale to be -512 at the start of the animation, but that made no difference either. I can't figure out what I need to do for the affine animation to immediately mirror the follower's sprite rather than letting that first frame be un-mirrored. Does anyone have any insights on this?
Last edited: