Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Candle on Wed 16/11/2005 22:46:05

Title: Code to use the Animating backgrounds
Post by: Candle on Wed 16/11/2005 22:46:05
There was a post about using the animating backgrounds and how you could use just one of the backgrounds and turn it on and off I think it was?
I want to change the background from the main one to the next one in the animatinf backgrounds but can't find the code.
Title: Re: Code to use the Animating backgrounds
Post by: Sinitrena on Wed 16/11/2005 22:49:04
Is this wahat you are looking for?
SetBackgroundFrame
SetBackgroundFrame (int frame)

Locks the background to frame number FRAME of an animating-background screen. (Values for FRAME are from 0 to 4). This allows you to use the animating backgrounds feature for another purpose - you can have two frames of the background, one for example with a spaceship crashed on it. Then, once the right event has happened, call SetBackgroundFrame in the Player Enters Screen event to set the background before the screen fades in.
Call SetBackgroundFrame(-1) to set the default animating frames.

The frame lock is released when the game changes rooms.

Example:

if (GetGlobalInt(20)==1)
    SetBackgroundFrame(4);

will change the current room's background frame to 4 if the global integer 20 is 1.
See Also: GetBackgroundFrame
Title: Re: Code to use the Animating backgrounds
Post by: Ashen on Wed 16/11/2005 22:50:32
And is this the thread you meant? (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=13012.0)

But yes, Get/SetBackgroundFrame() is probably what you want.
Title: Re: Code to use the Animating backgrounds
Post by: Candle on Wed 16/11/2005 22:53:46
Thats the one Ashen.. thank you .