Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: HaReL on Wed 22/08/2007 15:30:13

Title: Animated Background
Post by: HaReL on Wed 22/08/2007 15:30:13
I have a room, with 4 spirits.
I dont want him to animate from the begining, so I added

// script for Room: Player enters room (before fadein)
  SetBackgroundFrame(0);


what I want to do is that when the player is interact with hotspot, then the background will start the animation, and will stop after 1 loop.

I thought to do something like this:

  // script for Hotspot 1 (Hotspot 1): Interact hotspot
while (GetBackgroundFrame() < 3) {
GetBackgroundFrame ()++ = SetBackgroundFrame;
}   


But i get an error... (Expected ';' ).
what's the problem?

thanks alot... ;)
Title: Re: Animated Background
Post by: Akatosh on Wed 22/08/2007 16:38:04
You probably meant


SetBackgroundFrame(GetBackgroundFrame()+1);


instead of what you've got now.
Title: Re: Animated Background
Post by: Khris on Wed 22/08/2007 16:42:25
Use this
  while (GetBackgroundFrame()<3) {
    SetBackgroundFrame(GetBackgroundFrame()+1);
    Wait(10); // change the param to set the speed
  }


With variables, put the variable to be set to the left of the "="; put the expression it gets set to to the right:

variable_to_be_changed = expression;

So say there was a variable called Room.BackgroundFrame which one could use to change the frame, one would write:
Room.BackgroundFrame=Room.BackgroundFrame+1;
Or the short version:
Room.BackgroundFrame++;

Edit: Did you put the wait command in there?
Title: Re: Animated Background
Post by: HaReL on Wed 22/08/2007 18:59:12
Thanks, but instead to do the animation, he jump to the last frame. :o
Why?