Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Atelier on Sat 04/05/2013 20:01:23

Title: Sprite Rotation and Alphas
Post by: Atelier on Sat 04/05/2013 20:01:23
I'm using Khris' Dynamic Sprite Rotation Module: http://www.adventuregamestudio.co.uk/forums/index.php?topic=33122.msg601519#msg601519

Is there any way to preserve the alpha channel of sprites after rotation? Antialiasing is lost as soon as I do so, and I get black edges.

Thanks
Atelier
Title: Re: Sprite Rotation and Alphas
Post by: Khris on Sun 05/05/2013 15:03:51
All the module does is store the current angle of each rotated sprite. The actual rotation is done by AGS.

Which means if you do:
DynamicSprite* sprite = DynS.CreateFromExistingSprite(slot, true);   // preserve alpha channel

and the rotated version still loses the alpha channel, it's AGS's fault.
Title: Re: Sprite Rotation and Alphas
Post by: Atelier on Mon 06/05/2013 14:59:37
Hmm ok. It doesn't look pretty but it's nothing major. Cheers!
Title: Re: Sprite Rotation and Alphas
Post by: Crimson Wizard on Mon 06/05/2013 15:23:47
That's pretty strange, I made this script, and sprite's translucent areas are drawn properly:

Code (ags) Select

function room_AfterFadeIn()
{
  DynamicSprite *spr = DynamicSprite.CreateFromExistingSprite(1, true);
  spr.Rotate(45);
  Overlay *o = Overlay.CreateGraphical(10, 10, spr.Graphic, true);
  Wait(100);
}

NOTE: it's interesting, it works right even if I create non-transparent overlay (Overlay.CreateGraphical's last parameter is false)

The game is 32-bit, sprite is imported from png with alpha channel.

Maybe we could compare our actions to find out what did you do different?

Using AGS 3.2.1 btw.