Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: LegalWeapon on Sun 25/03/2012 17:14:40

Title: Displaying pictures (jpg/bmp) on events
Post by: LegalWeapon on Sun 25/03/2012 17:14:40
Hello,

I wondered if there is a way in which, upon certain events happening (e.g. an item is collected, or a certain score is reached), one could program the game to show a picture, such as a jpeg or a bmp.

I am thinking, for example, of cutscenes like the ones in Monkey Island (the very first game), or a situation where the character collects a photograph and then the photograph is shown, so one could look at it for clues.

I have been looking at the manual and tutorials, and I have seen that it is possible to include audio or video clips, but could not find a similar set of instructions to include graphic files.

Also, I wondered if, for example, a particular event could play a powerpoint presentation which, once played, shuts itself and the game continues.

Thank you for any assistance you can provide (and please forgive me if there has already been rivers of ink, or pixels, written on this subject).

:)
Title: Re: Displaying pictures (jpg/bmp) on events
Post by: Khris on Sun 25/03/2012 20:37:12
To simply display a picture, there are several ways.
The easiest way is to put it on a GUI. What you would do is import the picture into the Sprite manager, create a new GUI, set the picture as background image, then name the GUI something like "gShowPic".

When the event occurs, you call
  gShowPic.Visible = true;

If you want to show several different pictures you can use a custom function and supply the picture's sprite slot as parameter:
function ShowPic(int slot) {
  gShowPic.BackgroundGraphic = slot;
  gShowPic.Visible = true;
  WaitMouseKey(GetGameSpeed()*60*60*5);  // 5 minutes
  gShowPic.Visible = false;
}


To implement a picture that can be interacted with, like a closeup of an open radio or something, I'd implement it as room, with the walk cursor disabled and the player sprite turned off.

Afaik you can't run PowerPointPresentations from AGS. You can easily emulate a basic slideshow though, so unless you want to use elaborate special effects, there's no need to.
Title: Re: Displaying pictures (jpg/bmp) on events
Post by: LegalWeapon on Sun 25/03/2012 22:43:04
Thank you!
;D
Title: Re: Displaying pictures (jpg/bmp) on events
Post by: kyodai on Mon 26/03/2012 14:47:03
Ah Khris, you're a genius!

Actually i had a similar problem and used a room that was simply a copy of the original room with the picture painted on top. Obviously way too much work if you have loads of rooms, khris' solution is much better.


On a side note - i fumbled a lot with my starting screen which was a similar problem, but as it is actually a 60 frame fullscreen animation (640x480) i ran into the problem that a room animation can only be 4 frames at max.

So what i did was making a view with 60 frame ani and just carefully centered an invisible object in a dummy room that i called the view upon. It works for my title screen, but i wonder if there was a more intelligent workaround than mine.
Title: Re: Displaying pictures (jpg/bmp) on events
Post by: Khris on Mon 26/03/2012 16:07:49
I'd say using an object to display a fullscreen animation is a simple and also the most straightforward way, yes.
Afaik, ogg theora videos can run in the background, even clipped, so that's a viable alternative that might even save a few MBs.