Hello everyone!
I'm making my first game ever, and want to start the game with a image sequence full s as cutscene, like a slideshow. There's no need for control as "back" or "next", I just want to automatically show the images and then move to a room.
I thought of animating backgrounds, but I don't know to tell AGS not to repeat the animated background loop and after X seconds move to a different room. Is there a way to do this?
In room_Load():
SetBackgroundFrame(0);
SetTimer(1, 5 * GetGameSpeed()); // 5 seconds
In room_RepExec():
if (IsTimerExpired(1)) {
int cf = GetBackgroundFrame();
if (cf < 4) {
SetBackgroundFrame(cf + 1);
SetTimer(1, 5 * GetGameSpeed());
}
else player.ChangeRoom(2);
}
Quote from: Khris on Wed 21/04/2021 21:43:12
In room_Load():
SetBackgroundFrame(0);
SetTimer(1, 5 * GetGameSpeed()); // 5 seconds
In room_RepExec():
if (IsTimerExpired(1)) {
int cf = GetBackgroundFrame();
if (cf < 4) {
SetBackgroundFrame(cf + 1);
SetTimer(1, 5 * GetGameSpeed());
}
else player.ChangeRoom(2);
}
Hello Khris, thanks for the assistance!
It kind of works, but at the end of the animation I get the error "SetBackgroundFrame: invalid frame number specified" on line "SetBackgroundFrame(cf + 1);" . What could this mean?
If you are using less than 5 frames you need to decrease the number in line 3 of the second snippet.
Say you're using just three, that's frame #0, frame #1 and frame #2. This means you only want to switch to the next frame if the current frame is < 2.
(also, please don't quote the entire previous post; there's a reply button at the bottom of the thread)