Animated Background

Started by HaReL, Wed 22/08/2007 15:30:13

Previous topic - Next topic

HaReL

I have a room, with 4 spirits.
I dont want him to animate from the begining, so I added
Code: ags

 // 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:
Code: ags

  // 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... ;)

Akatosh

You probably meant

Code: ags

SetBackgroundFrame(GetBackgroundFrame()+1);


instead of what you've got now.

Khris

#2
Use this
Code: ags
  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?

HaReL

Thanks, but instead to do the animation, he jump to the last frame. :o
Why?

SMF spam blocked by CleanTalk