Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Elessar on Sun 27/05/2007 16:36:02

Title: Video files for backgrounds (Solved)
Post by: Elessar on Sun 27/05/2007 16:36:02
Hi,

I am helping to make a game that utilizes animated backgrounds, but we're finding that we would like to use more than 5 screens in some rooms. Is there some way to work around this, such as using a video file or animated .gif instead of the 5 frames?

Ryan
Title: Re: Video files for backgrounds
Post by: GarageGothic on Sun 27/05/2007 16:51:05
You could try this workaround to have more than 5 background frames (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=31146.msg399865#msg399865). Basically it draws sprites from an animation view onto the background using RawDraw routines.
Title: Re: Video files for backgrounds
Post by: Elessar on Sun 27/05/2007 23:14:30
Thanks! I am just wondering how to implement it, and where to place the sprites?
Title: Re: Video files for backgrounds
Post by: GarageGothic on Sun 27/05/2007 23:28:05
You import the background frames as sprites and assign them to a View of its own. Just like you would for a character.
Then, depending on whether you need it for a single or several rooms, you  insert the code mentioned in the other thread into either the room script or the global script.

If you insert it in the global script and want to call the function from a room, you need to also put:
import function AnimateBackground(int view, int speed, int loop);
import function StopAnimateBackground();


in the global header.

Now to use the function. Let's say you put your sprites in View 5 and want them to play at a framerate of one animation frame for every two game cycles, and you want the animation to loop. Then, whenever you need to run the animation, you simply call:
AnimateBackground(5, 2, 1);

Probably you want to do it in the EnterRoomBeforeFadein event, if the animation should play always. Otherwise put it in the event which you want to trigger the animation.


Title: Re: Video files for backgrounds
Post by: Elessar on Sun 27/05/2007 23:39:08
Thank you for your quick reply! I will see if I can get it to work.

EDIT: It works great! Thanks for your help,

Ryan
Title: Re: Video files for backgrounds
Post by: Elessar on Mon 28/05/2007 22:21:02
One more thing. Is there a way to embed an .avi movie in a static background or a GUI for a cutscene?
Title: Re: Video files for backgrounds
Post by: Gilbert on Tue 29/05/2007 02:57:21
No. That's why you need to use that sprite workaround.
Title: Re: Video files for backgrounds (Solved)
Post by: Ashen on Tue 29/05/2007 16:59:15
Unless you just want an avi as the cutscene with no AGS elements needed, in which case it's in the manual: PlayVideo (http://www.adventuregamestudio.co.uk/manual/PlayVideo.htm)