Hi guys!
I'm using dynamic sprites for my rpg to be able to create differents pieces of stuff.
Thus, I have for each piece of equipment one view for legs, one for body and one for head. I then combine then( code below, but I guess not in cause here).
Problem is, when I combine the 3 views (that look fine on their own) it creates a pink edging around the character and on the shadow.
I found this old thread that might explain the problem, but not really how to solve it :s
https://www.adventuregamestudio.co.uk/forums/beginners-technical-questions/solved-quick-import-sprites-transparency-issue/msg636525850/#msg636525850
Here are a few pictures :
When I use only legs view for my normal view
(https://i.postimg.cc/rF6x5Ygm/img1.png)
When the leg view is combined with body and head-->pink trouble
(https://i.postimg.cc/fRCdnWst/img2.png)
Thanks in advance :)
Can you show the code you're using? For instance, is the DynamicSprite created with an alpha channel? Are you clearing the DS using COLOR_TRANSPARENT, etc.
The issue used to be that drawing an alpha channel PNG to a cleared DrawingSurface ruined the transparency because there was no color to blend the semi-transparent pixels with. Afaik this has been resolved though, but I'm not sure.
If you're drawing the three sprites to a new sprite, try creating a copy of the first sprite and drawing the other two to its surface instead.
Sorry I forgot the code :
function ChangeNormalView(int base)
{
int MySpriteNo=0;
int currentloop=0;
int currentframe;
while (currentloop <= 7)//invariable
{
currentframe = 0;
while (currentframe <= 8)
{
MySprite2[MySpriteNo] = DynamicSprite.Create(256, 256);
DrawingSurface *MySurface = MySprite2[MySpriteNo].GetDrawingSurface();
ViewFrame *LegViewFrame = Game.GetViewFrame(base, currentloop, currentframe);
MySurface.DrawImage(0, 0, LegViewFrame.Graphic);
ViewFrame *ArmorViewFrame = Game.GetViewFrame(base+1, currentloop, currentframe);
MySurface.DrawImage(0, 0, ArmorViewFrame.Graphic);
ViewFrame *HDViewFrame = Game.GetViewFrame(base+2, currentloop, currentframe);
MySurface.DrawImage(0, 0, HDViewFrame.Graphic);
MySurface.Release();
ViewFrame *MyViewFrame = Game.GetViewFrame(52, currentloop, currentframe);
MyViewFrame.Graphic = MySprite2[MySpriteNo].Graphic;
MySpriteNo ++;
currentframe ++;
}
currentloop ++;
}
player.ChangeView(52);
}
Quote from: AGS Manualstatic DynamicSprite* DynamicSprite.Create(int width, int height, optional bool hasAlphaChannel)
You have to set hasAlphaChannel to true.
Thta was it, thanks a lot :)