Finding a secret area and receiving a trophy. [SOLVED]

Started by RetroJay, Tue 03/02/2015 07:25:30

Previous topic - Next topic

RetroJay

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. 

Gurok

You can save DynamicSprites with the .SaveToFile() method. Maybe you could draw the graphic to a dynamic sprite and then save it.
[img]http://7d4iqnx.gif;rWRLUuw.gi

RetroJay

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.

Gurok

Something like this should do the trick:

Code: ags
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:

Code: ags
SaveAsTrophy(7, "Roger.bmp");


Hope this makes it a bit easier.
[img]http://7d4iqnx.gif;rWRLUuw.gi

RetroJay

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.

RetroJay

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. 


Gurok

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.
[img]http://7d4iqnx.gif;rWRLUuw.gi

RetroJay

Brilliant.

60 pixels in height should be more than enough.

Thank you for your help.

Yours.
Jay.

SMF spam blocked by CleanTalk