Jibble

Author Topic: Finding a secret area and receiving a trophy. [SOLVED]  (Read 692 times)

RetroJay

  • Posts: 537
  • Frankly, my dear, I'm a Kerbal and Proud of it.
    • RetroJay worked on a game that was nominated for an AGS Award!
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. 
« Last Edit: 03 Feb 2015, 13:24 by RetroJay »
  Master Decorator

Gurok

  • Rottwheelers
  • Posts: 1,793
  • When life hands you lemons, combine them with the mop
    • I can help with AGS tutoring
    • Best Innovation Award Winner 2016, for improving and extending the AGS scripting language
    • I can help with proof reading
    • I can help with scripting
    • Gurok worked on a game that won an AGS Award!
    •  
    • Gurok worked on a game that was nominated for an AGS Award!
Re: Finding a secret area and receiving a trophy.
« Reply #1 on: 03 Feb 2015, 08:03 »
You can save DynamicSprites with the .SaveToFile() method. Maybe you could draw the graphic to a dynamic sprite and then save it.

RetroJay

  • Posts: 537
  • Frankly, my dear, I'm a Kerbal and Proud of it.
    • RetroJay worked on a game that was nominated for an AGS Award!
Re: Finding a secret area and receiving a trophy.
« Reply #2 on: 03 Feb 2015, 08:11 »
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.
  Master Decorator

Gurok

  • Rottwheelers
  • Posts: 1,793
  • When life hands you lemons, combine them with the mop
    • I can help with AGS tutoring
    • Best Innovation Award Winner 2016, for improving and extending the AGS scripting language
    • I can help with proof reading
    • I can help with scripting
    • Gurok worked on a game that won an AGS Award!
    •  
    • Gurok worked on a game that was nominated for an AGS Award!
Re: Finding a secret area and receiving a trophy.
« Reply #3 on: 03 Feb 2015, 08:30 »
Something like this should do the trick:

Code: Adventure Game Studio
  1. function SaveAsTrophy(int index, String filename)
  2. {
  3.         DynamicSprite *sprite = DynamicSprite.CreateFromExistingSprite(index, true);
  4.         sprite.SaveToFile(filename);
  5. }

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: Adventure Game Studio
  1. SaveAsTrophy(7, "Roger.bmp");

Hope this makes it a bit easier.

RetroJay

  • Posts: 537
  • Frankly, my dear, I'm a Kerbal and Proud of it.
    • RetroJay worked on a game that was nominated for an AGS Award!
Re: Finding a secret area and receiving a trophy.
« Reply #4 on: 03 Feb 2015, 08:43 »
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.
  Master Decorator

RetroJay

  • Posts: 537
  • Frankly, my dear, I'm a Kerbal and Proud of it.
    • RetroJay worked on a game that was nominated for an AGS Award!
Re: Finding a secret area and receiving a trophy.
« Reply #5 on: 03 Feb 2015, 09:20 »
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. 

  Master Decorator

Gurok

  • Rottwheelers
  • Posts: 1,793
  • When life hands you lemons, combine them with the mop
    • I can help with AGS tutoring
    • Best Innovation Award Winner 2016, for improving and extending the AGS scripting language
    • I can help with proof reading
    • I can help with scripting
    • Gurok worked on a game that won an AGS Award!
    •  
    • Gurok worked on a game that was nominated for an AGS Award!
Re: Finding a secret area and receiving a trophy.
« Reply #6 on: 03 Feb 2015, 09:32 »
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.

RetroJay

  • Posts: 537
  • Frankly, my dear, I'm a Kerbal and Proud of it.
    • RetroJay worked on a game that was nominated for an AGS Award!
Re: Finding a secret area and receiving a trophy.
« Reply #7 on: 03 Feb 2015, 09:44 »
Brilliant.

60 pixels in height should be more than enough.

Thank you for your help.

Yours.
Jay.
  Master Decorator