Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Anarcho on Tue 12/04/2005 22:52:21

Title: animation loop flipped problem [SOLVED]
Post by: Anarcho on Tue 12/04/2005 22:52:21
I feel like this was discussed in a tutorial once, but I forget where. I just created a reaching animation for my main character.  I had to expand the canvas size of the bmp in order to draw the outstretched arm.  I loaded the sprites into the manager and created a view.  It works fine when the animation runs on the normal side, but when I flip the view for the right side, the character shifts over to the right in a big jerky way when she picks something up from that side. 

Is there any way I can make this look right without having to go through every view and sprite and load an expanded canvas for each one? 

These views are all cropped by the way.
Title: Re: animation loop flipped problem
Post by: Khris on Wed 13/04/2005 00:03:49
There are 2 easy solutions:

1. AGS 2.7 can align frames: Character[].LockViewAligned

2. Let's suppose you added 15 pixels to the right to draw the outstretched arm. Just add 15 to the left as well. The character sprites' hotspot is always at the bottom-center.
Strange though that your non-flipped animation didn't also shift.

Anyways, here's part of an old char of mine, and it works fine:
(http://home.pages.at/choala/ags/jimmy.png)
Title: Re: animation loop flipped problem
Post by: Anarcho on Wed 13/04/2005 00:45:01
I used the Character[].LockViewAligned, it helps a bit---though there is still a little bit of a shift going on.  I'm not sure what you mean about adding pixels.  Are you talking about adding pixels to the original bmp?  Does that really help when all of the sprites are already cropped?
Title: Re: animation loop flipped problem
Post by: strazer on Wed 13/04/2005 01:00:03
Yes, that's the recommended way to do it.
Since by default sprites are centered on the character, make sure you add equal space to both sides of the sprite.
See Khrismuc's example: He wants the character to stretch out his arm, so he adds some pixels to the right side of the sprite where the arm will be, but he also adds the equal amount of pixels to the left side.
Title: Re: animation loop flipped problem
Post by: Anarcho on Wed 13/04/2005 02:08:57
Ah, got it.  I expanded the pixels evenly just on the arm reach frame, and then used the Align script.  I still saw a tiny bit of difference in the frames, but I after an hour of screwing with it I just realized it was the character scaling that was causing the difference.

Thanks!
Title: Re: animation loop flipped problem
Post by: strazer on Wed 13/04/2005 02:16:15
QuoteI expanded the pixels evenly just on the arm reach frame, and then used the Align script.

If you expanded both sides of the sprites you don't need to align the animation. It's centered by default so a simple SetCharacterView/LockView should suffice.
You only need to align the view if you DON'T expand the sprites.

It's easier the first way because if you need to align the view, you would have to check which way he's facing and align the view accordingly.
If you simply expand the sprites, you don't need to align the view at all.