Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Creator on Sun 15/05/2011 11:28:58

Title: Dynamic Sprite Help - Getting started (SOLVED)
Post by: Creator on Sun 15/05/2011 11:28:58
This is my first experiance with dynamic sprites, so I need a little nudge to get me started.

All I want to do is draw an image onto the screen, preferbly in front of everything else on screen. I did a quick search and searched through the manual and just can't understand it.

I tried:


DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
surface.DrawImage(0, 0, 63);
surface.Release();


But then I couldn't delete it or clear it without the game crashing, plus it draws on the background, behind the characters.

Again, all I need it a push into getting started and for how to delete it when finished.

Example: Draw image to screen, wait for 3 seconds, clear sprite from screen and delete it.
Title: Re: Dynamic Sprite Help - Getting started
Post by: Dualnames on Sun 15/05/2011 12:28:36
Then it's better to use an overlay imho.

Overlay* myOverlay = Overlay.CreateGraphical(0, 0, 63, false);
Wait(120);
myOverlay.Remove();


EDIT: I thought the alpha parameter was optional.
Title: Re: Dynamic Sprite Help - Getting started
Post by: Creator on Sun 15/05/2011 12:50:23
Dualnames... thank you. :D

Apparantly the final paramater (4th) isn't optional, so I had to set it to true/false. No matter though. Thanks again.
Title: Re: Dynamic Sprite Help - Getting started (SOLVED)
Post by: monkey0506 on Sun 15/05/2011 17:37:21
If you ever need to draw something onto a sprite and then display it this way you can use the DynamicSprite.GetDrawingSurface function to get the surface you need. If you then use that DynamicSprite with an Overlay you can delete the sprite and the Overlay won't be affected. If you display the sprite on a GUI though, you must not delete the sprite and must keep a global pointer to it available or you'll run into problems. Just so you know..;)