Background help

Started by link197, Tue 06/01/2009 02:10:45

Previous topic - Next topic

link197

I want to flip through a cutscene by controlling the rate of background turnover by individual background. Is there a scripting command that will change the background at a specified rate, perhaps using the name of each individual background? Thank You.

Khris

What do you mean by "background turnover" / "change the background"? Room changes? Room transitions? Background animation in a single room?

link197

Yeah i mean like a cutscene that consists of an animated background. I want to control the rate of turnover of the backgrounds.

Khris

Ah, ok.
You can use Timers and switch to another frame when they expire.

Code: ags
// in the room's after fadein event
  SetBackgroundFrame(0);            // stop background animation
  SetTimer(1, 10*GetGameSpeed());   // switch to frame 1 ten seconds after entering the room
  SetTimer(2, 20*GetGameSpeed());   // switch to frame 2 twenty seconds after entering the room
  SetTimer(3, 40*GetGameSpeed());   // ...
  SetTimer(4, 50*GetGameSpeed());

// in the room's repeatedly_execute event
  int i = 1;
  while (i < 5) {
    if (IsTimerExpired(i)) SetBackgroundFrame(i);   // check timers 1-4, switch to respective bg frame
    i++;
  }

SMF spam blocked by CleanTalk