Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Dualnames on Thu 26/08/2010 06:30:39

Title: Drawing surface [SOLVED]
Post by: Dualnames on Thu 26/08/2010 06:30:39
So below lies a code that I'm using to draw raindrops.
It randomly draws a rain amount on two places I want (d, and d2) and on 10 loops it restores the surface creating the effect I want. Now I also want the shame effect on the player (d3) and it works nicely, but I can't see the sprites unless the character is transparent. Apparently cause surfaces are drawn on the background. So question is how do I do this?

EDIT: Thanks a lot, solved. :D

Title: Re: Drawing surface.
Post by: Gilbert on Thu 26/08/2010 06:52:12
I having read the codes, but if you want the d3 part to be in front of the player, maybe you can draw them on another DynamicSprite instead of the background?

Maybe you can also use FollowCharacter() to let the engine automatically align the sprite with the character.
Title: Re: Drawing surface.
Post by: Khris on Thu 26/08/2010 08:25:32
Yes, drawing the d3 part on a non-clickable GUI should work.
Title: Re: Drawing surface.
Post by: GarageGothic on Thu 26/08/2010 09:11:57
1) Create a dummy character, make player character invisible.
In rep_exec_always
2) Update dummy chars coordinates to be identical to player's in rep-exec 
2) Create DynamicSprite based on (invisible) player character's current Graphic, resized according to player.Scaling.
3) Draw rain on background, in case particles are in front of player sprite, draw to dummy DynamicSprite.
4) Once drawing done, Release DynamicSprite. Set dummy character's ViewFrame to use DynamicSprite as its Graphic.

In case of multiple characters, a GUI for the whole screen would make more sense. This version of the effect does support alpha channels/transparency of raindrops/characters, though (create DynamicSprite without preserving alpha channel, draw raindrops overlaying player both on background and player, copy the alpha channel of the original player sprite to the dummy DynamicSprite).