Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: RetroJay on Tue 03/02/2015 07:25:30

Title: Finding a secret area and receiving a trophy. [SOLVED]
Post by: RetroJay on Tue 03/02/2015 07:25:30
Hi All.

In my game I have made a secret area that you can find.
In this area there is a Trophy that you can collect to which a message is displayed "You have found a secret!", or something like that.

My question...
Is there a way of making the Trophy useful?
What I mean is... When the player collects it a Trophy graphic is saved to the game folder... maybe.
Then the player could use it within their signature on forums, like people have Trophies here.

I have been searching for an answer to this question but have come up blank.

Any help would be much appreciated.

Yours.
Jay. 
Title: Re: Finding a secret area and receiving a trophy.
Post by: Gurok on Tue 03/02/2015 08:03:01
You can save DynamicSprites with the .SaveToFile() method. Maybe you could draw the graphic to a dynamic sprite and then save it.
Title: Re: Finding a secret area and receiving a trophy.
Post by: RetroJay on Tue 03/02/2015 08:11:04
Hi Gurok.

That sounds like a good idea... However... There is one minor bump in the road.
I have never used DynamicSprites and also have no idea how to draw a graphic to one.:-[

Could you give me some advice or point me in the direction of something that explains DynamicSprites please.

Yours.
Jay.
Title: Re: Finding a secret area and receiving a trophy.
Post by: Gurok on Tue 03/02/2015 08:30:26
Something like this should do the trick:

function SaveAsTrophy(int index, String filename)
{
DynamicSprite *sprite = DynamicSprite.CreateFromExistingSprite(index, true);
sprite.SaveToFile(filename);
}


You can then call SaveAsTrophy with the sprite number and the filename to save it as. I think AGS supports .bmp and .pcx formats (recognised by the extension) from memory. e.g. To save sprite 7 as "Roger.bmp", do:

SaveAsTrophy(7, "Roger.bmp");

Hope this makes it a bit easier.
Title: Re: Finding a secret area and receiving a trophy.
Post by: RetroJay on Tue 03/02/2015 08:43:40
Ah. I see.

I have just been doing some reading, from the manual, and getting hideously confused.(laugh)

Thank you ever so much for taking the time to explain this and for showing me this script.
I really do appreciate it.

I will try this out and let you know how it goes.

Yours.
Jay.
Title: Re: Finding a secret area and receiving a trophy.
Post by: RetroJay on Tue 03/02/2015 09:20:02
Ha ha!

Gurok.
you are a genius. That works just how I had envisioned it.:)
Also, thanks to you, I understand how it works.

One last Question.
What is the largest size I can draw my Trophy at, to be displayed in a signature.
I copied the Key in your signature and opened it in my paint program and it says 76x56.
Is the height of 56 pixels an acceptable size?

Yours.
Jay. 

Title: Re: Finding a secret area and receiving a trophy.
Post by: Gurok on Tue 03/02/2015 09:32:07
60 pixels is the maximum height of a signature. You can go with 56, but 60 would give you a little more to play with.
Title: Re: Finding a secret area and receiving a trophy.
Post by: RetroJay on Tue 03/02/2015 09:44:40
Brilliant.

60 pixels in height should be more than enough.

Thank you for your help.

Yours.
Jay.