Video files for backgrounds (Solved)

Started by Elessar, Sun 27/05/2007 16:36:02

Previous topic - Next topic

Elessar

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

GarageGothic

#1
You could try this workaround to have more than 5 background frames. Basically it draws sprites from an animation view onto the background using RawDraw routines.

Elessar

Thanks! I am just wondering how to implement it, and where to place the sprites?

GarageGothic

#3
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:
Code: ags
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:
Code: ags
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.



Elessar

#4
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

Elessar

One more thing. Is there a way to embed an .avi movie in a static background or a GUI for a cutscene?

Gilbert

No. That's why you need to use that sprite workaround.

Ashen

Unless you just want an avi as the cutscene with no AGS elements needed, in which case it's in the manual: PlayVideo
I know what you're thinking ... Don't think that.

SMF spam blocked by CleanTalk