Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: ian80 on Sat 24/01/2004 04:24:12

Title: Using frames to switch between backgrounds.
Post by: ian80 on Sat 24/01/2004 04:24:12
Hi,

I have a light switch that causes the background to change  BMP. Now, I think I have it scripted right, but it is screwing up because the frames are animated. How do I turn background animation off?
Title: Re:Using frames to switch between backgrounds.
Post by: LordHart on Sat 24/01/2004 04:59:09
I'm pretty sure you can't, seeing as each frame is one part of the backgrounds animation (or maybe CJ changed it recently?).

I would suggest having the animated parts of the background as objects.
Title: Re:Using frames to switch between backgrounds.
Post by: ian80 on Sat 24/01/2004 05:07:16
Ok, maybe I should ask diferently:

What is the best way to change the room's background image mid-game?
Title: Re:Using frames to switch between backgrounds.
Post by: Darth Mandarb on Sat 24/01/2004 06:49:57
Put in the 'Before Fadein' actions a Run Script command and do this:

SetBackgroundFrame=(x); // x being whatever frame you want.

This'll lock in the background frame you want and stop the animating.

Then, when the light switch is thrown, just SetBackgroundFrame=(y); in the script for that event.

:: From the Help File ::

SetBackgroundFrame

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.

hope that helps!

])]v[
Title: Re:Using frames to switch between backgrounds.
Post by: ian80 on Sat 24/01/2004 07:36:23
Thanks Darth.

However, when I do that, I get this message:

variable required on left of assignment.

What does that mean?
Title: Re:Using frames to switch between backgrounds.
Post by: Darth Mandarb on Sat 24/01/2004 07:48:02
Is it giving you that error when you enter the room?  Or when you try to switch the light?  At which point are you getting that error?  Can you post your Script?

Steps:
* select the room interactions (CTRL-I)
* select 'Player Enters Screen (before fadein)'
* choose 'Run Script', in the script type in: SetBackgroundFrame(1); (or whatever frame you want!)
* hit ALT-F-X (save and exit)

That should do what you want.  How are you triggering the effect?  That would help too ;)

])]V[
Title: Re:Using frames to switch between backgrounds.
Post by: ian80 on Sat 24/01/2004 21:17:58
I played around and got it working.